Diff
Not logged in

Differences From:

File src/rebuild.c part of check-in [ce1c1a2907] - Add the --randomize parameter to the rebuild command. Used for testing. by drh on 2007-09-21 18:33:13. [view]

To:

File src/rebuild.c part of check-in [70d5cc86b7] - Add the shun table. Do not process artifacts named in the shun table. by drh on 2007-10-05 13:47:00. [view]

@@ -45,14 +45,15 @@
   char *zTable;
 
   db_multi_exec(
     "CREATE INDEX IF NOT EXISTS delta_i1 ON delta(srcid);"
+    "CREATE TABLE IF NOT EXISTS shun(uuid UNIQUE);"
   );
   for(;;){
     zTable = db_text(0,
        "SELECT name FROM sqlite_master"
        " WHERE type='table'"
-       " AND name NOT IN ('blob','delta','rcvfrom','user','config')");
+       " AND name NOT IN ('blob','delta','rcvfrom','user','config','shun')");
     if( zTable==0 ) break;
     db_multi_exec("DROP TABLE %Q", zTable);
     free(zTable);
   }
@@ -59,12 +60,17 @@
   db_multi_exec(zRepositorySchema2);
 
   db_multi_exec("INSERT INTO unclustered SELECT rid FROM blob");
   db_multi_exec(
+     "DELETE FROM unclustered"
+     " WHERE rid IN (SELECT rid FROM shun JOIN blob USING(uuid))"
+  );
+  db_multi_exec(
     "DELETE FROM config WHERE name IN ('remote-code', 'remote-maxid')"
   );
   db_prepare(&s,
-     "SELECT rid, size FROM blob %s",
+     "SELECT rid, size FROM blob %s"
+     " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid)",
      randomize ? "ORDER BY random()" : ""
   );
   while( db_step(&s)==SQLITE_ROW ){
     int rid = db_column_int(&s, 0);