Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Copy Markdown
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.

tableName,
getQuoteString()
)
)
);
Expand Down Expand Up @@ -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)",
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

tableName
)
)
);
}
Expand Down