Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Use the same "PRAGMA synchronous" setting for the output of a "VACUUM INTO" as are configured for the database being vacuumed. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
86cb21ca12581cae9a29f42ba707bd9d |
User & Date: | dan 2022-10-24 15:51:24.342 |
Context
2022-10-24
| ||
18:33 | Add a comment to a previously undescribed member of the Walker union. (check-in: 69d704224e user: drh tags: trunk) | |
15:51 | Use the same "PRAGMA synchronous" setting for the output of a "VACUUM INTO" as are configured for the database being vacuumed. (check-in: 86cb21ca12 user: dan tags: trunk) | |
13:20 | Improve the ability of the query planner to recognize covering indexes even on tables with more than 63 columns and where the index is over columns beyond the 63rd column. (check-in: f058773e41 user: drh tags: trunk) | |
Changes
Changes to src/vacuum.c.
︙ | ︙ | |||
157 158 159 160 161 162 163 164 165 166 167 168 169 170 | u8 saved_mTrace; /* Saved trace settings */ Db *pDb = 0; /* Database to detach at end of vacuum */ int isMemDb; /* True if vacuuming a :memory: database */ int nRes; /* Bytes of reserved space at the end of each page */ int nDb; /* Number of attached databases */ const char *zDbMain; /* Schema name of database to vacuum */ const char *zOut; /* Name of output file */ if( !db->autoCommit ){ sqlite3SetString(pzErrMsg, db, "cannot VACUUM from within a transaction"); return SQLITE_ERROR; /* IMP: R-12218-18073 */ } if( db->nVdbeActive>1 ){ sqlite3SetString(pzErrMsg, db,"cannot VACUUM - SQL statements in progress"); | > | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | u8 saved_mTrace; /* Saved trace settings */ Db *pDb = 0; /* Database to detach at end of vacuum */ int isMemDb; /* True if vacuuming a :memory: database */ int nRes; /* Bytes of reserved space at the end of each page */ int nDb; /* Number of attached databases */ const char *zDbMain; /* Schema name of database to vacuum */ const char *zOut; /* Name of output file */ u32 pgflags = PAGER_SYNCHRONOUS_OFF; /* sync flags for output db */ if( !db->autoCommit ){ sqlite3SetString(pzErrMsg, db, "cannot VACUUM from within a transaction"); return SQLITE_ERROR; /* IMP: R-12218-18073 */ } if( db->nVdbeActive>1 ){ sqlite3SetString(pzErrMsg, db,"cannot VACUUM - SQL statements in progress"); |
︙ | ︙ | |||
228 229 230 231 232 233 234 235 236 237 238 239 | i64 sz = 0; if( id->pMethods!=0 && (sqlite3OsFileSize(id, &sz)!=SQLITE_OK || sz>0) ){ rc = SQLITE_ERROR; sqlite3SetString(pzErrMsg, db, "output file already exists"); goto end_of_vacuum; } db->mDbFlags |= DBFLAG_VacuumInto; } nRes = sqlite3BtreeGetRequestedReserve(pMain); sqlite3BtreeSetCacheSize(pTemp, db->aDb[iDb].pSchema->cache_size); sqlite3BtreeSetSpillSize(pTemp, sqlite3BtreeSetSpillSize(pMain,0)); | > > > > > | | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | i64 sz = 0; if( id->pMethods!=0 && (sqlite3OsFileSize(id, &sz)!=SQLITE_OK || sz>0) ){ rc = SQLITE_ERROR; sqlite3SetString(pzErrMsg, db, "output file already exists"); goto end_of_vacuum; } db->mDbFlags |= DBFLAG_VacuumInto; /* For a VACUUM INTO, the pager-flags are set to the same values as ** they are for the database being vacuumed, except that PAGER_CACHESPILL ** is always set. */ pgflags = db->aDb[iDb].safety_level | (db->flags & PAGER_FLAGS_MASK); } nRes = sqlite3BtreeGetRequestedReserve(pMain); sqlite3BtreeSetCacheSize(pTemp, db->aDb[iDb].pSchema->cache_size); sqlite3BtreeSetSpillSize(pTemp, sqlite3BtreeSetSpillSize(pMain,0)); sqlite3BtreeSetPagerFlags(pTemp, pgflags|PAGER_CACHESPILL); /* Begin a transaction and take an exclusive lock on the main database ** file. This is done before the sqlite3BtreeGetPageSize(pMain) call below, ** to ensure that we do not try to change the page-size on a WAL database. */ rc = execSql(db, pzErrMsg, "BEGIN"); if( rc!=SQLITE_OK ) goto end_of_vacuum; |
︙ | ︙ |
Changes to test/vacuum-into.test.
︙ | ︙ | |||
128 129 130 131 132 133 134 135 136 | sqlite3 db test.db2 db eval { PRAGMA page_size; PRAGMA integrity_check; } } {1024 ok} } finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | sqlite3 db test.db2 db eval { PRAGMA page_size; PRAGMA integrity_check; } } {1024 ok} } #------------------------------------------------------------------------- testvfs tvfs -default 1 tvfs filter xSync tvfs script xSyncCb proc xSyncCb {method file fileid flags} { incr ::sync($flags) } reset_db do_execsql_test vacuum-into-700 { CREATE TABLE t1(a, b); INSERT INTO t1 VALUES(1, 2); } foreach {tn pragma res} { 710 { PRAGMA synchronous = normal } {normal 2} 720 { PRAGMA synchronous = full } {normal 3} 730 { PRAGMA synchronous = off } {} 740 { PRAGMA synchronous = extra; } {normal 3} 750 { PRAGMA fullfsync = 1; PRAGMA synchronous = full; } {full|dataonly 1 full 2} } { forcedelete test.db2 array unset ::sync do_execsql_test vacuum-into-$tn.1 " $pragma ; VACUUM INTO 'test.db2' " do_test vacuum-into-$tn.2 { array get ::sync } $res } db close tvfs delete finish_test |