Skip to content

Commit 0128a77

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 0d4c75f commit 0128a77

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
@@ -1221,7 +1221,7 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
12211221
item = (IndexTuple) PageGetItem(origpage, itemid);
12221222
lastrdata->data = (char *) item;
12231223
lastrdata->len = MAXALIGN(IndexTupleSize(item));
1224-
lastrdata->buffer = buf; /* backup block 1 */
1224+
lastrdata->buffer = buf; /* backup block 0 */
12251225
lastrdata->buffer_std = true;
12261226
}
12271227

@@ -1248,7 +1248,7 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
12481248

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

12651265
lastrdata->data = NULL;
12661266
lastrdata->len = 0;
1267-
lastrdata->buffer = buf; /* backup block 1 */
1267+
lastrdata->buffer = buf; /* backup block 0 */
12681268
lastrdata->buffer_std = true;
12691269
}
12701270

@@ -1297,7 +1297,7 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
12971297

12981298
lastrdata->data = NULL;
12991299
lastrdata->len = 0;
1300-
lastrdata->buffer = sbuf; /* backup block 2 */
1300+
lastrdata->buffer = sbuf; /* backup block 1 */
13011301
lastrdata->buffer_std = true;
13021302
}
13031303

0 commit comments

Comments
 (0)