Fossil SCM

Do not build clusters on a "rebuild" command unless the --cluster command-line option is used. But do build clusters on an "import" or a "reconstruct".

drh 2011-01-17 16:14 trunk
Commit afc4bf41fa54d8038786b39001be2d68faed832c
+1 -1
--- src/clone.c
+++ src/clone.c
@@ -107,11 +107,11 @@
107107
}
108108
db_open_repository(g.argv[3]);
109109
}
110110
db_begin_transaction();
111111
printf("Rebuilding repository meta-data...\n");
112
- rebuild_db(0, 1);
112
+ rebuild_db(0, 1, 0);
113113
printf("project-id: %s\n", db_get("project-code", 0));
114114
printf("server-id: %s\n", db_get("server-code", 0));
115115
zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
116116
printf("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword);
117117
db_end_transaction(0);
118118
--- src/clone.c
+++ src/clone.c
@@ -107,11 +107,11 @@
107 }
108 db_open_repository(g.argv[3]);
109 }
110 db_begin_transaction();
111 printf("Rebuilding repository meta-data...\n");
112 rebuild_db(0, 1);
113 printf("project-id: %s\n", db_get("project-code", 0));
114 printf("server-id: %s\n", db_get("server-code", 0));
115 zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
116 printf("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword);
117 db_end_transaction(0);
118
--- src/clone.c
+++ src/clone.c
@@ -107,11 +107,11 @@
107 }
108 db_open_repository(g.argv[3]);
109 }
110 db_begin_transaction();
111 printf("Rebuilding repository meta-data...\n");
112 rebuild_db(0, 1, 0);
113 printf("project-id: %s\n", db_get("project-code", 0));
114 printf("server-id: %s\n", db_get("server-code", 0));
115 zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
116 printf("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword);
117 db_end_transaction(0);
118
+1 -1
--- src/import.c
+++ src/import.c
@@ -657,11 +657,11 @@
657657
db_initial_setup(0, 0, 1);
658658
git_fast_import(pIn);
659659
db_end_transaction(0);
660660
db_begin_transaction();
661661
printf("Rebuilding repository meta-data...\n");
662
- rebuild_db(0, 1);
662
+ rebuild_db(0, 1, 1);
663663
verify_cancel();
664664
db_end_transaction(0);
665665
printf("Vacuuming..."); fflush(stdout);
666666
db_multi_exec("VACUUM");
667667
printf(" ok\n");
668668
--- src/import.c
+++ src/import.c
@@ -657,11 +657,11 @@
657 db_initial_setup(0, 0, 1);
658 git_fast_import(pIn);
659 db_end_transaction(0);
660 db_begin_transaction();
661 printf("Rebuilding repository meta-data...\n");
662 rebuild_db(0, 1);
663 verify_cancel();
664 db_end_transaction(0);
665 printf("Vacuuming..."); fflush(stdout);
666 db_multi_exec("VACUUM");
667 printf(" ok\n");
668
--- src/import.c
+++ src/import.c
@@ -657,11 +657,11 @@
657 db_initial_setup(0, 0, 1);
658 git_fast_import(pIn);
659 db_end_transaction(0);
660 db_begin_transaction();
661 printf("Rebuilding repository meta-data...\n");
662 rebuild_db(0, 1, 1);
663 verify_cancel();
664 db_end_transaction(0);
665 printf("Vacuuming..."); fflush(stdout);
666 db_multi_exec("VACUUM");
667 printf(" ok\n");
668
+14 -5
--- src/rebuild.c
+++ src/rebuild.c
@@ -243,11 +243,11 @@
243243
** If the randomize parameter is true, then the BLOBs are deliberately
244244
** extracted in a random order. This feature is used to test the
245245
** ability of fossil to accept records in any order and still
246246
** construct a sane repository.
247247
*/
248
-int rebuild_db(int randomize, int doOut){
248
+int rebuild_db(int randomize, int doOut, int doClustering){
249249
Stmt s;
250250
int errCnt = 0;
251251
char *zTable;
252252
int incrSize;
253253
@@ -328,11 +328,11 @@
328328
rebuild_tag_trunk();
329329
if( !g.fQuiet && totalSize>0 ){
330330
processCnt += incrSize;
331331
percent_complete((processCnt*1000)/totalSize);
332332
}
333
- create_cluster();
333
+ if( doClustering ) create_cluster();
334334
if( !g.fQuiet && totalSize>0 ){
335335
processCnt += incrSize;
336336
percent_complete((processCnt*1000)/totalSize);
337337
}
338338
if(!g.fQuiet && ttyOutput ){
@@ -347,20 +347,29 @@
347347
** Usage: %fossil rebuild ?REPOSITORY?
348348
**
349349
** Reconstruct the named repository database from the core
350350
** records. Run this command after updating the fossil
351351
** executable in a way that changes the database schema.
352
+**
353
+** Options:
354
+**
355
+** --noverify Skip the verification of changes to the BLOB table
356
+** --force Force the rebuild to complete even if errors are seen
357
+** --randomize Scan artifacts in a random order
358
+** --cluster Compute clusters for unclustered artifacts
352359
*/
353360
void rebuild_database(void){
354361
int forceFlag;
355362
int randomizeFlag;
356363
int errCnt;
357364
int omitVerify;
365
+ int doClustering;
358366
359367
omitVerify = find_option("noverify",0,0)!=0;
360368
forceFlag = find_option("force","f",0)!=0;
361369
randomizeFlag = find_option("randomize", 0, 0)!=0;
370
+ doClustering = find_option("cluster", 0, 0)!=0;
362371
if( g.argc==3 ){
363372
db_open_repository(g.argv[2]);
364373
}else{
365374
db_find_and_open_repository(OPEN_ANY_SCHEMA, 0);
366375
if( g.argc!=2 ){
@@ -369,11 +378,11 @@
369378
db_close(1);
370379
db_open_repository(g.zRepositoryName);
371380
}
372381
db_begin_transaction();
373382
ttyOutput = 1;
374
- errCnt = rebuild_db(randomizeFlag, 1);
383
+ errCnt = rebuild_db(randomizeFlag, 1, doClustering);
375384
db_multi_exec(
376385
"REPLACE INTO config(name,value) VALUES('content-schema','%s');"
377386
"REPLACE INTO config(name,value) VALUES('aux-schema','%s');",
378387
CONTENT_SCHEMA, AUX_SCHEMA
379388
);
@@ -552,11 +561,11 @@
552561
}
553562
if( !bNeedRebuild ){
554563
db_end_transaction(0);
555564
db_multi_exec("VACUUM;");
556565
}else{
557
- rebuild_db(0, 1);
566
+ rebuild_db(0, 1, 0);
558567
db_end_transaction(0);
559568
}
560569
}
561570
562571
/*
@@ -629,11 +638,11 @@
629638
630639
printf("Reading files from directory \"%s\"...\n", g.argv[3]);
631640
recon_read_dir(g.argv[3]);
632641
printf("\nBuilding the Fossil repository...\n");
633642
634
- rebuild_db(0, 1);
643
+ rebuild_db(0, 1, 1);
635644
636645
/* Reconstruct the private table. The private table contains the rid
637646
** of every manifest that is tagged with "private" and every file that
638647
** is not used by a manifest that is not private.
639648
*/
640649
--- src/rebuild.c
+++ src/rebuild.c
@@ -243,11 +243,11 @@
243 ** If the randomize parameter is true, then the BLOBs are deliberately
244 ** extracted in a random order. This feature is used to test the
245 ** ability of fossil to accept records in any order and still
246 ** construct a sane repository.
247 */
248 int rebuild_db(int randomize, int doOut){
249 Stmt s;
250 int errCnt = 0;
251 char *zTable;
252 int incrSize;
253
@@ -328,11 +328,11 @@
328 rebuild_tag_trunk();
329 if( !g.fQuiet && totalSize>0 ){
330 processCnt += incrSize;
331 percent_complete((processCnt*1000)/totalSize);
332 }
333 create_cluster();
334 if( !g.fQuiet && totalSize>0 ){
335 processCnt += incrSize;
336 percent_complete((processCnt*1000)/totalSize);
337 }
338 if(!g.fQuiet && ttyOutput ){
@@ -347,20 +347,29 @@
347 ** Usage: %fossil rebuild ?REPOSITORY?
348 **
349 ** Reconstruct the named repository database from the core
350 ** records. Run this command after updating the fossil
351 ** executable in a way that changes the database schema.
 
 
 
 
 
 
 
352 */
353 void rebuild_database(void){
354 int forceFlag;
355 int randomizeFlag;
356 int errCnt;
357 int omitVerify;
 
358
359 omitVerify = find_option("noverify",0,0)!=0;
360 forceFlag = find_option("force","f",0)!=0;
361 randomizeFlag = find_option("randomize", 0, 0)!=0;
 
362 if( g.argc==3 ){
363 db_open_repository(g.argv[2]);
364 }else{
365 db_find_and_open_repository(OPEN_ANY_SCHEMA, 0);
366 if( g.argc!=2 ){
@@ -369,11 +378,11 @@
369 db_close(1);
370 db_open_repository(g.zRepositoryName);
371 }
372 db_begin_transaction();
373 ttyOutput = 1;
374 errCnt = rebuild_db(randomizeFlag, 1);
375 db_multi_exec(
376 "REPLACE INTO config(name,value) VALUES('content-schema','%s');"
377 "REPLACE INTO config(name,value) VALUES('aux-schema','%s');",
378 CONTENT_SCHEMA, AUX_SCHEMA
379 );
@@ -552,11 +561,11 @@
552 }
553 if( !bNeedRebuild ){
554 db_end_transaction(0);
555 db_multi_exec("VACUUM;");
556 }else{
557 rebuild_db(0, 1);
558 db_end_transaction(0);
559 }
560 }
561
562 /*
@@ -629,11 +638,11 @@
629
630 printf("Reading files from directory \"%s\"...\n", g.argv[3]);
631 recon_read_dir(g.argv[3]);
632 printf("\nBuilding the Fossil repository...\n");
633
634 rebuild_db(0, 1);
635
636 /* Reconstruct the private table. The private table contains the rid
637 ** of every manifest that is tagged with "private" and every file that
638 ** is not used by a manifest that is not private.
639 */
640
--- src/rebuild.c
+++ src/rebuild.c
@@ -243,11 +243,11 @@
243 ** If the randomize parameter is true, then the BLOBs are deliberately
244 ** extracted in a random order. This feature is used to test the
245 ** ability of fossil to accept records in any order and still
246 ** construct a sane repository.
247 */
248 int rebuild_db(int randomize, int doOut, int doClustering){
249 Stmt s;
250 int errCnt = 0;
251 char *zTable;
252 int incrSize;
253
@@ -328,11 +328,11 @@
328 rebuild_tag_trunk();
329 if( !g.fQuiet && totalSize>0 ){
330 processCnt += incrSize;
331 percent_complete((processCnt*1000)/totalSize);
332 }
333 if( doClustering ) create_cluster();
334 if( !g.fQuiet && totalSize>0 ){
335 processCnt += incrSize;
336 percent_complete((processCnt*1000)/totalSize);
337 }
338 if(!g.fQuiet && ttyOutput ){
@@ -347,20 +347,29 @@
347 ** Usage: %fossil rebuild ?REPOSITORY?
348 **
349 ** Reconstruct the named repository database from the core
350 ** records. Run this command after updating the fossil
351 ** executable in a way that changes the database schema.
352 **
353 ** Options:
354 **
355 ** --noverify Skip the verification of changes to the BLOB table
356 ** --force Force the rebuild to complete even if errors are seen
357 ** --randomize Scan artifacts in a random order
358 ** --cluster Compute clusters for unclustered artifacts
359 */
360 void rebuild_database(void){
361 int forceFlag;
362 int randomizeFlag;
363 int errCnt;
364 int omitVerify;
365 int doClustering;
366
367 omitVerify = find_option("noverify",0,0)!=0;
368 forceFlag = find_option("force","f",0)!=0;
369 randomizeFlag = find_option("randomize", 0, 0)!=0;
370 doClustering = find_option("cluster", 0, 0)!=0;
371 if( g.argc==3 ){
372 db_open_repository(g.argv[2]);
373 }else{
374 db_find_and_open_repository(OPEN_ANY_SCHEMA, 0);
375 if( g.argc!=2 ){
@@ -369,11 +378,11 @@
378 db_close(1);
379 db_open_repository(g.zRepositoryName);
380 }
381 db_begin_transaction();
382 ttyOutput = 1;
383 errCnt = rebuild_db(randomizeFlag, 1, doClustering);
384 db_multi_exec(
385 "REPLACE INTO config(name,value) VALUES('content-schema','%s');"
386 "REPLACE INTO config(name,value) VALUES('aux-schema','%s');",
387 CONTENT_SCHEMA, AUX_SCHEMA
388 );
@@ -552,11 +561,11 @@
561 }
562 if( !bNeedRebuild ){
563 db_end_transaction(0);
564 db_multi_exec("VACUUM;");
565 }else{
566 rebuild_db(0, 1, 0);
567 db_end_transaction(0);
568 }
569 }
570
571 /*
@@ -629,11 +638,11 @@
638
639 printf("Reading files from directory \"%s\"...\n", g.argv[3]);
640 recon_read_dir(g.argv[3]);
641 printf("\nBuilding the Fossil repository...\n");
642
643 rebuild_db(0, 1, 1);
644
645 /* Reconstruct the private table. The private table contains the rid
646 ** of every manifest that is tagged with "private" and every file that
647 ** is not used by a manifest that is not private.
648 */
649
+1 -1
--- src/shun.c
+++ src/shun.c
@@ -51,11 +51,11 @@
5151
}
5252
if( P("rebuild") ){
5353
db_close(1);
5454
db_open_repository(g.zRepositoryName);
5555
db_begin_transaction();
56
- rebuild_db(0,0);
56
+ rebuild_db(0, 0, 0);
5757
db_end_transaction(0);
5858
}
5959
if( zUuid ){
6060
nUuid = strlen(zUuid);
6161
if( nUuid!=40 || !validate16(zUuid, nUuid) ){
6262
--- src/shun.c
+++ src/shun.c
@@ -51,11 +51,11 @@
51 }
52 if( P("rebuild") ){
53 db_close(1);
54 db_open_repository(g.zRepositoryName);
55 db_begin_transaction();
56 rebuild_db(0,0);
57 db_end_transaction(0);
58 }
59 if( zUuid ){
60 nUuid = strlen(zUuid);
61 if( nUuid!=40 || !validate16(zUuid, nUuid) ){
62
--- src/shun.c
+++ src/shun.c
@@ -51,11 +51,11 @@
51 }
52 if( P("rebuild") ){
53 db_close(1);
54 db_open_repository(g.zRepositoryName);
55 db_begin_transaction();
56 rebuild_db(0, 0, 0);
57 db_end_transaction(0);
58 }
59 if( zUuid ){
60 nUuid = strlen(zUuid);
61 if( nUuid!=40 || !validate16(zUuid, nUuid) ){
62

Keyboard Shortcuts

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