Skip to content

Commit e0c04b7

Browse files
committed
Use 0-based numbering in comments about backup blocks.
The macros and functions that work with backup blocks in the redo function use 0-based numbering, so let's use that consistently in the function that generates the records too. Makes it so much easier to compare the generation and replay functions. Backpatch to 9.0, where we switched from 1-based to 0-based numbering.
1 parent 777d07d commit e0c04b7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/backend/access/nbtree/nbtinsert.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,7 +1230,7 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
12301230
item = (IndexTuple) PageGetItem(origpage, itemid);
12311231
lastrdata->data = (char *) item;
12321232
lastrdata->len = MAXALIGN(IndexTupleSize(item));
1233-
lastrdata->buffer = buf; /* backup block 1 */
1233+
lastrdata->buffer = buf; /* backup block 0 */
12341234
lastrdata->buffer_std = true;
12351235
}
12361236

@@ -1257,7 +1257,7 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
12571257

12581258
lastrdata->data = (char *) newitem;
12591259
lastrdata->len = MAXALIGN(newitemsz);
1260-
lastrdata->buffer = buf; /* backup block 1 */
1260+
lastrdata->buffer = buf; /* backup block 0 */
12611261
lastrdata->buffer_std = true;
12621262
}
12631263
else if (ropaque->btpo.level == 0)
@@ -1266,14 +1266,14 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
12661266
* Although we don't need to WAL-log the new item, we still need
12671267
* XLogInsert to consider storing a full-page image of the left
12681268
* page, so make an empty entry referencing that buffer. This also
1269-
* ensures that the left page is always backup block 1.
1269+
* ensures that the left page is always backup block 0.
12701270
*/
12711271
lastrdata->next = lastrdata + 1;
12721272
lastrdata++;
12731273

12741274
lastrdata->data = NULL;
12751275
lastrdata->len = 0;
1276-
lastrdata->buffer = buf; /* backup block 1 */
1276+
lastrdata->buffer = buf; /* backup block 0 */
12771277
lastrdata->buffer_std = true;
12781278
}
12791279

@@ -1306,7 +1306,7 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
13061306

13071307
lastrdata->data = NULL;
13081308
lastrdata->len = 0;
1309-
lastrdata->buffer = sbuf; /* backup block 2 */
1309+
lastrdata->buffer = sbuf; /* backup block 1 */
13101310
lastrdata->buffer_std = true;
13111311
}
13121312

0 commit comments

Comments
 (0)