From b457b5562cfdc4d08df260bc6a4258d3a423a5b0 Mon Sep 17 00:00:00 2001 From: Viktor Ganeles Date: Wed, 19 Aug 2026 17:44:50 +0300 Subject: [PATCH] With --database-iteration-mode=restore, iteration 1 ran on the datadir natively written by the fill, while iterations 2+ ran on a datadir rewritten by cp during restore. On virtualized storage the restored copy is served measurably faster, making iteration 1 consistently 14-28% slower on IO-bound workloads. Fix: after creating the restore image, immediately restore from it so iteration 1 starts from the same physical state as later iterations, and sync before DbStart so restore writeback completes while the database is stopped." --- libs/taf_libs/TAF/Run.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libs/taf_libs/TAF/Run.pm b/libs/taf_libs/TAF/Run.pm index 4dad428..31dcf88 100644 --- a/libs/taf_libs/TAF/Run.pm +++ b/libs/taf_libs/TAF/Run.pm @@ -664,6 +664,13 @@ sub CheckTestSetup { if($dbMode eq "restore" && !$restoreCreated){ PrintVerbose("Database restore requested, creating restore image..."); return ERROR if _CreateRestoreImage($ctx) != OK; + # Restore immediately after creating the image so iteration 1 runs + # on the same freshly-restored datadir as every later iteration; + # a natively-filled datadir and a restored copy differ in physical + # state (storage cache warmth, file layout) and skew results. + PrintVerbose("Restoring image so iteration 1 runs on a restored datadir."); + $state->{first_time_in_tests_loop} = FALSE; + return _RestoreImage($ctx); } } @@ -2628,6 +2635,13 @@ sub _RestoreImage { return ERROR; } + # + # Flush the page cache so writeback from the restored datadir completes + # while the database is still stopped; otherwise it competes with the + # test's I/O after startup. + # + system("sync"); + # # Start backend after restore #