Skip to content

Commit 53522f3

Browse files
committed
HBASE-22810 Initialize an separate ThreadPoolExecutor for taking/restoring snapshot (addendum - use the old config key) (#517)
1 parent e28a7c2 commit 53522f3

File tree

5 files changed

+55
-12
lines changed

5 files changed

+55
-12
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
@@ -1526,11 +1526,6 @@ public enum OperationStatusCode {
15261526
"hbase.master.executor.logreplayops.threads";
15271527
public static final int MASTER_LOG_REPLAY_OPS_THREADS_DEFAULT = 10;
15281528

1529-
public static final String MASTER_SNAPSHOT_OPERATIONS_THREADS =
1530-
"hbase.master.executor.snapshot.threads";
1531-
public static final int MASTER_SNAPSHOT_OPERATIONS_THREADS_DEFAULT = 3;
1532-
1533-
15341529
private HConstants() {
15351530
// Can't be instantiated with this ctor.
15361531
}

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
@@ -1412,9 +1412,8 @@ private void startServiceThreads() throws IOException {
14121412
HConstants.MASTER_META_SERVER_OPERATIONS_THREADS_DEFAULT));
14131413
this.executorService.startExecutorService(ExecutorType.M_LOG_REPLAY_OPS, conf.getInt(
14141414
HConstants.MASTER_LOG_REPLAY_OPS_THREADS, HConstants.MASTER_LOG_REPLAY_OPS_THREADS_DEFAULT));
1415-
this.executorService.startExecutorService(ExecutorType.MASTER_SNAPSHOT_OPERATIONS,
1416-
conf.getInt(HConstants.MASTER_SNAPSHOT_OPERATIONS_THREADS,
1417-
HConstants.MASTER_SNAPSHOT_OPERATIONS_THREADS_DEFAULT));
1415+
this.executorService.startExecutorService(ExecutorType.MASTER_SNAPSHOT_OPERATIONS, conf.getInt(
1416+
SnapshotManager.SNAPSHOT_POOL_THREADS_KEY, SnapshotManager.SNAPSHOT_POOL_THREADS_DEFAULT));
14181417

14191418
// We depend on there being only one instance of this executor running
14201419
// 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+
}

0 commit comments

Comments
 (0)