-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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 metadata indexes to help with segment allocation. #6348
Conversation
Segment allocation queries can take a long time (10s of seconds) when you have a lot of segments. Adding these indexes helps greatly.
LGTM! |
getQuoteString() | ||
), | ||
StringUtils.format( | ||
"CREATE INDEX idx_%1$s_datasource_sequence ON %1$s(dataSource, sequence_name)", |
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.
@gianm sorry, I did not review these code carefully. There are no sequence_name
of segmentTable
, pendingSegmentsTable
does...
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.
Ouch, you're right. Thanks for the catch- I will fix it. I'm surprised the tests didn't catch it - I thought they ran these create table commands. I will look into that too.
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.
Raised #6356 to fix this. The PR description also explains why the tests didn't catch this.
@@ -215,6 +215,11 @@ public void createPendingSegmentsTable(final String tableName) | |||
+ " UNIQUE (sequence_name_prev_id_sha1)\n" | |||
+ ")", | |||
tableName, getPayloadType(), getQuoteString() | |||
), | |||
StringUtils.format( | |||
"CREATE INDEX idx_%1$s_datasource_used_end ON %1$s(dataSource, used, %2$send%2$s)", |
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.
No used
field of pendingSegmentsTable
. You placed these code in wrong place. Just exchange their location will be good.
The indexes introduced in apache#6348 were on the wrong table. The tests did not catch them due to retries on the create table steps (the first try created the table but not the bogus indexes; the second try noticed that the table already existed and did nothing). This patch doesn't fix the issue with the tests, since the best way to do that would be to do the table and index creation in a transaction; but, this is not supported by all of our supported database engines.
The indexes introduced in #6348 were on the wrong table. The tests did not catch them due to retries on the create table steps (the first try created the table but not the bogus indexes; the second try noticed that the table already existed and did nothing). This patch doesn't fix the issue with the tests, since the best way to do that would be to do the table and index creation in a transaction; but, this is not supported by all of our supported database engines.
Segment allocation queries can take a long time (10s of seconds) when you have a lot of segments. Adding these indexes helps greatly.
The indexes introduced in apache#6348 were on the wrong table. The tests did not catch them due to retries on the create table steps (the first try created the table but not the bogus indexes; the second try noticed that the table already existed and did nothing). This patch doesn't fix the issue with the tests, since the best way to do that would be to do the table and index creation in a transaction; but, this is not supported by all of our supported database engines.
Segment allocation queries can take a long time (10s of seconds) when
you have a lot of segments. Adding these indexes helps greatly.