| 344 | } |
| 345 | |
| 346 | static void |
| 347 | ginRedoInsert(XLogReaderState *record) |
| 348 | { |
| 349 | XLogRecPtr lsn = record->EndRecPtr; |
| 350 | ginxlogInsert *data = (ginxlogInsert *) XLogRecGetData(record); |
| 351 | Buffer buffer; |
| 352 | #ifdef NOT_USED |
| 353 | BlockNumber leftChildBlkno = InvalidBlockNumber; |
| 354 | #endif |
| 355 | BlockNumber rightChildBlkno = InvalidBlockNumber; |
| 356 | bool isLeaf = (data->flags & GIN_INSERT_ISLEAF) != 0; |
| 357 | |
| 358 | /* |
| 359 | * First clear incomplete-split flag on child page if this finishes a |
| 360 | * split. |
| 361 | */ |
| 362 | if (!isLeaf) |
| 363 | { |
| 364 | char *payload = XLogRecGetData(record) + sizeof(ginxlogInsert); |
| 365 | |
| 366 | #ifdef NOT_USED |
| 367 | leftChildBlkno = BlockIdGetBlockNumber((BlockId) payload); |
| 368 | #endif |
| 369 | payload += sizeof(BlockIdData); |
| 370 | rightChildBlkno = BlockIdGetBlockNumber((BlockId) payload); |
| 371 | payload += sizeof(BlockIdData); |
| 372 | |
| 373 | ginRedoClearIncompleteSplit(record, 1); |
| 374 | } |
| 375 | |
| 376 | if (XLogReadBufferForRedo(record, 0, &buffer) == BLK_NEEDS_REDO) |
| 377 | { |
| 378 | Page page = BufferGetPage(buffer); |
| 379 | Size len; |
| 380 | char *payload = XLogRecGetBlockData(record, 0, &len); |
| 381 | |
| 382 | /* How to insert the payload is tree-type specific */ |
| 383 | if (data->flags & GIN_INSERT_ISDATA) |
| 384 | { |
| 385 | Assert(GinPageIsData(page)); |
| 386 | ginRedoInsertData(buffer, isLeaf, rightChildBlkno, payload); |
| 387 | } |
| 388 | else |
| 389 | { |
| 390 | Assert(!GinPageIsData(page)); |
| 391 | ginRedoInsertEntry(buffer, isLeaf, rightChildBlkno, payload); |
| 392 | } |
| 393 | |
| 394 | PageSetLSN(page, lsn); |
| 395 | MarkBufferDirty(buffer); |
| 396 | } |
| 397 | if (BufferIsValid(buffer)) |
| 398 | UnlockReleaseBuffer(buffer); |
| 399 | } |
| 400 | |
| 401 | static void |
| 402 | ginRedoSplit(XLogReaderState *record) |
no test coverage detected