]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Simplification of the recent VACUUM changes that make the code more like
authordrh <drh@noemail.net>
Thu, 4 Apr 2019 15:25:52 +0000 (15:25 +0000)
committerdrh <drh@noemail.net>
Thu, 4 Apr 2019 15:25:52 +0000 (15:25 +0000)
what it was before the change.  Also, make the VACUUM command a no-inline
procedure to work around a performance regression.

FossilOrigin-Name: 9cac5ac145d62117c918539baaa8a3c124230e031842e35fa1ba59f658c99518

manifest
manifest.uuid
src/vacuum.c

index df2734bcb2682b1e7819460d2a499fd6f3cb1ba8..a31c8154beafb98972447695919fa1c3a8960b1b 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\san\sincorrect\scomment\son\sa\stest\scase\sfor\srowid\srenumbering\sin\sVACUUM.
-D 2019-04-04T14:36:02.916
+C Simplification\sof\sthe\srecent\sVACUUM\schanges\sthat\smake\sthe\scode\smore\slike\nwhat\sit\swas\sbefore\sthe\schange.\s\sAlso,\smake\sthe\sVACUUM\scommand\sa\sno-inline\nprocedure\sto\swork\saround\sa\sperformance\sregression.
+D 2019-04-04T15:25:52.906
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -588,7 +588,7 @@ F src/update.c 0b973357d88092140531e07ff641139c26fb4380b0b9f5ed98c5f7691b4604d1
 F src/upsert.c 0dd81b40206841814d46942a7337786932475f085716042d0cb2fc7791bf8ca4
 F src/utf.c 810fbfebe12359f10bc2a011520a6e10879ab2a163bcb26c74768eab82ea62a5
 F src/util.c 82a2e3f691a3b654be872e305dab1f455e565dedf5e6a90c818c1ab307c00432
-F src/vacuum.c b26da99ec56937cb0231a2467e32b012a6d654419654ed5f10cb42ee40da57da
+F src/vacuum.c d07bc4025836ad3ff298a738270bce9411dd39cbd8a2d4bb87d7a94e54526878
 F src/vdbe.c 711ef421b3bb3db3b2476067b2dc3c71ef5844d9b1a723026578f89f6da621e8
 F src/vdbe.h 712bca562eaed1c25506b9faf9680bdc75fc42e2f4a1cd518d883fa79c7a4237
 F src/vdbeInt.h d0c78ec6ba57e438164c46ee8129ee00ccd898c472b27e325c9758eda533e37e
@@ -1815,7 +1815,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 13a0ea6466b051ea5281865ed5285b8b5a99ec4307f400c5f7b03692723f1cd1
-R 7dca043d74b2082c0b554f482d34e9ab
+P 0d293fb43f2eb64026ac1e0422f54d4839b101898cc9913fc7746760c08ed41f
+R e9ef2ca76b94d3f345755da3257abb70
 U drh
-Z ac7734c1d97c4d0f0e04e897e2e22d0e
+Z 61d0e658cab98af12ebf4f008f8de14c
index 50d37a852f8b6325b3fdcb56ba7a3e86580e34e8..da45201901a741e3578f27163810b58e0599922f 100644 (file)
@@ -1 +1 @@
-0d293fb43f2eb64026ac1e0422f54d4839b101898cc9913fc7746760c08ed41f
\ No newline at end of file
+9cac5ac145d62117c918539baaa8a3c124230e031842e35fa1ba59f658c99518
\ No newline at end of file
index 6ba87e53e16ec4aa05093edcca511c1816474089..1c9164c85d161bdfef96590a4706e875dd6f1668 100644 (file)
@@ -139,7 +139,7 @@ build_vacuum_end:
 /*
 ** This routine implements the OP_Vacuum opcode of the VDBE.
 */
-int sqlite3RunVacuum(
+SQLITE_NOINLINE int sqlite3RunVacuum(
   char **pzErrMsg,        /* Write error message here */
   sqlite3 *db,            /* Database connection */
   int iDb,                /* Which attached DB to vacuum */
@@ -170,7 +170,6 @@ int sqlite3RunVacuum(
     return SQLITE_ERROR;
   }
   saved_openFlags = db->openFlags;
-  saved_mDbFlags = db->mDbFlags;
   if( pOut ){
     if( sqlite3_value_type(pOut)!=SQLITE_TEXT ){
       sqlite3SetString(pzErrMsg, db, "non-text filename");
@@ -179,20 +178,20 @@ int sqlite3RunVacuum(
     zOut = (const char*)sqlite3_value_text(pOut);
     db->openFlags &= ~SQLITE_OPEN_READONLY;
     db->openFlags |= SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE;
-    db->mDbFlags |= DBFLAG_PreferBuiltin | DBFLAG_Vacuum | DBFLAG_VacuumInto;
   }else{
     zOut = "";
-    db->mDbFlags |= DBFLAG_PreferBuiltin | DBFLAG_Vacuum;
   }
 
   /* Save the current value of the database flags so that it can be 
   ** restored before returning. Then set the writable-schema flag, and
   ** disable CHECK and foreign key constraints.  */
   saved_flags = db->flags;
+  saved_mDbFlags = db->mDbFlags;
   saved_nChange = db->nChange;
   saved_nTotalChange = db->nTotalChange;
   saved_mTrace = db->mTrace;
   db->flags |= SQLITE_WriteSchema | SQLITE_IgnoreChecks;
+  db->mDbFlags |= DBFLAG_PreferBuiltin | DBFLAG_Vacuum;
   db->flags &= ~(u64)(SQLITE_ForeignKeys | SQLITE_ReverseOrder
                    | SQLITE_Defensive | SQLITE_CountRows);
   db->mTrace = 0;
@@ -231,6 +230,7 @@ int sqlite3RunVacuum(
       sqlite3SetString(pzErrMsg, db, "output file already exists");
       goto end_of_vacuum;
     }
+    db->mDbFlags |= DBFLAG_VacuumInto;
   }
   nRes = sqlite3BtreeGetOptimalReserve(pMain);
 
@@ -308,7 +308,7 @@ int sqlite3RunVacuum(
       zDbMain
   );
   assert( (db->mDbFlags & DBFLAG_Vacuum)!=0 );
-  db->mDbFlags &= ~(DBFLAG_Vacuum|DBFLAG_VacuumInto);
+  db->mDbFlags &= ~DBFLAG_Vacuum;
   if( rc!=SQLITE_OK ) goto end_of_vacuum;
 
   /* Copy the triggers, views, and virtual tables from the main database