-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add migrations for shards table in postgres metastore #4119
Conversation
|
Okay that sounds good @guilload . I think my current changes are fine then! |
CREATE TYPE SHARDSTATE AS ENUM ('SHARD_STATE_UNSPECIFIED', 'SHARD_STATE_OPEN', 'SHARD_STATE_UNAVAILABLE', 'SHARD_STATE_CLOSED'); | ||
|
||
CREATE TABLE IF NOT EXISTS shards ( | ||
index_uid VARCHAR(288) NOT NULL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why 288
and not 282
? (255 + 1 for :
separator + 26 for ULID)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup it should be 282, I mistaked it for 288.
|
||
CREATE TABLE IF NOT EXISTS shards ( | ||
index_uid VARCHAR(288) NOT NULL, | ||
source_id VARCHAR(50) NOT NULL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
source_id VARCHAR(50) NOT NULL, | |
source_id VARCHAR(255) NOT NULL, |
index_uid VARCHAR(288) NOT NULL, | ||
source_id VARCHAR(50) NOT NULL, | ||
shard_id BIGSERIAL, | ||
leader_id VARCHAR(50) NOT NULL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leader_id VARCHAR(50) NOT NULL, | |
leader_id VARCHAR(255) NOT NULL, |
source_id VARCHAR(50) NOT NULL, | ||
shard_id BIGSERIAL, | ||
leader_id VARCHAR(50) NOT NULL, | ||
follower_id VARCHAR(50), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
follower_id VARCHAR(50), | |
follower_id VARCHAR(255), |
follower_id VARCHAR(50), | ||
shard_state SHARDSTATE NOT NULL, | ||
publish_position_inclusive bytea NOT NULL, | ||
publish_token VARCHAR(50), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
publish_token VARCHAR(50), | |
publish_token VARCHAR(255), |
754f082
to
20bf828
Compare
Description
This is the first set of changes to support the shards API in the postgres metastore(#3810). There are couple of items that still need to be addressed:
index_uid
vsindex_id
for the table, the ingestv2_api seems to use (index_id, shard_id) whereas the filebacked index uses index_uid. What is everyone's consensus on the right column for this?SourceCheckpoint
similar to this https://github.com/quickwit-oss/quickwit/blob/main/quickwit/quickwit-metastore/src/metastore/file_backed_metastore/file_backed_index/shards.rs#L42 ? If so, I think the right approach might be to create another table for it.next_shard_id
in this PR. But here https://github.com/quickwit-oss/quickwit/blob/main/quickwit/quickwit-metastore/src/metastore/file_backed_metastore/file_backed_index/shards.rs#L144 we use the next_shard_id from the subrequest. Can the subrequest have anext_shard_id
that can deviate from the indexesnext_shard_id
? If yes, then I would need to remove the auto-increement.How was this PR tested?
sqlx migrate run --database-url postgres://quickwit-dev:quickwit-dev@localhost:5432/quickwit-metastore-dev --source migrations/postgresql