Fossil SCM

Add the --compress-only option to the "fossil rebuild" command.

drh 2015-05-11 01:31 trunk
Commit 10e3d6570780b725b69d9f6ec06ae497ac86b279
2 files changed +1 +25 -19
--- src/allrepo.c
+++ src/allrepo.c
@@ -231,10 +231,11 @@
231231
collect_argument(&extra, "verbose","v");
232232
}else if( strncmp(zCmd, "rebuild", n)==0 ){
233233
zCmd = "rebuild";
234234
collect_argument(&extra, "cluster",0);
235235
collect_argument(&extra, "compress",0);
236
+ collect_argument(&extra, "compress-only",0);
236237
collect_argument(&extra, "noverify",0);
237238
collect_argument_value(&extra, "pagesize");
238239
collect_argument(&extra, "vacuum",0);
239240
collect_argument(&extra, "deanalyze",0);
240241
collect_argument(&extra, "analyze",0);
241242
--- 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 @@
522522
** Reconstruct the named repository database from the core
523523
** records. Run this command after updating the fossil
524524
** executable in a way that changes the database schema.
525525
**
526526
** 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
541542
**
542543
** See also: deconstruct, reconstruct
543544
*/
544545
void rebuild_database(void){
545546
int forceFlag;
@@ -557,10 +558,11 @@
557558
int showStats;
558559
int runReindex;
559560
int optNoIndex;
560561
int optIndex;
561562
int optIfNeeded;
563
+ int compressOnlyFlag;
562564
563565
omitVerify = find_option("noverify",0,0)!=0;
564566
forceFlag = find_option("force","f",0)!=0;
565567
randomizeFlag = find_option("randomize", 0, 0)!=0;
566568
doClustering = find_option("cluster", 0, 0)!=0;
@@ -571,10 +573,12 @@
571573
zPagesize = find_option("pagesize",0,1);
572574
showStats = find_option("stats",0,0)!=0;
573575
optIndex = find_option("index",0,0)!=0;
574576
optNoIndex = find_option("noindex",0,0)!=0;
575577
optIfNeeded = find_option("ifneeded",0,0)!=0;
578
+ compressOnlyFlag = find_option("compress-only",0,0)!=0;
579
+ if( compressOnlyFlag ) runCompress = runVacuum = 1;
576580
if( zPagesize ){
577581
newPagesize = atoi(zPagesize);
578582
if( newPagesize<512 || newPagesize>65536
579583
|| (newPagesize&(newPagesize-1))!=0
580584
){
@@ -590,11 +594,11 @@
590594
usage("?REPOSITORY-FILENAME?");
591595
}
592596
db_close(1);
593597
db_open_repository(g.zRepositoryName);
594598
}
595
- runReindex = search_index_exists();
599
+ runReindex = search_index_exists() && !compressOnlyFlag;
596600
if( optIndex ) runReindex = 1;
597601
if( optNoIndex ) runReindex = 0;
598602
if( optIfNeeded && fossil_strcmp(db_get("aux-schema",""),AUX_SCHEMA_MAX)==0 ){
599603
return;
600604
}
@@ -601,14 +605,16 @@
601605
602606
/* We should be done with options.. */
603607
verify_all_options();
604608
605609
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
+ }
610616
db_multi_exec(
611617
"REPLACE INTO config(name,value,mtime) VALUES('content-schema',%Q,now());"
612618
"REPLACE INTO config(name,value,mtime) VALUES('aux-schema',%Q,now());"
613619
"REPLACE INTO config(name,value,mtime) VALUES('rebuilt',%Q,now());",
614620
CONTENT_SCHEMA, AUX_SCHEMA_MAX, get_version()
615621
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button