merlimat commented on a change in pull request #12975: URL: https://github.com/apache/pulsar/pull/12975#discussion_r758690938
########## File path: pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKBatchedMetadataStore.java ########## @@ -0,0 +1,181 @@ +/** + * 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.pulsar.metadata.impl; + + +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.pulsar.metadata.api.GetResult; +import org.apache.pulsar.metadata.api.MetadataStoreConfig; +import org.apache.pulsar.metadata.api.MetadataStoreException; +import org.apache.pulsar.metadata.impl.batch.BatchWorker; +import org.apache.pulsar.metadata.impl.batch.MetadataOp; +import org.apache.zookeeper.AsyncCallback; +import org.apache.zookeeper.KeeperException.Code; +import org.apache.zookeeper.Op; +import org.apache.zookeeper.OpResult; +import org.apache.zookeeper.ZooDefs; + +@Slf4j +public class ZKBatchedMetadataStore extends ZKMetadataStore implements AsyncCallback.MultiCallback { + + protected final boolean metadataStoreBatchingEnable = true; + protected final int metadataStoreBatchingMaxDelayMillis = 5; + protected final int metadataStoreBatchingMaxOperations = 100; + protected final int metadataStoreBatchingMaxSizeKb = 128; Review comment: These parameters should be left configurable, in particular the enable/disable, as we might want to disable in case we see bugs. ########## File path: pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKBatchedMetadataStore.java ########## @@ -0,0 +1,181 @@ +/** + * 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.pulsar.metadata.impl; + + +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.pulsar.metadata.api.GetResult; +import org.apache.pulsar.metadata.api.MetadataStoreConfig; +import org.apache.pulsar.metadata.api.MetadataStoreException; +import org.apache.pulsar.metadata.impl.batch.BatchWorker; +import org.apache.pulsar.metadata.impl.batch.MetadataOp; +import org.apache.zookeeper.AsyncCallback; +import org.apache.zookeeper.KeeperException.Code; +import org.apache.zookeeper.Op; +import org.apache.zookeeper.OpResult; +import org.apache.zookeeper.ZooDefs; + +@Slf4j +public class ZKBatchedMetadataStore extends ZKMetadataStore implements AsyncCallback.MultiCallback { Review comment: Instead of extending the `ZKMetadataStore`, I believe we should have a common abstract class that implements the batching logic, which could be shared across multiple implementations. -- 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]
