You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/07/19 09:14:40 UTC
[GitHub] [incubator-druid] leventov commented on a change in pull request
#8106: fix npe with sql metadata manager polling and empty database
leventov commented on a change in pull request #8106: fix npe with sql metadata manager polling and empty database
URL: https://github.com/apache/incubator-druid/pull/8106#discussion_r305270116
##########
File path: server/src/main/java/org/apache/druid/metadata/SQLMetadataSegmentManager.java
##########
@@ -967,10 +961,18 @@ public DataSegment map(int index, ResultSet r, StatementContext ctx) throws SQLE
// segment mark calls in rapid succession. So the snapshot update is not done outside of database poll at this time.
// Updates outside of database polls were primarily for the user experience, so users would immediately see the
// effect of a segment mark call reflected in MetadataResource API calls.
- dataSourcesSnapshot = DataSourcesSnapshot.fromUsedSegments(
- Iterables.filter(segments, Objects::nonNull), // Filter corrupted entries (see above in this method).
- dataSourceProperties
- );
+
+ ImmutableMap<String, String> dataSourceProperties = createDefaultDataSourceProperties();
+ if (segments == null || segments.isEmpty()) {
+ log.info("No segments found in the database!");
+ dataSourcesSnapshot = DataSourcesSnapshot.fromUsedSegments(Collections.emptyList(), dataSourceProperties);
Review comment:
I don't know how `segments == null` is possible here, but if `dataSourcesSnapshot` is already non-null, probably this assignment should be skipped. The cause may be intermittent database unavailability or failure. This condition should be logged.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org