saintstack commented on a change in pull request #1753:
URL: https://github.com/apache/hbase/pull/1753#discussion_r429344802



##########
File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/master/store/TestLocalRegionOnTwoFileSystems.java
##########
@@ -0,0 +1,170 @@
+/**
+ * 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.master.store;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.concurrent.TimeUnit;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.ChoreService;
+import org.apache.hadoop.hbase.HBaseClassTestRule;
+import org.apache.hadoop.hbase.HBaseCommonTestingUtility;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.Server;
+import org.apache.hadoop.hbase.ServerName;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.client.TableDescriptorBuilder;
+import org.apache.hadoop.hbase.master.cleaner.DirScanPool;
+import org.apache.hadoop.hbase.regionserver.MemStoreLAB;
+import org.apache.hadoop.hbase.testclassification.MasterTests;
+import org.apache.hadoop.hbase.testclassification.MediumTests;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.CommonFSUtils;
+import org.apache.hadoop.hbase.util.HFileArchiveUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.hbase.thirdparty.com.google.common.collect.Iterables;
+
+@Category({ MasterTests.class, MediumTests.class })
+public class TestLocalRegionOnTwoFileSystems {
+
+  @ClassRule
+  public static final HBaseClassTestRule CLASS_RULE =
+    HBaseClassTestRule.forClass(TestLocalRegionOnTwoFileSystems.class);
+
+  private static final HBaseCommonTestingUtility HFILE_UTIL = new 
HBaseCommonTestingUtility();
+
+  private static final HBaseTestingUtility WAL_UTIL = new 
HBaseTestingUtility();
+
+  private static ChoreService CHORE_SERVICE;
+
+  private static DirScanPool CLEANER_POOL;
+
+  private static LocalRegion REGION;
+
+  private static byte[] CF = Bytes.toBytes("f");
+
+  private static byte[] QUALIFIER = Bytes.toBytes("q");
+
+  private static String REGION_DIR_NAME = "local";
+
+  private static TableDescriptor TD =
+    TableDescriptorBuilder.newBuilder(TableName.valueOf("test:local"))
+      .setColumnFamily(ColumnFamilyDescriptorBuilder.of(CF)).build();
+
+  private static int COMPACT_MIN = 4;
+
+  @BeforeClass
+  public static void setUp() throws Exception {
+    WAL_UTIL.startMiniCluster(3);
+    Configuration conf = HFILE_UTIL.getConfiguration();
+    conf.setBoolean(MemStoreLAB.USEMSLAB_KEY, false);
+    CHORE_SERVICE = new ChoreService("TestLocalRegionOnTwoFileSystems");
+    CLEANER_POOL = new DirScanPool(conf);
+    Server server = mock(Server.class);
+    when(server.getConfiguration()).thenReturn(conf);
+    when(server.getServerName())
+      .thenReturn(ServerName.valueOf("localhost", 12345, 
System.currentTimeMillis()));
+    when(server.getChoreService()).thenReturn(CHORE_SERVICE);
+    Path rootDir = HFILE_UTIL.getDataTestDir();
+    CommonFSUtils.setRootDir(conf, rootDir);
+    Path walRootDir = WAL_UTIL.getDataTestDirOnTestFS();
+    FileSystem walFs = WAL_UTIL.getTestFileSystem();
+    CommonFSUtils.setWALRootDir(conf,
+      walRootDir.makeQualified(walFs.getUri(), walFs.getWorkingDirectory()));
+    LocalRegionParams params = new LocalRegionParams();
+    params.server(server).regionDirName(REGION_DIR_NAME).tableDescriptor(TD)
+      
.flushSize(TableDescriptorBuilder.DEFAULT_MEMSTORE_FLUSH_SIZE).flushPerChanges(1_000_000)
+      
.flushIntervalMs(TimeUnit.MINUTES.toMillis(15)).compactMin(COMPACT_MIN).maxWals(32)
+      
.useHsync(false).ringBufferSlotCount(16).rollPeriodMs(TimeUnit.MINUTES.toMillis(15))
+      .archivedWalSuffix(LocalStore.ARCHIVED_WAL_SUFFIX)
+      .archivedHFileSuffix(LocalStore.ARCHIVED_HFILE_SUFFIX);
+    REGION = LocalRegion.create(params);

Review comment:
       Where are the keys defined?




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to