worker: set monitor_has_run flag at initialization
[MogileFS-Server.git] / doc / fsck-notes.txt
blobc82b2d80a672033c39cdb39ffa91e37b75128df4
1 What replicate task uses:  all new files go with "nexttry" 0, rather than relying on "devcount".
3 CREATE TABLE needs_replicate (
4    fid        INT UNSIGNED NOT NULL PRIMARY KEY,
5    nexttry    INT UNSIGNED NOT NULL,
6    INDEX (nexttry),
7    fromdevid  INT UNSIGNED,             /* NULL means no preference */
8    failcount  TINYINT UNSIGNED
9    flags?                               /* one bit means corrupt, choose source where two files are the same md5?  reserved for future use. */
12 server_settings:
13     'fsck_enable'   {off,locations,quick,full}   location=file_on only, quick=file_on + HEAD requests, full=contents
14     'fsck_highest_fid_checked'  = <fidnumber>
16 update server_settings SET val=foo WHERE key='highest_fid_inserted' and val < foo;
18 CREATE TABLE fsck (
19    fid        INT UNSIGNED NOT NULL PRIMARY KEY,
20    nextcheck  INT UNSIGNED NOT NULL,
21    INDEX (nextcheck),
24 # todo:  replicate_now command to make all needs_replicate files nexttry=0;
25 # todo:  fsck, if no copies, still puts in needs_replicate but with high nexttry time and of course no fromdevid.
27 # how often do recheck files?  --never, only when they kick it off.
28 # todo:  replication policy saying "not quite happy" goes into "needs_replicate" table for to-be-fixed-later
29 # todo: stat command to get count of rows in needs_replicate  (!repl replacement)
31 # provide command to drop fsck table to force global re-indexing
32 # interface from fsck job to replicate job.  or do it ourselves sharing code.  (probably sharing code)
33 # perhaps command-line version is just running:
34 #    mogilefsd --run-only-job=fsck --foreground --verbose
37 while (1) {
39     # create table if not exist.  (the fsck table)
41     # while (find files to check from fsck table),
42     #     randomize
43     #     check them, inserting into needs_replicate or updating nextcheck time, or deleting if okay.
45     # once no more files to check....
47     # find files that are so new they don't have records in fsck
48     while (max(file) > max(server_settings.fsck._highestfidcheck) && fsck enabled) {
49         insert into fsck select fid, ? ? ? ?  from file where fid > max(fsck) order by fid limit 500
50     }