2023-02-23 13:04:25 +00:00
|
|
|
// verification_audits contains a queue of segments to verify.
|
2023-01-06 16:27:42 +00:00
|
|
|
model verification_audits (
|
|
|
|
key inserted_at stream_id position
|
|
|
|
|
2023-02-23 13:04:25 +00:00
|
|
|
// inserted_at when the segment was queued for verification.
|
2023-01-06 16:27:42 +00:00
|
|
|
field inserted_at timestamp ( default current_timestamp )
|
2023-02-23 13:04:25 +00:00
|
|
|
// stream_id refers to the metabase segments.stream_id.
|
2023-01-06 16:27:42 +00:00
|
|
|
field stream_id blob
|
2023-02-23 13:04:25 +00:00
|
|
|
// position refers to the metabase segments.position.
|
2023-01-06 16:27:42 +00:00
|
|
|
field position uint64
|
2023-02-23 13:04:25 +00:00
|
|
|
// expires_at is set to the segment's expiration timestamp, if there is one.
|
2023-01-06 16:27:42 +00:00
|
|
|
field expires_at timestamp (nullable)
|
2023-02-23 13:04:25 +00:00
|
|
|
// encrypted_size is the size of the segment pre-expansion.
|
2023-01-06 16:27:42 +00:00
|
|
|
field encrypted_size int
|
|
|
|
)
|
|
|
|
|
2023-02-23 13:04:25 +00:00
|
|
|
// reverification_audits copntains a queue of segments where verification failed due to a timeout.
|
2023-01-06 16:27:42 +00:00
|
|
|
model reverification_audits (
|
|
|
|
key node_id stream_id position
|
|
|
|
|
2023-02-23 13:04:25 +00:00
|
|
|
// node_id is the node that timed out on verification.
|
2023-01-06 16:27:42 +00:00
|
|
|
field node_id blob
|
2023-02-23 13:04:25 +00:00
|
|
|
// stream_id refers to the metabase segments.stream_id.
|
2023-01-06 16:27:42 +00:00
|
|
|
field stream_id blob
|
2023-02-23 13:04:25 +00:00
|
|
|
// position refers to the metabase segments.position.
|
2023-01-06 16:27:42 +00:00
|
|
|
field position uint64
|
2023-02-23 13:04:25 +00:00
|
|
|
// piece_num is the piece index that the storage node stores.
|
2023-01-06 16:27:42 +00:00
|
|
|
field piece_num int
|
2023-02-23 13:04:25 +00:00
|
|
|
// inserted_at is the time the reverification was queued.
|
2023-01-06 16:27:42 +00:00
|
|
|
field inserted_at timestamp ( default current_timestamp )
|
2023-02-23 13:04:25 +00:00
|
|
|
// last_attempt is the last time the reverification was attempted.
|
2023-01-06 16:27:42 +00:00
|
|
|
field last_attempt timestamp ( updatable, nullable )
|
2023-02-23 13:04:25 +00:00
|
|
|
// reverify_count is the number of times the reverification has been attempted, but failed.
|
2023-01-06 16:27:42 +00:00
|
|
|
field reverify_count int64 ( updatable, default 0 )
|
|
|
|
|
|
|
|
index ( fields inserted_at )
|
|
|
|
)
|
|
|
|
|
|
|
|
read first (
|
|
|
|
select reverification_audits
|
|
|
|
where reverification_audits.node_id = ?
|
|
|
|
orderby ( asc reverification_audits.stream_id, asc reverification_audits.position )
|
|
|
|
)
|
|
|
|
|
|
|
|
create reverification_audits ()
|
|
|
|
|
|
|
|
delete reverification_audits (
|
|
|
|
where reverification_audits.node_id = ?
|
|
|
|
where reverification_audits.stream_id = ?
|
|
|
|
where reverification_audits.position = ?
|
|
|
|
)
|
|
|
|
|
2023-02-23 13:04:25 +00:00
|
|
|
// segment_pending_audits contains list of segments that need to be audited.
|
|
|
|
// This table is deprecated, it was replaced by reverification_audits.
|
2023-01-06 16:27:42 +00:00
|
|
|
model segment_pending_audits (
|
|
|
|
key node_id
|
|
|
|
|
2023-02-23 13:04:25 +00:00
|
|
|
// node_id is the node that should be audited.
|
2023-01-06 16:27:42 +00:00
|
|
|
field node_id blob
|
2023-02-23 13:04:25 +00:00
|
|
|
// stream_id refers to the metabase segments.stream_id.
|
2023-01-06 16:27:42 +00:00
|
|
|
field stream_id blob
|
2023-02-23 13:04:25 +00:00
|
|
|
// position refers to the metabase segments.position.
|
2023-01-06 16:27:42 +00:00
|
|
|
field position uint64
|
2023-02-23 13:04:25 +00:00
|
|
|
// is the derived piece id that the storagenode is storing.
|
2023-01-06 16:27:42 +00:00
|
|
|
field piece_id blob
|
2023-02-23 13:04:25 +00:00
|
|
|
// stripe_index is the stripe we are trying to audit.
|
2023-01-06 16:27:42 +00:00
|
|
|
field stripe_index int64
|
2023-02-23 13:04:25 +00:00
|
|
|
// share_size is the size of the share.
|
2023-01-06 16:27:42 +00:00
|
|
|
field share_size int64
|
2023-02-23 13:04:25 +00:00
|
|
|
// expected_share_hash is the hash that we should get as the audit result.
|
2023-01-06 16:27:42 +00:00
|
|
|
field expected_share_hash blob
|
2023-02-23 13:04:25 +00:00
|
|
|
// reverify_count is the number of times the audit has been attempted.
|
2023-01-06 16:27:42 +00:00
|
|
|
field reverify_count int64 ( updatable )
|
|
|
|
)
|