From 7d818c8f9d5ffc5b9e8643507484d7f2720ff86c Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 7 Mar 2017 14:47:02 +0000 Subject: [PATCH] Before beginning an incremental checkpoint in RBU, sync the directory containing the target database file. This ensures that the new directory entry created by renaming the *-oal file to *-wal is synced to disk. Cherrypick of [915a9a28]. FossilOrigin-Name: 694fe0b22bfa13d91f5fcdbe0562cb31334ce017 --- ext/rbu/sqlite3rbu.c | 7 +++++++ manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ext/rbu/sqlite3rbu.c b/ext/rbu/sqlite3rbu.c index 163a544259..7dd232b4b5 100644 --- a/ext/rbu/sqlite3rbu.c +++ b/ext/rbu/sqlite3rbu.c @@ -2624,6 +2624,7 @@ static void rbuSetupCheckpoint(sqlite3rbu *p, RbuState *pState){ }else{ int nSectorSize; sqlite3_file *pDb = p->pTargetFd->pReal; + sqlite3_file *pWal = p->pTargetFd->pWalFd->pReal; assert( p->nPagePerSector==0 ); nSectorSize = pDb->pMethods->xSectorSize(pDb); if( nSectorSize>p->pgsz ){ @@ -2631,6 +2632,12 @@ static void rbuSetupCheckpoint(sqlite3rbu *p, RbuState *pState){ }else{ p->nPagePerSector = 1; } + + /* Call xSync() on the wal file. This causes SQLite to sync the + ** directory in which the target database and the wal file reside, in + ** case it has not been synced since the rename() call in + ** rbuMoveOalFile(). */ + p->rc = pWal->pMethods->xSync(pWal, SQLITE_SYNC_NORMAL); } } } diff --git a/manifest b/manifest index 156ffb6f19..99b9c385b9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sanother\sRBU\scase\ssimilar\sto\sthe\sprevious.\sThis\sone\sfor\ssystems\swhere\sthe\nsector-size\sis\slarger\sthan\sthe\spage-size.\sCherrypick\sof\s[4012bb3a]. -D 2017-03-07T14:46:25.116 +C Before\sbeginning\san\sincremental\scheckpoint\sin\sRBU,\ssync\sthe\sdirectory\ncontaining\sthe\starget\sdatabase\sfile.\sThis\sensures\sthat\sthe\snew\sdirectory\sentry\ncreated\sby\srenaming\sthe\s*-oal\sfile\sto\s*-wal\sis\ssynced\sto\sdisk.\sCherrypick\sof\n[915a9a28]. +D 2017-03-07T14:47:02.385 F Makefile.in edb6bcdd37748d2b1c3422ff727c748df7ffe918 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 067a6766f800cc8d72845ab61f8de4ffe8f3fc99 @@ -261,7 +261,7 @@ F ext/rbu/rburesume.test 8acb77f4a422ff55acfcfc9cc15a5cb210b1de83 F ext/rbu/rbusave.test 0f43b6686084f426ddd040b878426452fd2c2f48 F ext/rbu/rbuvacuum.test 4a977447c15c2581ab668781d9ef4294382530e0 F ext/rbu/rbuvacuum2.test 2074ab14fe66e1c7e7210c62562650dcd215bbaa -F ext/rbu/sqlite3rbu.c cba23db39792175295b94ad0086825894b617921 +F ext/rbu/sqlite3rbu.c 2a89efba9eeba8e6c89a498dc195e8efbdde2694 F ext/rbu/sqlite3rbu.h 6fb6294c34a9ca93b5894a33bca530c6f08decba F ext/rbu/test_rbu.c 5aa22616afac6f71ebd3d9bc9bf1006cfabcca88 F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761 @@ -1556,8 +1556,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 811a559967d886239fc0b16fac08707c78e60988 -Q +4012bb3aa91927156ba149caa4e5c622b0729d79 -R d9b66f58a0523dc7bc0a62014299d641 +P 59a11b7f1f4aeefec7102b4859deda70b0b934b9 +Q +915a9a28783fbb2f4c0794eb4264ce8c0b9d42f7 +R 1d86992c5b1ed821d31ab7205d9b0768 U dan -Z c2e9b5702f8f818cb604d64fafb45a3c +Z c76854f4a10706e6a8874036088648ec diff --git a/manifest.uuid b/manifest.uuid index a07d14ac75..b74b180c79 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -59a11b7f1f4aeefec7102b4859deda70b0b934b9 \ No newline at end of file +694fe0b22bfa13d91f5fcdbe0562cb31334ce017 \ No newline at end of file -- 2.47.2