- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit6acab8b
Refactor autoprewarm_database_main() in preparation for read stream
Autoprewarm prewarms blocks from a dump file representing the contentsof shared buffers at the time it was dumped. It uses a sorted array ofBlockInfoRecords, each representing a block from one of the cluster'sdatabases and tables.autoprewarm_database_main() prewarms all the blocks from a singledatabase. It is optimized to ensure we don't try to open the samerelation or fork over and over again if it has been dropped or isinvalid. The main loop handled this by carefully setting various localvariables to sentinel values when a run of blocks should be skipped.This method won't work with the read stream API. The read streamcallback must be able to advance the current position in theBlockInfoRecord array to allow for reading ahead additional blocks,however a read stream maps 1-1 with a relation and fork combination. So,the main loop in autoprewarm_database_main() must also advance theposition in the array of BlockInfoRecords to skip invalid relations andforks. This split control doesn't fit well with the current flow controlin autoprewarm_database_main()To make it compatible with the read stream API, changeautoprewarm_database_main() to explicitly fast-forward in theBlockInfoRecords array past the blocks belonging to an invalid relationor fork.This commit only implements the new control flow -- it does not use theread stream API.Co-authored-by: Nazir Bilal Yavuz <byavuz81@gmail.com>Co-authored-by: Melanie Plageman <melanieplageman@gmail.com>Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>Reviewed-by: Daniel Gustafsson <daniel@yesql.se>Discussion:https://postgr.es/m/flat/CAN55FZ3n8Gd%2BhajbL%3D5UkGzu_aHGRqnn%2BxktXq2fuds%3D1AOR6Q%40mail.gmail.com1 parent7f848cb commit6acab8b
1 file changed
+94
-78
lines changedLines changed: 94 additions & 78 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
429 | 429 |
| |
430 | 430 |
| |
431 | 431 |
| |
432 |
| - | |
433 | 432 |
| |
434 |
| - | |
435 |
| - | |
436 |
| - | |
| 433 | + | |
| 434 | + | |
437 | 435 |
| |
438 | 436 |
| |
439 | 437 |
| |
| |||
449 | 447 |
| |
450 | 448 |
| |
451 | 449 |
| |
452 |
| - | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
453 | 453 |
| |
454 | 454 |
| |
455 | 455 |
| |
456 | 456 |
| |
457 | 457 |
| |
458 |
| - | |
| 458 | + | |
459 | 459 |
| |
460 |
| - | |
461 |
| - | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
462 | 464 |
| |
463 | 465 |
| |
464 | 466 |
| |
465 | 467 |
| |
466 | 468 |
| |
467 | 469 |
| |
468 | 470 |
| |
469 |
| - | |
| 471 | + | |
470 | 472 |
| |
471 |
| - | |
472 |
| - | |
473 |
| - | |
474 |
| - | |
475 |
| - | |
476 |
| - | |
477 |
| - | |
478 |
| - | |
479 |
| - | |
480 |
| - | |
481 |
| - | |
482 |
| - | |
483 |
| - | |
484 |
| - | |
485 |
| - | |
486 |
| - | |
487 |
| - | |
| 473 | + | |
488 | 474 |
| |
489 |
| - | |
490 |
| - | |
491 |
| - | |
492 |
| - | |
493 |
| - | |
494 |
| - | |
495 |
| - | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
496 | 478 |
| |
497 |
| - | |
| 479 | + | |
| 480 | + | |
498 | 481 |
| |
499 |
| - | |
500 |
| - | |
501 |
| - | |
502 |
| - | |
503 |
| - | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
504 | 495 |
| |
505 |
| - | |
506 |
| - | |
507 |
| - | |
508 |
| - | |
509 |
| - | |
510 |
| - | |
| 496 | + | |
511 | 497 |
| |
512 | 498 |
| |
513 | 499 |
| |
514 |
| - | |
515 |
| - | |
516 |
| - | |
517 |
| - | |
518 |
| - | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
519 | 510 |
| |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
520 | 515 |
| |
521 | 516 |
| |
522 | 517 |
| |
523 | 518 |
| |
524 |
| - | |
525 |
| - | |
526 |
| - | |
527 |
| - | |
528 |
| - | |
529 |
| - | |
530 |
| - | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
531 | 540 |
| |
532 |
| - | |
533 |
| - | |
534 |
| - | |
535 |
| - | |
536 |
| - | |
537 |
| - | |
538 |
| - | |
| 541 | + | |
539 | 542 |
| |
540 |
| - | |
541 |
| - | |
542 |
| - | |
543 |
| - | |
544 |
| - | |
545 |
| - | |
546 |
| - | |
547 |
| - | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
548 | 551 |
| |
549 |
| - | |
550 |
| - | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
551 | 558 |
| |
552 |
| - | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
553 | 570 |
| |
554 |
| - | |
555 |
| - | |
556 |
| - | |
557 | 571 |
| |
558 | 572 |
| |
559 | 573 |
| |
| 574 | + | |
| 575 | + | |
560 | 576 |
| |
561 | 577 |
| |
562 | 578 |
| |
|
0 commit comments
Comments
(0)