Skip to content
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

Merged
merged 2 commits into from
Sep 19, 2018

Conversation

gianm
Copy link
Contributor

@gianm gianm commented Sep 19, 2018

Segment allocation queries can take a long time (10s of seconds) when
you have a lot of segments. Adding these indexes helps greatly.

Segment allocation queries can take a long time (10s of seconds) when
you have a lot of segments. Adding these indexes helps greatly.
@gianm gianm added this to the 0.13.0 milestone Sep 19, 2018
@QiuMM
Copy link
Member

QiuMM commented Sep 19, 2018

LGTM!

@fjy fjy merged commit e1c649e into apache:master Sep 19, 2018
getQuoteString()
),
StringUtils.format(
"CREATE INDEX idx_%1$s_datasource_sequence ON %1$s(dataSource, sequence_name)",
Copy link
Member

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...

Copy link
Contributor Author

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.

Copy link
Contributor Author

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)",
Copy link
Member

@QiuMM QiuMM Sep 20, 2018

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.

gianm added a commit to gianm/druid that referenced this pull request Sep 20, 2018
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.
fjy pushed a commit that referenced this pull request Sep 26, 2018
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.
gianm added a commit to implydata/druid-public that referenced this pull request Nov 16, 2018
Segment allocation queries can take a long time (10s of seconds) when
you have a lot of segments. Adding these indexes helps greatly.
gianm added a commit to implydata/druid-public that referenced this pull request Nov 16, 2018
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.
@gianm gianm deleted the sql-indexes branch September 23, 2022 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants