Index: trunk/phase3/includes/Revision.php |
— | — | @@ -259,10 +259,13 @@ |
260 | 260 | $this->mTitle = null; |
261 | 261 | } |
262 | 262 | |
| 263 | + // Lazy extraction... |
| 264 | + $this->mText = null; |
263 | 265 | if( isset( $row->old_text ) ) { |
264 | | - $this->mText = $this->getRevisionText( $row ); |
| 266 | + $this->mTextRow = $row; |
265 | 267 | } else { |
266 | | - $this->mText = null; |
| 268 | + // 'text' table row entry will be lazy-loaded |
| 269 | + $this->mTextRow = null; |
267 | 270 | } |
268 | 271 | } elseif( is_array( $row ) ) { |
269 | 272 | // Build a new revision to be saved... |
— | — | @@ -668,14 +671,22 @@ |
669 | 672 | function loadText() { |
670 | 673 | $fname = 'Revision::loadText'; |
671 | 674 | wfProfileIn( $fname ); |
| 675 | + |
| 676 | + // If we kept data for lazy extraction, use it now... |
| 677 | + $row = $this->mTextRow; |
| 678 | + $this->mTextRow = null; |
| 679 | + |
| 680 | + if( !$row ) { |
| 681 | + // Text data is immutable; check slaves first. |
| 682 | + $dbr =& wfGetDB( DB_SLAVE ); |
| 683 | + $row = $dbr->selectRow( 'text', |
| 684 | + array( 'old_text', 'old_flags' ), |
| 685 | + array( 'old_id' => $this->getTextId() ), |
| 686 | + $fname); |
| 687 | + } |
672 | 688 | |
673 | | - $dbr =& wfGetDB( DB_SLAVE ); |
674 | | - $row = $dbr->selectRow( 'text', |
675 | | - array( 'old_text', 'old_flags' ), |
676 | | - array( 'old_id' => $this->getTextId() ), |
677 | | - $fname); |
678 | | - |
679 | 689 | if( !$row ) { |
| 690 | + // Possible slave lag! |
680 | 691 | $dbw =& wfGetDB( DB_MASTER ); |
681 | 692 | $row = $dbw->selectRow( 'text', |
682 | 693 | array( 'old_text', 'old_flags' ), |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -208,6 +208,8 @@ |
209 | 209 | * (bug 7309) Plurals: use singular form for zero in French and Brazilian Portuguese |
210 | 210 | * Add page_no_title_convert field to support language variant conversion |
211 | 211 | for page titles which shouldn't be converted on display/linking |
| 212 | +* Lazy extraction of text chunks in Revision objects, may reduce hits to |
| 213 | + external storage when actual text content is not used |
212 | 214 | |
213 | 215 | |
214 | 216 | == Languages updated == |