Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Add the --randomize parameter to the rebuild command. Used for testing. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
ce1c1a2907e9aa10c0426a1a9bb148e4 |
| User & Date: | drh 2007-09-21 18:33:13.000 |
Context
|
2007-09-21
| ||
| 19:18 | Improvements to the control-file parser. Not recognizes the T-line for tags. ... (check-in: 3dc92fdb7f user: drh tags: trunk) | |
| 18:33 | Add the --randomize parameter to the rebuild command. Used for testing. ... (check-in: ce1c1a2907 user: drh tags: trunk) | |
| 02:41 | Work toward adding a tagging system. Code compiles but is incomplete and probably does not work. ... (check-in: 2bc0e2c565 user: drh tags: trunk) | |
Changes
Changes to src/construct.c.
| ︙ | ︙ | |||
152 153 154 155 156 157 158 |
/* Scan origin and insert all files found inside */
fileCnt = import_origin (zOrigin);
printf("imported: %d %s\n", fileCnt, fileCnt == 1 ?
"file" : "files");
/* Finalize the repository, rebuild the derived tables */
| | | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
/* Scan origin and insert all files found inside */
fileCnt = import_origin (zOrigin);
printf("imported: %d %s\n", fileCnt, fileCnt == 1 ?
"file" : "files");
/* Finalize the repository, rebuild the derived tables */
errCnt = rebuild_db(0);
if( errCnt ){
printf("%d %s. Rolling back changes.\n", errCnt, errCnt == 1 ?
"error" : "errors");
db_end_transaction(1);
}else{
db_end_transaction(0);
|
| ︙ | ︙ |
Changes to src/rebuild.c.
| ︙ | ︙ | |||
29 30 31 32 33 34 35 36 |
/*
** Core function to rebuild the infomration in the derived tables of a
** fossil repository from the blobs. This function is shared between
** 'rebuild_database' ('rebuild') and 'reconstruct_cmd'
** ('reconstruct'), both of which have to regenerate this information
** from scratch.
*/
| > > > > > < | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
/*
** Core function to rebuild the infomration in the derived tables of a
** fossil repository from the blobs. This function is shared between
** 'rebuild_database' ('rebuild') and 'reconstruct_cmd'
** ('reconstruct'), both of which have to regenerate this information
** from scratch.
**
** If the randomize parameter is true, then the BLOBs are deliberately
** extracted in a random order. This feature is used to test the
** ability of fossil to accept records in any order and still
** construct a sane repository.
*/
int rebuild_db(int randomize){
Stmt s;
int errCnt = 0;
char *zTable;
db_multi_exec(
"CREATE INDEX IF NOT EXISTS delta_i1 ON delta(srcid);"
);
|
| ︙ | ︙ | |||
54 55 56 57 58 59 60 |
}
db_multi_exec(zRepositorySchema2);
db_multi_exec("INSERT INTO unclustered SELECT rid FROM blob");
db_multi_exec(
"DELETE FROM config WHERE name IN ('remote-code', 'remote-maxid')"
);
| | > > > | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
}
db_multi_exec(zRepositorySchema2);
db_multi_exec("INSERT INTO unclustered SELECT rid FROM blob");
db_multi_exec(
"DELETE FROM config WHERE name IN ('remote-code', 'remote-maxid')"
);
db_prepare(&s,
"SELECT rid, size FROM blob %s",
randomize ? "ORDER BY random()" : ""
);
while( db_step(&s)==SQLITE_ROW ){
int rid = db_column_int(&s, 0);
int size = db_column_int(&s, 1);
if( size>=0 ){
Blob content;
content_get(rid, &content);
manifest_crosslink(rid, &content);
|
| ︙ | ︙ | |||
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
**
** Reconstruct the named repository database from the core
** records. Run this command after updating the fossil
** executable in a way that changes the database schema.
*/
void rebuild_database(void){
int forceFlag;
int errCnt;
forceFlag = find_option("force","f",0)!=0;
if( g.argc!=3 ){
usage("REPOSITORY-FILENAME");
}
db_open_repository(g.argv[2]);
db_begin_transaction();
| > > | | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
**
** Reconstruct the named repository database from the core
** records. Run this command after updating the fossil
** executable in a way that changes the database schema.
*/
void rebuild_database(void){
int forceFlag;
int randomizeFlag;
int errCnt;
forceFlag = find_option("force","f",0)!=0;
randomizeFlag = find_option("randomize", 0, 0)!=0;
if( g.argc!=3 ){
usage("REPOSITORY-FILENAME");
}
db_open_repository(g.argv[2]);
db_begin_transaction();
errCnt = rebuild_db(randomizeFlag);
if( errCnt && !forceFlag ){
printf("%d errors. Rolling back changes. Use --force to force a commit.\n",
errCnt);
db_end_transaction(1);
}else{
db_end_transaction(0);
}
}
|