Fossil SCM
Merge rebuild-wal-pagesize into trunk. Allows fossil rebuild --pagesize to work on WAL db's by temporarily switching to journal mode for the VACUUM step.
Commit
205060d4b2b23c668553d627661e0d3fbeed7b436cfba0286d465e849da7af39
Parent
2cfc398ed0776de…
1 file changed
+8
+8
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -785,10 +785,18 @@ | ||
| 785 | 785 | db_end_transaction(0); |
| 786 | 786 | if( runCompress ) fossil_print("\n"); |
| 787 | 787 | db_close(0); |
| 788 | 788 | db_open_repository(g.zRepositoryName); |
| 789 | 789 | if( newPagesize ){ |
| 790 | + /* VACUUM cannot change the page size of a database in WAL mode, | |
| 791 | + ** so leave WAL mode for the VACUUM and return to it afterwards. */ | |
| 792 | + char *zMode = db_text(0, "PRAGMA journal_mode"); | |
| 793 | + if( fossil_stricmp(zMode, "wal")==0 ){ | |
| 794 | + db_multi_exec("PRAGMA journal_mode=DELETE"); | |
| 795 | + activateWal = 1; | |
| 796 | + } | |
| 797 | + fossil_free(zMode); | |
| 790 | 798 | db_multi_exec("PRAGMA page_size=%d", newPagesize); |
| 791 | 799 | runVacuum = 1; |
| 792 | 800 | } |
| 793 | 801 | if( runDeanalyze ){ |
| 794 | 802 | db_multi_exec("DROP TABLE IF EXISTS sqlite_stat1;" |
| 795 | 803 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -785,10 +785,18 @@ | |
| 785 | db_end_transaction(0); |
| 786 | if( runCompress ) fossil_print("\n"); |
| 787 | db_close(0); |
| 788 | db_open_repository(g.zRepositoryName); |
| 789 | if( newPagesize ){ |
| 790 | db_multi_exec("PRAGMA page_size=%d", newPagesize); |
| 791 | runVacuum = 1; |
| 792 | } |
| 793 | if( runDeanalyze ){ |
| 794 | db_multi_exec("DROP TABLE IF EXISTS sqlite_stat1;" |
| 795 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -785,10 +785,18 @@ | |
| 785 | db_end_transaction(0); |
| 786 | if( runCompress ) fossil_print("\n"); |
| 787 | db_close(0); |
| 788 | db_open_repository(g.zRepositoryName); |
| 789 | if( newPagesize ){ |
| 790 | /* VACUUM cannot change the page size of a database in WAL mode, |
| 791 | ** so leave WAL mode for the VACUUM and return to it afterwards. */ |
| 792 | char *zMode = db_text(0, "PRAGMA journal_mode"); |
| 793 | if( fossil_stricmp(zMode, "wal")==0 ){ |
| 794 | db_multi_exec("PRAGMA journal_mode=DELETE"); |
| 795 | activateWal = 1; |
| 796 | } |
| 797 | fossil_free(zMode); |
| 798 | db_multi_exec("PRAGMA page_size=%d", newPagesize); |
| 799 | runVacuum = 1; |
| 800 | } |
| 801 | if( runDeanalyze ){ |
| 802 | db_multi_exec("DROP TABLE IF EXISTS sqlite_stat1;" |
| 803 |