55-- processPieceDeletions, and nextProvingPeriod reverts while the queue is
66-- non-empty. See https://github.com/FilOzone/pdp/pull/297.
77--
8- -- This table is the work queue the drain watcher selects from. Rows are
9- -- candidates rather than confirmed work: the task's first action is an on-chain
10- -- queue read, and a row whose data set has an empty queue is simply dropped. So
11- -- the seed below can be indiscriminate and needs no chain access at migration
12- -- time.
8+ -- This table coordinates removal draining. Rows are candidates rather than
9+ -- confirmed work: the task's first action is an on-chain queue read, and a row
10+ -- whose data set has an empty queue is simply dropped. So the seed below can be
11+ -- indiscriminate and needs no chain access at migration time.
1312--
1413-- Two writers: this one-time seed, which picks up data sets already carrying a
1514-- removal queue at upgrade time (including any stuck by FilOzone/pdp#283), and
16- -- the DeletePiece intake path , which inserts a row alongside every
17- -- schedulePieceDeletions send from here on .
15+ -- proving-period code , which inserts a row when it observes confirmed delete
16+ -- intent that still needs explicit draining .
1817
1918CREATE TABLE IF NOT EXISTS pdpv0_deletion_drain (
2019 data_set BIGINT PRIMARY KEY REFERENCES pdp_data_sets(id) ON DELETE CASCADE ,
@@ -28,16 +27,7 @@ CREATE TABLE IF NOT EXISTS pdpv0_deletion_drain (
2827 -- drains must be sequential because each one re-reads the queue length.
2928 msg_hash TEXT DEFAULT NULL ,
3029
31- -- Bumped when a drain send fails, bounding retries so a permanently failing
32- -- data set cannot spin forever.
33- failures BIGINT NOT NULL DEFAULT 0 ,
34-
35- -- Set when the task claimed the row but could not act on it yet (for
36- -- example the challenge window has not closed). Keeps the watcher from
37- -- re-claiming and re-reading chain state on every tipset.
38- blocked_at TIMESTAMPTZ DEFAULT NULL ,
39-
40- created_at TIMESTAMPTZ NOT NULL DEFAULT TIMEZONE(' UTC' , NOW())
30+ created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
4131);
4232
4333COMMENT ON TABLE pdpv0_deletion_drain IS
@@ -48,7 +38,7 @@ CREATE INDEX IF NOT EXISTS idx_pdpv0_deletion_drain_pending
4838 ON pdpv0_deletion_drain (data_set)
4939 WHERE task_id IS NULL AND msg_hash IS NULL ;
5040
51- -- The confirmation watcher scans by in-flight message.
41+ -- Reorg rollback locates drain rows by in-flight message.
5242CREATE INDEX IF NOT EXISTS idx_pdpv0_deletion_drain_msg_hash
5343 ON pdpv0_deletion_drain (msg_hash)
5444 WHERE msg_hash IS NOT NULL ;
0 commit comments