2023-02-23 15:03:55 +00:00
|
|
|
// graceful_exit_progress contains stats for a storagenode exit progress.
|
2023-01-06 16:27:42 +00:00
|
|
|
model graceful_exit_progress (
|
|
|
|
table graceful_exit_progress
|
|
|
|
key node_id
|
|
|
|
|
2023-02-23 15:03:55 +00:00
|
|
|
// node_id is the storagenode storj.NodeID.
|
2023-01-06 16:27:42 +00:00
|
|
|
field node_id blob
|
2023-02-23 15:03:55 +00:00
|
|
|
// bytes_transferred is the number of bytes the storagenode has uploaded to an other storagenode.
|
2023-01-06 16:27:42 +00:00
|
|
|
field bytes_transferred int64 ( updatable )
|
2023-02-23 15:03:55 +00:00
|
|
|
// pieces_transferred is the count of pieces the storagenode has uploaded to an other storagenode.
|
2023-01-06 16:27:42 +00:00
|
|
|
field pieces_transferred int64 ( autoinsert, updatable, default 0 )
|
2023-02-23 15:03:55 +00:00
|
|
|
// pieces_failed is the count of pieces the storagenode has failed to transfer.
|
2023-01-06 16:27:42 +00:00
|
|
|
field pieces_failed int64 ( autoinsert, updatable, default 0 )
|
2023-02-23 15:03:55 +00:00
|
|
|
// updated_at is the last time the progress was updated.
|
2023-01-06 16:27:42 +00:00
|
|
|
field updated_at timestamp ( autoinsert, autoupdate )
|
|
|
|
)
|
|
|
|
|
|
|
|
read one (
|
|
|
|
select graceful_exit_progress
|
|
|
|
where graceful_exit_progress.node_id = ?
|
|
|
|
)
|
|
|
|
|
2023-02-23 15:03:55 +00:00
|
|
|
// graceful_exit_segment_transfer contains the segments that the storagenode needs to transfer to other nodes.
|
2023-01-06 16:27:42 +00:00
|
|
|
model graceful_exit_segment_transfer (
|
|
|
|
table graceful_exit_segment_transfer_queue
|
|
|
|
key node_id stream_id position piece_num
|
|
|
|
|
2023-02-23 15:03:55 +00:00
|
|
|
// node_id is the storagenode storj.NodeID.
|
2023-01-06 16:27:42 +00:00
|
|
|
field node_id blob
|
2023-02-23 15:03:55 +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 15:03:55 +00:00
|
|
|
// position refers to the metabase segments.position.
|
2023-01-06 16:27:42 +00:00
|
|
|
field position uint64
|
2023-02-23 15:03:55 +00:00
|
|
|
// piece_num is the piece index that the storagenode stores.
|
2023-01-06 16:27:42 +00:00
|
|
|
field piece_num int
|
2023-02-23 15:03:55 +00:00
|
|
|
// root_piece_id is the segment root piece id, which is necessary for deriving a new piece id.
|
2023-01-06 16:27:42 +00:00
|
|
|
field root_piece_id blob ( nullable )
|
2023-02-23 15:03:55 +00:00
|
|
|
// durability_ratio is a segment score on how important is it to transfer this piece.
|
2023-01-06 16:27:42 +00:00
|
|
|
field durability_ratio float64 ( updatable )
|
2023-02-23 15:03:55 +00:00
|
|
|
// queued_at is the time this segment was queued.
|
2023-01-06 16:27:42 +00:00
|
|
|
field queued_at timestamp ( autoinsert )
|
2023-02-23 15:03:55 +00:00
|
|
|
// requested_at is the time the piece info and order limits were requested by storagenode.
|
|
|
|
// This column is not being used.
|
2023-01-06 16:27:42 +00:00
|
|
|
field requested_at timestamp ( updatable, nullable )
|
2023-02-23 15:03:55 +00:00
|
|
|
// last_failed_at is when this segment transfer last failed.
|
2023-01-06 16:27:42 +00:00
|
|
|
field last_failed_at timestamp ( updatable, nullable )
|
2023-02-23 15:03:55 +00:00
|
|
|
// last_failed_code is a code for the failure classification.
|
|
|
|
// This column is not being used.
|
2023-01-06 16:27:42 +00:00
|
|
|
field last_failed_code int ( updatable, nullable )
|
2023-02-23 15:03:55 +00:00
|
|
|
// failed_count is the number of times the transfer failed.
|
2023-01-06 16:27:42 +00:00
|
|
|
field failed_count int ( updatable, nullable )
|
2023-02-23 15:03:55 +00:00
|
|
|
// finished_at is the time the segment transfer completed.
|
2023-01-06 16:27:42 +00:00
|
|
|
field finished_at timestamp ( updatable, nullable )
|
2023-02-23 15:03:55 +00:00
|
|
|
// order_limit_send_count counts how many times the storagnode has requested the order limit.
|
2023-01-06 16:27:42 +00:00
|
|
|
field order_limit_send_count int ( updatable, default 0 )
|
|
|
|
|
|
|
|
index (
|
|
|
|
name graceful_exit_segment_transfer_nid_dr_qa_fa_lfa_index
|
|
|
|
fields node_id durability_ratio queued_at finished_at last_failed_at
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
update graceful_exit_segment_transfer (
|
|
|
|
where graceful_exit_segment_transfer.node_id = ?
|
|
|
|
where graceful_exit_segment_transfer.stream_id = ?
|
|
|
|
where graceful_exit_segment_transfer.position = ?
|
|
|
|
where graceful_exit_segment_transfer.piece_num = ?
|
|
|
|
noreturn
|
|
|
|
)
|
|
|
|
delete graceful_exit_segment_transfer (
|
|
|
|
where graceful_exit_segment_transfer.node_id = ?
|
|
|
|
)
|
|
|
|
|
|
|
|
delete graceful_exit_segment_transfer (
|
|
|
|
where graceful_exit_segment_transfer.node_id = ?
|
|
|
|
where graceful_exit_segment_transfer.stream_id = ?
|
|
|
|
where graceful_exit_segment_transfer.position = ?
|
|
|
|
where graceful_exit_segment_transfer.piece_num = ?
|
|
|
|
)
|
|
|
|
|
|
|
|
delete graceful_exit_segment_transfer (
|
|
|
|
where graceful_exit_segment_transfer.node_id = ?
|
|
|
|
where graceful_exit_segment_transfer.finished_at != null
|
|
|
|
)
|
|
|
|
|
|
|
|
read one (
|
|
|
|
select graceful_exit_segment_transfer
|
|
|
|
where graceful_exit_segment_transfer.node_id = ?
|
|
|
|
where graceful_exit_segment_transfer.stream_id = ?
|
|
|
|
where graceful_exit_segment_transfer.position = ?
|
|
|
|
where graceful_exit_segment_transfer.piece_num = ?
|
|
|
|
)
|