2023-12-17 11:41:45 +00:00
|
|
|
-- NOTE: task_ids can be the same between different task types and between different sectors
|
|
|
|
-- e.g. SN-supraseal doing 128 sdr/TreeC/TreeR with the same task_id
|
|
|
|
|
|
|
|
create table sectors_sdr_pipeline (
|
|
|
|
sp_id bigint not null,
|
|
|
|
sector_number bigint not null,
|
|
|
|
|
|
|
|
-- at request time
|
2023-12-18 11:02:48 +00:00
|
|
|
create_time timestamp not null default current_timestamp,
|
2023-12-17 11:41:45 +00:00
|
|
|
reg_seal_proof int not null,
|
|
|
|
|
|
|
|
-- sdr
|
|
|
|
ticket_epoch bigint,
|
|
|
|
ticket_value bytea,
|
|
|
|
|
|
|
|
task_id_sdr bigint,
|
|
|
|
after_sdr bool not null default false,
|
|
|
|
|
|
|
|
-- tree D
|
2023-12-18 11:02:48 +00:00
|
|
|
tree_d_cid text, -- commd from treeD compute, should match comm_d_cid
|
2023-12-17 11:41:45 +00:00
|
|
|
|
|
|
|
task_id_tree_d bigint,
|
|
|
|
after_tree_d bool not null default false,
|
|
|
|
|
|
|
|
-- tree C
|
|
|
|
task_id_tree_c bigint,
|
|
|
|
after_tree_c bool not null default false,
|
|
|
|
|
|
|
|
-- tree R
|
|
|
|
tree_r_cid text, -- commr from treeR compute
|
|
|
|
|
|
|
|
task_id_tree_r bigint,
|
|
|
|
after_tree_r bool not null default false,
|
|
|
|
|
|
|
|
-- precommit message sending
|
|
|
|
precommit_msg_cid text,
|
|
|
|
|
|
|
|
task_id_precommit_msg bigint,
|
|
|
|
after_precommit_msg bool not null default false,
|
|
|
|
|
|
|
|
-- precommit message wait
|
|
|
|
seed_epoch bigint,
|
|
|
|
precommit_msg_tsk bytea,
|
|
|
|
after_precommit_msg_success bool not null default false,
|
|
|
|
|
|
|
|
-- seed
|
|
|
|
seed_value bytea,
|
|
|
|
|
|
|
|
-- Commit (PoRep snark)
|
|
|
|
task_id_porep bigint,
|
|
|
|
porep_proof bytea,
|
2024-01-11 21:39:42 +00:00
|
|
|
after_porep bool not null default false,
|
2023-12-17 11:41:45 +00:00
|
|
|
|
2024-01-30 11:43:57 +00:00
|
|
|
-- Finalize (trim cache)
|
|
|
|
task_id_finalize bigint,
|
|
|
|
after_finalize bool not null default false,
|
|
|
|
|
2024-01-30 19:05:47 +00:00
|
|
|
-- MoveStorage (move data to storage)
|
|
|
|
task_id_move_storage bigint,
|
|
|
|
after_move_storage bool not null default false,
|
|
|
|
|
2023-12-17 11:41:45 +00:00
|
|
|
-- Commit message sending
|
|
|
|
commit_msg_cid text,
|
|
|
|
|
|
|
|
task_id_commit_msg bigint,
|
|
|
|
after_commit_msg bool not null default false,
|
|
|
|
|
|
|
|
-- Commit message wait
|
|
|
|
commit_msg_tsk bytea,
|
|
|
|
after_commit_msg_success bool not null default false,
|
|
|
|
|
|
|
|
-- Failure handling
|
|
|
|
failed bool not null default false,
|
|
|
|
failed_at timestamp,
|
2023-12-19 11:39:25 +00:00
|
|
|
failed_reason varchar(20) not null default '',
|
|
|
|
failed_reason_msg text not null default '',
|
2023-12-17 11:41:45 +00:00
|
|
|
|
2024-02-08 20:24:48 +00:00
|
|
|
-- foreign key
|
|
|
|
-- note: those foreign keys are a part of the retry mechanism. If a task
|
|
|
|
-- fails due to retry limit, it will drop the assigned task_id, and the
|
|
|
|
-- poller will reassign the task to a new node if it deems the task is
|
|
|
|
-- still valid to be retried.
|
|
|
|
foreign key (task_id_sdr) references harmony_task (id) on delete set null,
|
|
|
|
foreign key (task_id_tree_d) references harmony_task (id) on delete set null,
|
|
|
|
foreign key (task_id_tree_c) references harmony_task (id) on delete set null,
|
|
|
|
foreign key (task_id_tree_r) references harmony_task (id) on delete set null,
|
|
|
|
foreign key (task_id_precommit_msg) references harmony_task (id) on delete set null,
|
|
|
|
foreign key (task_id_porep) references harmony_task (id) on delete set null,
|
|
|
|
foreign key (task_id_finalize) references harmony_task (id) on delete set null,
|
|
|
|
foreign key (task_id_move_storage) references harmony_task (id) on delete set null,
|
|
|
|
foreign key (task_id_commit_msg) references harmony_task (id) on delete set null,
|
|
|
|
|
2023-12-17 11:41:45 +00:00
|
|
|
-- constraints
|
|
|
|
primary key (sp_id, sector_number)
|
|
|
|
);
|
|
|
|
|
|
|
|
create table sectors_sdr_initial_pieces (
|
|
|
|
sp_id bigint not null,
|
|
|
|
sector_number bigint not null,
|
|
|
|
|
|
|
|
piece_index bigint not null,
|
|
|
|
piece_cid text not null,
|
2024-01-22 16:33:59 +00:00
|
|
|
piece_size bigint not null, -- padded size
|
2023-12-17 11:41:45 +00:00
|
|
|
|
2024-01-20 14:52:38 +00:00
|
|
|
-- data source
|
|
|
|
data_url text not null,
|
|
|
|
data_headers jsonb not null default '{}',
|
|
|
|
data_raw_size bigint not null,
|
|
|
|
data_delete_on_finalize bool not null,
|
|
|
|
|
|
|
|
-- deal info
|
|
|
|
f05_publish_cid text,
|
|
|
|
f05_deal_id bigint,
|
|
|
|
f05_deal_proposal jsonb,
|
|
|
|
f05_deal_start_epoch bigint,
|
|
|
|
f05_deal_end_epoch bigint,
|
|
|
|
|
2024-04-02 16:16:59 +00:00
|
|
|
-- ddo deal info
|
|
|
|
-- added in 20240402-sdr-pipeline-ddo-deal-info.sql
|
|
|
|
-- direct_start_epoch bigint,
|
|
|
|
-- direct_end_epoch bigint,
|
|
|
|
-- direct_piece_activation_manifest jsonb,
|
|
|
|
|
2023-12-18 22:48:49 +00:00
|
|
|
-- foreign key
|
|
|
|
foreign key (sp_id, sector_number) references sectors_sdr_pipeline (sp_id, sector_number) on delete cascade,
|
|
|
|
|
2023-12-17 11:41:45 +00:00
|
|
|
primary key (sp_id, sector_number, piece_index)
|
|
|
|
);
|
2023-12-18 11:02:48 +00:00
|
|
|
|
2024-01-22 16:33:59 +00:00
|
|
|
comment on column sectors_sdr_initial_pieces.piece_size is 'padded size of the piece';
|
|
|
|
|
2023-12-18 11:02:48 +00:00
|
|
|
create table sectors_allocated_numbers (
|
|
|
|
sp_id bigint not null primary key,
|
|
|
|
allocated jsonb not null
|
|
|
|
);
|