Skip to content

Fix indexes introduced in #6348.#6356

Merged
fjy merged 1 commit intoapache:masterfrom
gianm:fix-sql-indexes
Sep 26, 2018
Merged

Fix indexes introduced in #6348.#6356
fjy merged 1 commit intoapache:masterfrom
gianm:fix-sql-indexes

Conversation

@gianm
Copy link
Copy Markdown
Contributor

@gianm gianm commented Sep 20, 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.

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 added the Bug label Sep 20, 2018
@gianm gianm added this to the 0.13.0 milestone Sep 20, 2018
@gianm
Copy link
Copy Markdown
Contributor Author

gianm commented Sep 20, 2018

Thanks @QiuMM for the catch!

),
StringUtils.format(
"CREATE INDEX idx_%1$s_datasource_used_end ON %1$s(dataSource, used, %2$send%2$s)",
"CREATE INDEX idx_%1$s_datasource_end ON %1$s(dataSource, %2$send%2$s)",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder it's better to make an index for dataSource, sequence_name, end because this combination is used when searching an existing segmentId in IndexerSQLMetadataStorageCoordinator.allocatePendingSegment().

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We generally expect a small number of pending segments per sequence name, so I didn't think adding end would help much.

@fjy fjy merged commit a92a20e into apache:master Sep 26, 2018
@gianm gianm deleted the fix-sql-indexes branch September 26, 2018 13:39
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants