Fossil SCM
Improvement to the way auxiliary tables are initially dropped on a rebuild.
Commit
a31944e628d0f5365dd1a0b014ee3be8ac03b949
Parent
ccdafa2a93e7bce…
1 file changed
+19
-16
+19
-16
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -330,37 +330,40 @@ | ||
| 330 | 330 | ** extracted in a random order. This feature is used to test the |
| 331 | 331 | ** ability of fossil to accept records in any order and still |
| 332 | 332 | ** construct a sane repository. |
| 333 | 333 | */ |
| 334 | 334 | int rebuild_db(int randomize, int doOut, int doClustering){ |
| 335 | - Stmt s; | |
| 335 | + Stmt s, q; | |
| 336 | 336 | int errCnt = 0; |
| 337 | 337 | char *zTable; |
| 338 | 338 | int incrSize; |
| 339 | + Blob sql; | |
| 339 | 340 | |
| 340 | 341 | bag_init(&bagDone); |
| 341 | 342 | ttyOutput = doOut; |
| 342 | 343 | processCnt = 0; |
| 343 | 344 | if (ttyOutput && !g.fQuiet) { |
| 344 | 345 | percent_complete(0); |
| 345 | 346 | } |
| 346 | 347 | rebuild_update_schema(); |
| 347 | - for(;;){ | |
| 348 | - zTable = db_text(0, | |
| 349 | - "SELECT name FROM sqlite_master /*scan*/" | |
| 350 | - " WHERE type='table'" | |
| 351 | - " AND name NOT IN ('admin_log', 'blob','delta','rcvfrom','user'," | |
| 352 | - "'config','shun','private','reportfmt'," | |
| 353 | - "'concealed','accesslog','modreq'," | |
| 354 | - "'purgeevent','purgeitem','unversioned')" | |
| 355 | - " AND name NOT GLOB 'sqlite_*'" | |
| 356 | - " AND name NOT GLOB 'fx_*'" | |
| 357 | - ); | |
| 358 | - if( zTable==0 ) break; | |
| 359 | - db_multi_exec("DROP TABLE %Q", zTable); | |
| 360 | - free(zTable); | |
| 361 | - } | |
| 348 | + blob_init(&sql, 0, 0); | |
| 349 | + db_prepare(&q, | |
| 350 | + "SELECT name FROM sqlite_master /*scan*/" | |
| 351 | + " WHERE type='table'" | |
| 352 | + " AND name NOT IN ('admin_log', 'blob','delta','rcvfrom','user','hname'," | |
| 353 | + "'config','shun','private','reportfmt'," | |
| 354 | + "'concealed','accesslog','modreq'," | |
| 355 | + "'purgeevent','purgeitem','unversioned')" | |
| 356 | + " AND name NOT GLOB 'sqlite_*'" | |
| 357 | + " AND name NOT GLOB 'fx_*'" | |
| 358 | + ); | |
| 359 | + while( db_step(&q)==SQLITE_ROW ){ | |
| 360 | + blob_appendf(&sql, "DROP TABLE \"%w\";\n", db_column_text(&q,0)); | |
| 361 | + } | |
| 362 | + db_finalize(&q); | |
| 363 | + db_multi_exec("%s", blob_str(&sql)/*safe-for-%s*/); | |
| 364 | + blob_reset(&sql); | |
| 362 | 365 | db_multi_exec("%s", zRepositorySchema2/*safe-for-%s*/); |
| 363 | 366 | ticket_create_table(0); |
| 364 | 367 | shun_artifacts(); |
| 365 | 368 | |
| 366 | 369 | db_multi_exec( |
| 367 | 370 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -330,37 +330,40 @@ | |
| 330 | ** extracted in a random order. This feature is used to test the |
| 331 | ** ability of fossil to accept records in any order and still |
| 332 | ** construct a sane repository. |
| 333 | */ |
| 334 | int rebuild_db(int randomize, int doOut, int doClustering){ |
| 335 | Stmt s; |
| 336 | int errCnt = 0; |
| 337 | char *zTable; |
| 338 | int incrSize; |
| 339 | |
| 340 | bag_init(&bagDone); |
| 341 | ttyOutput = doOut; |
| 342 | processCnt = 0; |
| 343 | if (ttyOutput && !g.fQuiet) { |
| 344 | percent_complete(0); |
| 345 | } |
| 346 | rebuild_update_schema(); |
| 347 | for(;;){ |
| 348 | zTable = db_text(0, |
| 349 | "SELECT name FROM sqlite_master /*scan*/" |
| 350 | " WHERE type='table'" |
| 351 | " AND name NOT IN ('admin_log', 'blob','delta','rcvfrom','user'," |
| 352 | "'config','shun','private','reportfmt'," |
| 353 | "'concealed','accesslog','modreq'," |
| 354 | "'purgeevent','purgeitem','unversioned')" |
| 355 | " AND name NOT GLOB 'sqlite_*'" |
| 356 | " AND name NOT GLOB 'fx_*'" |
| 357 | ); |
| 358 | if( zTable==0 ) break; |
| 359 | db_multi_exec("DROP TABLE %Q", zTable); |
| 360 | free(zTable); |
| 361 | } |
| 362 | db_multi_exec("%s", zRepositorySchema2/*safe-for-%s*/); |
| 363 | ticket_create_table(0); |
| 364 | shun_artifacts(); |
| 365 | |
| 366 | db_multi_exec( |
| 367 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -330,37 +330,40 @@ | |
| 330 | ** extracted in a random order. This feature is used to test the |
| 331 | ** ability of fossil to accept records in any order and still |
| 332 | ** construct a sane repository. |
| 333 | */ |
| 334 | int rebuild_db(int randomize, int doOut, int doClustering){ |
| 335 | Stmt s, q; |
| 336 | int errCnt = 0; |
| 337 | char *zTable; |
| 338 | int incrSize; |
| 339 | Blob sql; |
| 340 | |
| 341 | bag_init(&bagDone); |
| 342 | ttyOutput = doOut; |
| 343 | processCnt = 0; |
| 344 | if (ttyOutput && !g.fQuiet) { |
| 345 | percent_complete(0); |
| 346 | } |
| 347 | rebuild_update_schema(); |
| 348 | blob_init(&sql, 0, 0); |
| 349 | db_prepare(&q, |
| 350 | "SELECT name FROM sqlite_master /*scan*/" |
| 351 | " WHERE type='table'" |
| 352 | " AND name NOT IN ('admin_log', 'blob','delta','rcvfrom','user','hname'," |
| 353 | "'config','shun','private','reportfmt'," |
| 354 | "'concealed','accesslog','modreq'," |
| 355 | "'purgeevent','purgeitem','unversioned')" |
| 356 | " AND name NOT GLOB 'sqlite_*'" |
| 357 | " AND name NOT GLOB 'fx_*'" |
| 358 | ); |
| 359 | while( db_step(&q)==SQLITE_ROW ){ |
| 360 | blob_appendf(&sql, "DROP TABLE \"%w\";\n", db_column_text(&q,0)); |
| 361 | } |
| 362 | db_finalize(&q); |
| 363 | db_multi_exec("%s", blob_str(&sql)/*safe-for-%s*/); |
| 364 | blob_reset(&sql); |
| 365 | db_multi_exec("%s", zRepositorySchema2/*safe-for-%s*/); |
| 366 | ticket_create_table(0); |
| 367 | shun_artifacts(); |
| 368 | |
| 369 | db_multi_exec( |
| 370 |