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

Prevent the table creation when the time column name config is invalid #6030

Conversation

snleee
Copy link
Contributor

@snleee snleee commented Sep 17, 2020

Currently, there is no validation on the time column name from
the table config when creating a realtime table. Invalid time
configuration would cause the failure in commit stage because
start/end metadata doesn't get added to the segment metadata.

This adds the validation when creating the realtime table.

@snleee
Copy link
Contributor Author

snleee commented Sep 17, 2020

2020/09/17 20:36:52.666 ERROR [SegmentCompletionFSM_XXXXX__3__0__20200915T2142Z] [grizzly-http-server-3] [pinot-controller] [] Caught exception while committing segment metadata for segment: XXXXX__3__0__20200915T2142Z
java.lang.NullPointerException: null

@@ -1226,6 +1231,27 @@ void validateTableTenantConfig(TableConfig tableConfig) {
}
}

void validateTimeColumnConfig(TableConfig tableConfig, Schema schema) {
Copy link
Member

Choose a reason for hiding this comment

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

is this the right place? can we create a tableconfigvalidator @icefury71 you were also adding some validations right. lets move all validations related to tableconfig to one class

Copy link
Member

@jackjlli jackjlli left a comment

Choose a reason for hiding this comment

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

You can put all the validations for table creation in pinot-core/src/main/java/org/apache/pinot/core/util/TableConfigUtils.java, check the validate method there.

@snleee
Copy link
Contributor Author

snleee commented Sep 17, 2020

@jackjlli @kishoreg Thank you for the pointer. Actually, #5966 recently adds the validation and already fixed this issue. I slightly improved the validation and keep the test that I added.

Currently, there is no validation on the time column name from
the table config when creating a realtime table. Invalid time
configuration would cause the failure in commit stage because
start/end metadata doesn't get added to the segment metadata.

This adds the validation when creating the realtime table.
@snleee snleee force-pushed the fix-realtime-table-time-column-config-issue branch from b1f3309 to b0c0f9d Compare September 17, 2020 23:04
@@ -504,6 +504,8 @@ private LLCRealtimeSegmentZKMetadata updateCommittingSegmentZKMetadata(String re
committingSegmentZKMetadata.setDownloadUrl(isPeerURL(committingSegmentDescriptor.getSegmentLocation())
? CommonConstants.Segment.METADATA_URI_FOR_PEER_DOWNLOAD : committingSegmentDescriptor.getSegmentLocation());
committingSegmentZKMetadata.setCrc(Long.valueOf(segmentMetadata.getCrc()));
Preconditions.checkNotNull(segmentMetadata.getTimeInterval(),
Copy link
Contributor

Choose a reason for hiding this comment

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

can we log segment and table name here?

@@ -100,9 +101,13 @@ private static void validateValidationConfig(TableConfig tableConfig, @Nullable
}
// timeColumnName can be null in OFFLINE table
if (timeColumnName != null && schema != null) {
Preconditions.checkState(schema.getSpecForTimeColumn(timeColumnName) != null,
FieldSpec timeColumnFieldSpec = schema.getSpecForTimeColumn(timeColumnName);
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a TableConfigUtilsTest which exhaustively tests validations done here. Can you add one for timeColumn being TIME/DATE_TIME only?

Copy link
Contributor

@npawar npawar left a comment

Choose a reason for hiding this comment

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

LGTM. If you end up adding tests in TableConfigUtilsTest, this PR will conflict with #6017 so please check with him

@snleee snleee closed this Sep 17, 2020
@snleee
Copy link
Contributor Author

snleee commented Sep 17, 2020

Closing the pull request since the current code correctly validates the time column that I would like to do.

@snleee snleee deleted the fix-realtime-table-time-column-config-issue branch September 17, 2020 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants