Skip to content

Commit 84ee378

Browse files
authored
HBASE-22810 Initialize an separate ThreadPoolExecutor for taking/restoring snapshot (addendum - use the old config key) (#517)
1 parent b8857ec commit 84ee378

File tree

6 files changed

+55
-13
lines changed

6 files changed

+55
-13
lines changed

hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,11 +1496,6 @@ public enum OperationStatusCode {
14961496
"hbase.master.executor.logreplayops.threads";
14971497
public static final int MASTER_LOG_REPLAY_OPS_THREADS_DEFAULT = 10;
14981498

1499-
public static final String MASTER_SNAPSHOT_OPERATIONS_THREADS =
1500-
"hbase.master.executor.snapshot.threads";
1501-
public static final int MASTER_SNAPSHOT_OPERATIONS_THREADS_DEFAULT = 3;
1502-
1503-
15041499
private HConstants() {
15051500
// Can't be instantiated with this ctor.
15061501
}

hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,9 +1435,8 @@ private void startServiceThreads() throws IOException {
14351435
HConstants.MASTER_META_SERVER_OPERATIONS_THREADS_DEFAULT));
14361436
this.executorService.startExecutorService(ExecutorType.M_LOG_REPLAY_OPS, conf.getInt(
14371437
HConstants.MASTER_LOG_REPLAY_OPS_THREADS, HConstants.MASTER_LOG_REPLAY_OPS_THREADS_DEFAULT));
1438-
this.executorService.startExecutorService(ExecutorType.MASTER_SNAPSHOT_OPERATIONS,
1439-
conf.getInt(HConstants.MASTER_SNAPSHOT_OPERATIONS_THREADS,
1440-
HConstants.MASTER_SNAPSHOT_OPERATIONS_THREADS_DEFAULT));
1438+
this.executorService.startExecutorService(ExecutorType.MASTER_SNAPSHOT_OPERATIONS, conf.getInt(
1439+
SnapshotManager.SNAPSHOT_POOL_THREADS_KEY, SnapshotManager.SNAPSHOT_POOL_THREADS_DEFAULT));
14411440

14421441
// We depend on there being only one instance of this executor running
14431442
// at a time. To do concurrency, would need fencing of enable/disable of

hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/EnabledTableSnapshotHandler.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ public EnabledTableSnapshotHandler prepare() throws Exception {
6969
* phases to complete.
7070
*/
7171
@Override
72-
protected void snapshotRegions(List<Pair<RegionInfo, ServerName>> regions)
73-
throws HBaseSnapshotException, IOException {
72+
protected void snapshotRegions(List<Pair<RegionInfo, ServerName>> regions) throws IOException {
7473
Set<String> regionServers = new HashSet<>(regions.size());
7574
for (Pair<RegionInfo, ServerName> region : regions) {
7675
if (region != null && region.getFirst() != null && region.getSecond() != null) {

hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ public class SnapshotManager extends MasterProcedureManager implements Stoppable
146146
public static final String ONLINE_SNAPSHOT_CONTROLLER_DESCRIPTION = "online-snapshot";
147147

148148
/** Conf key for # of threads used by the SnapshotManager thread pool */
149-
private static final String SNAPSHOT_POOL_THREADS_KEY = "hbase.snapshot.master.threads";
149+
public static final String SNAPSHOT_POOL_THREADS_KEY = "hbase.snapshot.master.threads";
150150

151151
/** number of current operations running on the master */
152-
private static final int SNAPSHOT_POOL_THREADS_DEFAULT = 1;
152+
public static final int SNAPSHOT_POOL_THREADS_DEFAULT = 1;
153153

154154
private boolean stopped;
155155
private MasterServices master; // Needed by TableEventHandlers
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
package org.apache.hadoop.hbase.snapshot;
19+
20+
import org.apache.hadoop.conf.Configuration;
21+
import org.apache.hadoop.hbase.HBaseClassTestRule;
22+
import org.apache.hadoop.hbase.master.snapshot.SnapshotManager;
23+
import org.apache.hadoop.hbase.testclassification.ClientTests;
24+
import org.apache.hadoop.hbase.testclassification.LargeTests;
25+
import org.junit.BeforeClass;
26+
import org.junit.ClassRule;
27+
import org.junit.experimental.categories.Category;
28+
import org.slf4j.Logger;
29+
import org.slf4j.LoggerFactory;
30+
31+
@Category({ ClientTests.class, LargeTests.class })
32+
public class TestConcurrentFlushSnapshotFromClient extends TestFlushSnapshotFromClient {
33+
private static final Logger LOG = LoggerFactory.getLogger(TestFlushSnapshotFromClient.class);
34+
35+
@ClassRule
36+
public static final HBaseClassTestRule CLASS_RULE =
37+
HBaseClassTestRule.forClass(TestConcurrentFlushSnapshotFromClient.class);
38+
39+
@BeforeClass
40+
public static void setupCluster() throws Exception {
41+
setupConf(UTIL.getConfiguration());
42+
UTIL.startMiniCluster(3);
43+
}
44+
45+
protected static void setupConf(Configuration conf) {
46+
TestFlushSnapshotFromClient.setupConf(conf);
47+
UTIL.getConfiguration().setInt(SnapshotManager.SNAPSHOT_POOL_THREADS_KEY, 3);
48+
LOG.info("Config the {} to be 3", SnapshotManager.SNAPSHOT_POOL_THREADS_KEY);
49+
}
50+
}

hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestFlushSnapshotFromClient.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import java.util.HashMap;
2727
import java.util.List;
2828
import java.util.Map;
29-
import java.util.concurrent.CountDownLatch;
3029
import java.util.concurrent.TimeUnit;
3130
import java.util.concurrent.TimeoutException;
3231
import org.apache.hadoop.conf.Configuration;

0 commit comments

Comments
 (0)