walterddr commented on code in PR #10455:
URL: https://github.com/apache/pinot/pull/10455#discussion_r1145487118


##########
pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentmetadata/SegmentZkMetadataCache.java:
##########
@@ -0,0 +1,107 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.broker.routing.segmentmetadata;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.helix.AccessOption;
+import org.apache.helix.model.ExternalView;
+import org.apache.helix.model.IdealState;
+import org.apache.helix.store.zk.ZkHelixPropertyStore;
+import org.apache.helix.zookeeper.datamodel.ZNRecord;
+import org.apache.pinot.broker.routing.segmentpruner.SegmentPruner;
+import org.apache.pinot.common.metadata.ZKMetadataProvider;
+import org.apache.pinot.common.request.BrokerRequest;
+
+
+/**
+ * {@code SegmentZkMetadataCache} is used to cache {@link ZNRecord} stored in 
{@link ZkHelixPropertyStore} for
+ * segments. This is used by {@link SegmentPruner#prune(BrokerRequest, Set)}.
+ */
+public class SegmentZkMetadataCache {
+  private final String _tableNameWithType;
+  private final ZkHelixPropertyStore<ZNRecord> _propertyStore;
+  private final String _segmentZKMetadataPathPrefix;
+  private final List<SegmentPruner> _registeredPruners;

Review Comment:
   yeah maybe the naming is not as intuitive. the problem @Jackie-Jiang 
mentioned is that caching segment zk metadata as a whole will create a large 
memory footprint. so this class actually only caches the online segment names. 
and invoke `onAssignmentChange` and `refreshSegment` of the registered methods. 
   
   in the next PR I am going to 
   - make TimeBoundaryManager also registered with SegmentZkMetadataCache so it 
doesn't need to individually pull from ZK
   - create a PartitionManager to manage segment-partition/server mapping info 
very similar to SinglePartitionPruner



-- 
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]

Reply via email to