Skip to content

Commit 755b3b4

Browse files
committed
HBASE-26585 Add SFT configuration to META table descriptor when creating META (#3998)
Signed-off-by: Duo Zhang <[email protected]> Signed-off-by: Josh Elser <[email protected]> (cherry picked from commit baeb51f)
1 parent b2e65b7 commit 755b3b4

File tree

2 files changed

+72
-1
lines changed

2 files changed

+72
-1
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSTableDescriptors.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import org.apache.hadoop.hbase.coprocessor.MultiRowMutationEndpoint;
4848
import org.apache.hadoop.hbase.exceptions.DeserializationException;
4949
import org.apache.hadoop.hbase.regionserver.BloomType;
50+
import org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileTrackerFactory;
5051
import org.apache.yetus.audience.InterfaceAudience;
5152
import org.slf4j.Logger;
5253
import org.slf4j.LoggerFactory;
@@ -127,7 +128,8 @@ public static TableDescriptor tryUpdateAndGetMetaTableDescriptor(Configuration c
127128
return getTableDescriptorFromFs(fs, rootdir, TableName.META_TABLE_NAME);
128129
} catch (TableInfoMissingException e) {
129130
TableDescriptorBuilder builder = createMetaTableDescriptorBuilder(conf);
130-
TableDescriptor td = builder.build();
131+
TableDescriptor td = StoreFileTrackerFactory.
132+
updateWithTrackerConfigs(conf, builder.build());
131133
LOG.info("Creating new hbase:meta table descriptor {}", td);
132134
TableName tableName = td.getTableName();
133135
Path tableDir = CommonFSUtils.getTableDir(rootdir, tableName);
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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.master;
19+
20+
import static org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileTrackerFactory.TRACKER_IMPL;
21+
import static org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileTrackerFactory.Trackers.FILE;
22+
import static org.junit.Assert.assertEquals;
23+
import org.apache.hadoop.hbase.HBaseClassTestRule;
24+
import org.apache.hadoop.hbase.HBaseTestingUtility;
25+
import org.apache.hadoop.hbase.TableName;
26+
import org.apache.hadoop.hbase.client.TableDescriptor;
27+
import org.apache.hadoop.hbase.testclassification.MasterTests;
28+
import org.apache.hadoop.hbase.testclassification.MediumTests;
29+
import org.junit.AfterClass;
30+
import org.junit.BeforeClass;
31+
import org.junit.ClassRule;
32+
import org.junit.Rule;
33+
import org.junit.Test;
34+
import org.junit.experimental.categories.Category;
35+
import org.junit.rules.TestName;
36+
37+
/**
38+
* Test the master filesystem in a local cluster with
39+
* Store File Tracking explicitly set in global config
40+
*/
41+
@Category({MasterTests.class, MediumTests.class})
42+
public class TestMasterFileSystemWithStoreFileTracking {
43+
44+
@ClassRule
45+
public static final HBaseClassTestRule CLASS_RULE =
46+
HBaseClassTestRule.forClass(TestMasterFileSystemWithStoreFileTracking.class);
47+
48+
@Rule
49+
public TestName name = new TestName();
50+
51+
private static final HBaseTestingUtility UTIL = new HBaseTestingUtility();
52+
53+
@BeforeClass
54+
public static void setupTest() throws Exception {
55+
UTIL.getConfiguration().set(TRACKER_IMPL, FILE.name());
56+
UTIL.startMiniCluster();
57+
}
58+
59+
@AfterClass
60+
public static void teardownTest() throws Exception {
61+
UTIL.shutdownMiniCluster();
62+
}
63+
64+
@Test
65+
public void tesMetaDescriptorHasSFTConfig() throws Exception {
66+
TableDescriptor descriptor = UTIL.getAdmin().getDescriptor(TableName.META_TABLE_NAME);
67+
assertEquals(FILE.name(), descriptor.getValue(TRACKER_IMPL));
68+
}
69+
}

0 commit comments

Comments
 (0)