Fossil SCM
Add the --compress-only option to the "fossil rebuild" command.
Commit
10e3d6570780b725b69d9f6ec06ae497ac86b279
Parent
26c283467ad02e3…
2 files changed
+1
+25
-19
+1
| --- src/allrepo.c | ||
| +++ src/allrepo.c | ||
| @@ -231,10 +231,11 @@ | ||
| 231 | 231 | collect_argument(&extra, "verbose","v"); |
| 232 | 232 | }else if( strncmp(zCmd, "rebuild", n)==0 ){ |
| 233 | 233 | zCmd = "rebuild"; |
| 234 | 234 | collect_argument(&extra, "cluster",0); |
| 235 | 235 | collect_argument(&extra, "compress",0); |
| 236 | + collect_argument(&extra, "compress-only",0); | |
| 236 | 237 | collect_argument(&extra, "noverify",0); |
| 237 | 238 | collect_argument_value(&extra, "pagesize"); |
| 238 | 239 | collect_argument(&extra, "vacuum",0); |
| 239 | 240 | collect_argument(&extra, "deanalyze",0); |
| 240 | 241 | collect_argument(&extra, "analyze",0); |
| 241 | 242 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -231,10 +231,11 @@ | |
| 231 | collect_argument(&extra, "verbose","v"); |
| 232 | }else if( strncmp(zCmd, "rebuild", n)==0 ){ |
| 233 | zCmd = "rebuild"; |
| 234 | collect_argument(&extra, "cluster",0); |
| 235 | collect_argument(&extra, "compress",0); |
| 236 | collect_argument(&extra, "noverify",0); |
| 237 | collect_argument_value(&extra, "pagesize"); |
| 238 | collect_argument(&extra, "vacuum",0); |
| 239 | collect_argument(&extra, "deanalyze",0); |
| 240 | collect_argument(&extra, "analyze",0); |
| 241 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -231,10 +231,11 @@ | |
| 231 | collect_argument(&extra, "verbose","v"); |
| 232 | }else if( strncmp(zCmd, "rebuild", n)==0 ){ |
| 233 | zCmd = "rebuild"; |
| 234 | collect_argument(&extra, "cluster",0); |
| 235 | collect_argument(&extra, "compress",0); |
| 236 | collect_argument(&extra, "compress-only",0); |
| 237 | collect_argument(&extra, "noverify",0); |
| 238 | collect_argument_value(&extra, "pagesize"); |
| 239 | collect_argument(&extra, "vacuum",0); |
| 240 | collect_argument(&extra, "deanalyze",0); |
| 241 | collect_argument(&extra, "analyze",0); |
| 242 |
+25
-19
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -522,24 +522,25 @@ | ||
| 522 | 522 | ** Reconstruct the named repository database from the core |
| 523 | 523 | ** records. Run this command after updating the fossil |
| 524 | 524 | ** executable in a way that changes the database schema. |
| 525 | 525 | ** |
| 526 | 526 | ** Options: |
| 527 | -** --analyze Run ANALYZE on the database after rebuilding | |
| 528 | -** --cluster Compute clusters for unclustered artifacts | |
| 529 | -** --compress Strive to make the database as small as possible | |
| 530 | -** --deanalyze Remove ANALYZE tables from the database | |
| 531 | -** --force Force the rebuild to complete even if errors are seen | |
| 532 | -** --ifneeded Only do the rebuild if it would change the schema version | |
| 533 | -** --index Always add in the full-text search index | |
| 534 | -** --noverify Skip the verification of changes to the BLOB table | |
| 535 | -** --noindex Always omit the full-text search index | |
| 536 | -** --pagesize N Set the database pagesize to N. (512..65536 and power of 2) | |
| 537 | -** --randomize Scan artifacts in a random order | |
| 538 | -** --stats Show artifact statistics after rebuilding | |
| 539 | -** --vacuum Run VACUUM on the database after rebuilding | |
| 540 | -** --wal Set Write-Ahead-Log journalling mode on the database | |
| 527 | +** --analyze Run ANALYZE on the database after rebuilding | |
| 528 | +** --cluster Compute clusters for unclustered artifacts | |
| 529 | +** --compress Strive to make the database as small as possible | |
| 530 | +** --compress-only Skip the rebuilding step. Do --compress only | |
| 531 | +** --deanalyze Remove ANALYZE tables from the database | |
| 532 | +** --force Force the rebuild to complete even if errors are seen | |
| 533 | +** --ifneeded Only do the rebuild if it would change the schema version | |
| 534 | +** --index Always add in the full-text search index | |
| 535 | +** --noverify Skip the verification of changes to the BLOB table | |
| 536 | +** --noindex Always omit the full-text search index | |
| 537 | +** --pagesize N Set the database pagesize to N. (512..65536 and power of 2) | |
| 538 | +** --randomize Scan artifacts in a random order | |
| 539 | +** --stats Show artifact statistics after rebuilding | |
| 540 | +** --vacuum Run VACUUM on the database after rebuilding | |
| 541 | +** --wal Set Write-Ahead-Log journalling mode on the database | |
| 541 | 542 | ** |
| 542 | 543 | ** See also: deconstruct, reconstruct |
| 543 | 544 | */ |
| 544 | 545 | void rebuild_database(void){ |
| 545 | 546 | int forceFlag; |
| @@ -557,10 +558,11 @@ | ||
| 557 | 558 | int showStats; |
| 558 | 559 | int runReindex; |
| 559 | 560 | int optNoIndex; |
| 560 | 561 | int optIndex; |
| 561 | 562 | int optIfNeeded; |
| 563 | + int compressOnlyFlag; | |
| 562 | 564 | |
| 563 | 565 | omitVerify = find_option("noverify",0,0)!=0; |
| 564 | 566 | forceFlag = find_option("force","f",0)!=0; |
| 565 | 567 | randomizeFlag = find_option("randomize", 0, 0)!=0; |
| 566 | 568 | doClustering = find_option("cluster", 0, 0)!=0; |
| @@ -571,10 +573,12 @@ | ||
| 571 | 573 | zPagesize = find_option("pagesize",0,1); |
| 572 | 574 | showStats = find_option("stats",0,0)!=0; |
| 573 | 575 | optIndex = find_option("index",0,0)!=0; |
| 574 | 576 | optNoIndex = find_option("noindex",0,0)!=0; |
| 575 | 577 | optIfNeeded = find_option("ifneeded",0,0)!=0; |
| 578 | + compressOnlyFlag = find_option("compress-only",0,0)!=0; | |
| 579 | + if( compressOnlyFlag ) runCompress = runVacuum = 1; | |
| 576 | 580 | if( zPagesize ){ |
| 577 | 581 | newPagesize = atoi(zPagesize); |
| 578 | 582 | if( newPagesize<512 || newPagesize>65536 |
| 579 | 583 | || (newPagesize&(newPagesize-1))!=0 |
| 580 | 584 | ){ |
| @@ -590,11 +594,11 @@ | ||
| 590 | 594 | usage("?REPOSITORY-FILENAME?"); |
| 591 | 595 | } |
| 592 | 596 | db_close(1); |
| 593 | 597 | db_open_repository(g.zRepositoryName); |
| 594 | 598 | } |
| 595 | - runReindex = search_index_exists(); | |
| 599 | + runReindex = search_index_exists() && !compressOnlyFlag; | |
| 596 | 600 | if( optIndex ) runReindex = 1; |
| 597 | 601 | if( optNoIndex ) runReindex = 0; |
| 598 | 602 | if( optIfNeeded && fossil_strcmp(db_get("aux-schema",""),AUX_SCHEMA_MAX)==0 ){ |
| 599 | 603 | return; |
| 600 | 604 | } |
| @@ -601,14 +605,16 @@ | ||
| 601 | 605 | |
| 602 | 606 | /* We should be done with options.. */ |
| 603 | 607 | verify_all_options(); |
| 604 | 608 | |
| 605 | 609 | db_begin_transaction(); |
| 606 | - search_drop_index(); | |
| 607 | - ttyOutput = 1; | |
| 608 | - errCnt = rebuild_db(randomizeFlag, 1, doClustering); | |
| 609 | - reconstruct_private_table(); | |
| 610 | + if( !compressOnlyFlag ){ | |
| 611 | + search_drop_index(); | |
| 612 | + ttyOutput = 1; | |
| 613 | + errCnt = rebuild_db(randomizeFlag, 1, doClustering); | |
| 614 | + reconstruct_private_table(); | |
| 615 | + } | |
| 610 | 616 | db_multi_exec( |
| 611 | 617 | "REPLACE INTO config(name,value,mtime) VALUES('content-schema',%Q,now());" |
| 612 | 618 | "REPLACE INTO config(name,value,mtime) VALUES('aux-schema',%Q,now());" |
| 613 | 619 | "REPLACE INTO config(name,value,mtime) VALUES('rebuilt',%Q,now());", |
| 614 | 620 | CONTENT_SCHEMA, AUX_SCHEMA_MAX, get_version() |
| 615 | 621 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -522,24 +522,25 @@ | |
| 522 | ** Reconstruct the named repository database from the core |
| 523 | ** records. Run this command after updating the fossil |
| 524 | ** executable in a way that changes the database schema. |
| 525 | ** |
| 526 | ** Options: |
| 527 | ** --analyze Run ANALYZE on the database after rebuilding |
| 528 | ** --cluster Compute clusters for unclustered artifacts |
| 529 | ** --compress Strive to make the database as small as possible |
| 530 | ** --deanalyze Remove ANALYZE tables from the database |
| 531 | ** --force Force the rebuild to complete even if errors are seen |
| 532 | ** --ifneeded Only do the rebuild if it would change the schema version |
| 533 | ** --index Always add in the full-text search index |
| 534 | ** --noverify Skip the verification of changes to the BLOB table |
| 535 | ** --noindex Always omit the full-text search index |
| 536 | ** --pagesize N Set the database pagesize to N. (512..65536 and power of 2) |
| 537 | ** --randomize Scan artifacts in a random order |
| 538 | ** --stats Show artifact statistics after rebuilding |
| 539 | ** --vacuum Run VACUUM on the database after rebuilding |
| 540 | ** --wal Set Write-Ahead-Log journalling mode on the database |
| 541 | ** |
| 542 | ** See also: deconstruct, reconstruct |
| 543 | */ |
| 544 | void rebuild_database(void){ |
| 545 | int forceFlag; |
| @@ -557,10 +558,11 @@ | |
| 557 | int showStats; |
| 558 | int runReindex; |
| 559 | int optNoIndex; |
| 560 | int optIndex; |
| 561 | int optIfNeeded; |
| 562 | |
| 563 | omitVerify = find_option("noverify",0,0)!=0; |
| 564 | forceFlag = find_option("force","f",0)!=0; |
| 565 | randomizeFlag = find_option("randomize", 0, 0)!=0; |
| 566 | doClustering = find_option("cluster", 0, 0)!=0; |
| @@ -571,10 +573,12 @@ | |
| 571 | zPagesize = find_option("pagesize",0,1); |
| 572 | showStats = find_option("stats",0,0)!=0; |
| 573 | optIndex = find_option("index",0,0)!=0; |
| 574 | optNoIndex = find_option("noindex",0,0)!=0; |
| 575 | optIfNeeded = find_option("ifneeded",0,0)!=0; |
| 576 | if( zPagesize ){ |
| 577 | newPagesize = atoi(zPagesize); |
| 578 | if( newPagesize<512 || newPagesize>65536 |
| 579 | || (newPagesize&(newPagesize-1))!=0 |
| 580 | ){ |
| @@ -590,11 +594,11 @@ | |
| 590 | usage("?REPOSITORY-FILENAME?"); |
| 591 | } |
| 592 | db_close(1); |
| 593 | db_open_repository(g.zRepositoryName); |
| 594 | } |
| 595 | runReindex = search_index_exists(); |
| 596 | if( optIndex ) runReindex = 1; |
| 597 | if( optNoIndex ) runReindex = 0; |
| 598 | if( optIfNeeded && fossil_strcmp(db_get("aux-schema",""),AUX_SCHEMA_MAX)==0 ){ |
| 599 | return; |
| 600 | } |
| @@ -601,14 +605,16 @@ | |
| 601 | |
| 602 | /* We should be done with options.. */ |
| 603 | verify_all_options(); |
| 604 | |
| 605 | db_begin_transaction(); |
| 606 | search_drop_index(); |
| 607 | ttyOutput = 1; |
| 608 | errCnt = rebuild_db(randomizeFlag, 1, doClustering); |
| 609 | reconstruct_private_table(); |
| 610 | db_multi_exec( |
| 611 | "REPLACE INTO config(name,value,mtime) VALUES('content-schema',%Q,now());" |
| 612 | "REPLACE INTO config(name,value,mtime) VALUES('aux-schema',%Q,now());" |
| 613 | "REPLACE INTO config(name,value,mtime) VALUES('rebuilt',%Q,now());", |
| 614 | CONTENT_SCHEMA, AUX_SCHEMA_MAX, get_version() |
| 615 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -522,24 +522,25 @@ | |
| 522 | ** Reconstruct the named repository database from the core |
| 523 | ** records. Run this command after updating the fossil |
| 524 | ** executable in a way that changes the database schema. |
| 525 | ** |
| 526 | ** Options: |
| 527 | ** --analyze Run ANALYZE on the database after rebuilding |
| 528 | ** --cluster Compute clusters for unclustered artifacts |
| 529 | ** --compress Strive to make the database as small as possible |
| 530 | ** --compress-only Skip the rebuilding step. Do --compress only |
| 531 | ** --deanalyze Remove ANALYZE tables from the database |
| 532 | ** --force Force the rebuild to complete even if errors are seen |
| 533 | ** --ifneeded Only do the rebuild if it would change the schema version |
| 534 | ** --index Always add in the full-text search index |
| 535 | ** --noverify Skip the verification of changes to the BLOB table |
| 536 | ** --noindex Always omit the full-text search index |
| 537 | ** --pagesize N Set the database pagesize to N. (512..65536 and power of 2) |
| 538 | ** --randomize Scan artifacts in a random order |
| 539 | ** --stats Show artifact statistics after rebuilding |
| 540 | ** --vacuum Run VACUUM on the database after rebuilding |
| 541 | ** --wal Set Write-Ahead-Log journalling mode on the database |
| 542 | ** |
| 543 | ** See also: deconstruct, reconstruct |
| 544 | */ |
| 545 | void rebuild_database(void){ |
| 546 | int forceFlag; |
| @@ -557,10 +558,11 @@ | |
| 558 | int showStats; |
| 559 | int runReindex; |
| 560 | int optNoIndex; |
| 561 | int optIndex; |
| 562 | int optIfNeeded; |
| 563 | int compressOnlyFlag; |
| 564 | |
| 565 | omitVerify = find_option("noverify",0,0)!=0; |
| 566 | forceFlag = find_option("force","f",0)!=0; |
| 567 | randomizeFlag = find_option("randomize", 0, 0)!=0; |
| 568 | doClustering = find_option("cluster", 0, 0)!=0; |
| @@ -571,10 +573,12 @@ | |
| 573 | zPagesize = find_option("pagesize",0,1); |
| 574 | showStats = find_option("stats",0,0)!=0; |
| 575 | optIndex = find_option("index",0,0)!=0; |
| 576 | optNoIndex = find_option("noindex",0,0)!=0; |
| 577 | optIfNeeded = find_option("ifneeded",0,0)!=0; |
| 578 | compressOnlyFlag = find_option("compress-only",0,0)!=0; |
| 579 | if( compressOnlyFlag ) runCompress = runVacuum = 1; |
| 580 | if( zPagesize ){ |
| 581 | newPagesize = atoi(zPagesize); |
| 582 | if( newPagesize<512 || newPagesize>65536 |
| 583 | || (newPagesize&(newPagesize-1))!=0 |
| 584 | ){ |
| @@ -590,11 +594,11 @@ | |
| 594 | usage("?REPOSITORY-FILENAME?"); |
| 595 | } |
| 596 | db_close(1); |
| 597 | db_open_repository(g.zRepositoryName); |
| 598 | } |
| 599 | runReindex = search_index_exists() && !compressOnlyFlag; |
| 600 | if( optIndex ) runReindex = 1; |
| 601 | if( optNoIndex ) runReindex = 0; |
| 602 | if( optIfNeeded && fossil_strcmp(db_get("aux-schema",""),AUX_SCHEMA_MAX)==0 ){ |
| 603 | return; |
| 604 | } |
| @@ -601,14 +605,16 @@ | |
| 605 | |
| 606 | /* We should be done with options.. */ |
| 607 | verify_all_options(); |
| 608 | |
| 609 | db_begin_transaction(); |
| 610 | if( !compressOnlyFlag ){ |
| 611 | search_drop_index(); |
| 612 | ttyOutput = 1; |
| 613 | errCnt = rebuild_db(randomizeFlag, 1, doClustering); |
| 614 | reconstruct_private_table(); |
| 615 | } |
| 616 | db_multi_exec( |
| 617 | "REPLACE INTO config(name,value,mtime) VALUES('content-schema',%Q,now());" |
| 618 | "REPLACE INTO config(name,value,mtime) VALUES('aux-schema',%Q,now());" |
| 619 | "REPLACE INTO config(name,value,mtime) VALUES('rebuilt',%Q,now());", |
| 620 | CONTENT_SCHEMA, AUX_SCHEMA_MAX, get_version() |
| 621 |