clintropolis 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_r305281192
##########
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 guess it's harmless to put an `if (segments == null)` block that does a
`log.wtf` and returns early, will go ahead and modify to do that just in case.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]