anmolnar commented on code in PR #7417: URL: https://github.com/apache/hbase/pull/7417#discussion_r2467289592
########## hbase-it/src/test/java/org/apache/hadoop/hbase/backup/IntegrationTestContinuousBackupRestore.java: ########## @@ -0,0 +1,125 @@ +/* + * 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.hadoop.hbase.backup; + +import static org.apache.hadoop.hbase.backup.replication.ContinuousBackupReplicationEndpoint.CONF_BACKUP_MAX_WAL_SIZE; +import static org.apache.hadoop.hbase.backup.replication.ContinuousBackupReplicationEndpoint.CONF_STAGED_WAL_FLUSH_INITIAL_DELAY; +import static org.apache.hadoop.hbase.backup.replication.ContinuousBackupReplicationEndpoint.CONF_STAGED_WAL_FLUSH_INTERVAL; +import static org.apache.hadoop.hbase.mapreduce.WALPlayer.IGNORE_EMPTY_FILES; +import static org.apache.hadoop.hbase.mapreduce.WALPlayer.IGNORE_MISSING_FILES; +import static org.apache.hadoop.hbase.replication.regionserver.ReplicationMarkerChore.REPLICATION_MARKER_ENABLED_KEY; + +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.IntegrationTestingUtility; +import org.apache.hadoop.hbase.backup.impl.BackupManager; +import org.apache.hadoop.hbase.testclassification.IntegrationTests; +import org.apache.hadoop.util.ToolRunner; +import org.junit.Before; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.apache.hbase.thirdparty.com.google.common.base.MoreObjects; +import org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine; + +/** + * An integration test to detect regressions in HBASE-28957. Create a table with many regions, load + * data, perform series backup/load operations with continuous backup enabled, then restore and + * verify data. + * @see <a href="https://issues.apache.org/jira/browse/HBASE-28957">HBASE-28957</a> + */ +@Category(IntegrationTests.class) +public class IntegrationTestContinuousBackupRestore extends IntegrationTestBackupRestoreBase { + private static final String CLASS_NAME = + IntegrationTestContinuousBackupRestore.class.getSimpleName(); + protected static final Logger LOG = + LoggerFactory.getLogger(IntegrationTestContinuousBackupRestore.class); + + @Override + @Before + public void setUp() throws Exception { + util = new IntegrationTestingUtility(); + conf = util.getConfiguration(); + regionsCountPerServer = conf.getInt(REGION_COUNT_KEY, DEFAULT_REGION_COUNT); + // We are using only 1 region server because we cannot wait for all region servers to catch up + // with replication. Therefore, we cannot be sure about how many rows will be restored after an + // incremental backup. + regionServerCount = 1; Review Comment: Since shipping of WAL entries is done by a replication endpoint asynchronously, the test should wait for all the RSs to finish shipping the data which is about to be restored. The distribution of keys is unknown to the test, so it's impossible to check whether a given region server is finished shipping the WALs that it's responsible for. With a single region server you can check the timestamp of the latest inserted row and wait for that to be shipped. -- 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]
