Himanshu-g81 commented on code in PR #2188: URL: https://github.com/apache/phoenix/pull/2188#discussion_r2160357547
########## phoenix-core-server/src/main/java/org/apache/phoenix/replication/reader/ReplicationLogProcessor.java: ########## @@ -0,0 +1,288 @@ +/* + * 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.phoenix.replication.reader; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.hbase.HBaseConfiguration; +import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.TableName; +import org.apache.hadoop.hbase.client.AsyncConnection; +import org.apache.hadoop.hbase.client.AsyncTable; +import org.apache.hadoop.hbase.client.ConnectionFactory; +import org.apache.hadoop.hbase.client.Mutation; +import org.apache.hadoop.hbase.client.RetriesExhaustedException; +import org.apache.hadoop.hbase.util.FutureUtils; +import org.apache.phoenix.replication.log.LogFile; +import org.apache.phoenix.replication.log.LogFileReader; +import org.apache.phoenix.replication.log.LogFileReaderContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ReplicationLogProcessor { + + private static final Logger LOG = LoggerFactory.getLogger(ReplicationLogProcessor.class); + + /** + * The maximum count of mutations to process in single batch while reading replication log file + */ + public static final String REPLICATION_STANDBY_LOG_REPLAY_BATCH_SIZE = + "phoenix.replication.log.standby.replay.batch.size"; + + /** + * The default batch size for reading the replication log file. + * Assuming each log record to be 10 KB (un-compressed) and allow at max 64 MB of + * in-memory records to be processed + */ + public static final int DEFAULT_REPLICATION_STANDBY_LOG_REPLAY_BATCH_SIZE = 6400; + + /** + * The maximum number of retries for HBase client operations while applying the mutations + */ + public static final String REPLICATION_STANDBY_HBASE_CLIENT_RETRIES_COUNT = + "phoenix.replication.standby.hbase.client.retries.number"; + + /** + * The default number of retries for HBase client operations while applying the mutations. + */ + public static final int DEFAULT_REPLICATION_STANDBY_HBASE_CLIENT_RETRIES_COUNT = 4; + + /** + * The timeout for HBase client operations while applying the mutations. + */ + public static final String REPLICATION_STANDBY_HBASE_CLIENT_OPERATION_TIMEOUT_MS = + "phoenix.replication.standby.hbase.client.operations.timeout"; + + /** + * The default timeout for HBase client operations while applying the mutations. + */ + public static final int DEFAULT_REPLICATION_STANDBY_HBASE_CLIENT_OPERATION_TIMEOUT_MS = 10000; Review Comment: I thought of keeping it less than one round time (1 min), hence kept it 50. With latest commit (including the suggestion for having retries only for failed batch as well) and updating the retry timeout to 8 sec, we would max wait for higher layers of close to 2 mins (i.e 127 seconds (10 + 4*8) * 3 + (1 + 2 + 4 - expo backoff during retries for failed mutations). If we agree that 2 - 3 mins is max delay that we want on target cluster (when we are sure that file is written to target cluster) beyond which we can raise an alert in failure scenarios. Please note, all these values (hbase operation retries, timeout, failed batch retry) are exposed via configurations so we can tune them as per need. -- 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: issues-unsubscr...@phoenix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org