Jackie-Jiang commented on a change in pull request #7438: URL: https://github.com/apache/pinot/pull/7438#discussion_r710543808
########## File path: pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/SegmentZKMetadata.java ########## @@ -123,6 +123,14 @@ public void setIndexVersion(String indexVersion) { setValue(Segment.INDEX_VERSION, indexVersion); } + public int getZkStatVersion() { + return _znRecord.getVersion(); + } + + public void setZkStatVersion(int zkStatVersion) { Review comment: Let's remove this and always set the version in the caller side ########## File path: pinot-common/src/main/java/org/apache/pinot/common/metadata/ZKMetadataProvider.java ########## @@ -275,16 +275,20 @@ public static Schema getTableSchema(ZkHelixPropertyStore<ZNRecord> propertyStore public static List<SegmentZKMetadata> getSegmentsZKMetadata(ZkHelixPropertyStore<ZNRecord> propertyStore, String tableNameWithType) { String parentPath = constructPropertyStorePathForResource(tableNameWithType); + List<Stat> stats = new ArrayList<>(); List<ZNRecord> znRecords = propertyStore - .getChildren(parentPath, null, AccessOption.PERSISTENT, CommonConstants.Helix.ZkClient.RETRY_COUNT, + .getChildren(parentPath, stats, AccessOption.PERSISTENT, CommonConstants.Helix.ZkClient.RETRY_COUNT, CommonConstants.Helix.ZkClient.RETRY_INTERVAL_MS); if (znRecords != null) { int numZNRecords = znRecords.size(); List<SegmentZKMetadata> segmentsZKMetadata = new ArrayList<>(numZNRecords); - for (ZNRecord znRecord : znRecords) { + for (int i = 0; i < numZNRecords; i++) { + ZNRecord znRecord = znRecords.get(i); // NOTE: it is possible that znRecord is null if the record gets removed while calling this method if (znRecord != null) { - segmentsZKMetadata.add(new SegmentZKMetadata(znRecord)); + SegmentZKMetadata segmentZKMetadata = new SegmentZKMetadata(znRecord); Review comment: Set the version into the `ZNRecord` instead of the `SegmentZKMetadata` ########## File path: pinot-common/src/main/java/org/apache/pinot/common/metadata/segment/SegmentZKMetadata.java ########## @@ -123,6 +123,14 @@ public void setIndexVersion(String indexVersion) { setValue(Segment.INDEX_VERSION, indexVersion); } + public int getZkStatVersion() { Review comment: ```suggestion public int getZNRecordVersion() { ``` -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org