-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Add metadata indexes to help with segment allocation. #6348
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,11 +23,11 @@ | |
| import com.google.common.base.Supplier; | ||
| import com.google.common.base.Throwables; | ||
| import com.google.common.collect.ImmutableList; | ||
| import org.apache.commons.dbcp2.BasicDataSource; | ||
| import org.apache.druid.java.util.common.ISE; | ||
| import org.apache.druid.java.util.common.RetryUtils; | ||
| import org.apache.druid.java.util.common.StringUtils; | ||
| import org.apache.druid.java.util.common.logger.Logger; | ||
| import org.apache.commons.dbcp2.BasicDataSource; | ||
| import org.skife.jdbi.v2.Batch; | ||
| import org.skife.jdbi.v2.DBI; | ||
| import org.skife.jdbi.v2.Handle; | ||
|
|
@@ -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)", | ||
| tableName, | ||
| getQuoteString() | ||
| ) | ||
| ) | ||
| ); | ||
|
|
@@ -259,8 +264,15 @@ public void createSegmentTable(final String tableName) | |
| + ")", | ||
| tableName, getPayloadType(), getQuoteString() | ||
| ), | ||
| StringUtils.format("CREATE INDEX idx_%1$s_datasource ON %1$s(dataSource)", tableName), | ||
| StringUtils.format("CREATE INDEX idx_%1$s_used ON %1$s(used)", tableName) | ||
| StringUtils.format( | ||
| "CREATE INDEX idx_%1$s_datasource_end ON %1$s(dataSource, %2$send%2$s)", | ||
| tableName, | ||
| getQuoteString() | ||
| ), | ||
| StringUtils.format( | ||
| "CREATE INDEX idx_%1$s_datasource_sequence ON %1$s(dataSource, sequence_name)", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gianm sorry, I did not review these code carefully. There are no
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| tableName | ||
| ) | ||
| ) | ||
| ); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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
usedfield ofpendingSegmentsTable. You placed these code in wrong place. Just exchange their location will be good.