somandal commented on code in PR #17028:
URL: https://github.com/apache/pinot/pull/17028#discussion_r2461724311
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/startree/v2/builder/MultipleTreesBuilder.java:
##########
@@ -243,6 +269,28 @@ private static SingleTreeBuilder
getSingleTreeBuilder(StarTreeV2BuilderConfig bu
public void close() {
if (_separatorTempDir != null) {
try {
+ try {
+ if (_starTreeCreationFailed) {
+ LOGGER.error("Star-tree index creation failed, trying to reset the
older star-tree index and metadata");
+ FileUtils.moveFileToDirectory(new File(_separatorTempDir,
StarTreeV2Constants.INDEX_FILE_NAME),
+ _segmentDirectory,
+ false);
+ FileUtils.moveFileToDirectory(new File(_separatorTempDir,
StarTreeV2Constants.INDEX_MAP_FILE_NAME),
+ _segmentDirectory, false);
+
+ // Copy back the older star-tree related metadata
+ Iterator<String> keys = _existingStarTreeMetadata.getKeys();
+ while (keys.hasNext()) {
+ String key = keys.next();
+ Object value = _existingStarTreeMetadata.getProperty(key);
+ _metadataProperties.addProperty(MetadataKey.STAR_TREE_PREFIX +
key, value);
+ }
+ CommonsConfigurationUtils.saveToFile(_metadataProperties,
+ new File(_segmentDirectory,
V1Constants.MetadataKeys.METADATA_FILE_NAME));
+ }
+ } catch (Exception e) {
+ LOGGER.error("Could not reset the star-tree index state to the
previous one", e);
Review Comment:
done - exception handling gets a bit weird when using try-with-resources and
we throw exception from close() when an earlier exception was thrown -
basically need to check suppressed exceptions list in this scenario. let me
know your thoughts on this
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]