busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r376092399
 
 

 ##########
 File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/mob/MobStressToolRunner.java
 ##########
 @@ -0,0 +1,325 @@
+/**
+ *
+ * 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.mob;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+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.HBaseTestingUtility;
+import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.KeepDeletedCells;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.ResultScanner;
+import org.apache.hadoop.hbase.client.Table;
+import org.apache.hadoop.hbase.master.cleaner.TimeToLiveHFileCleaner;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+/**
+    Reproduction for MOB data loss
+
+ 1. Settings: Region Size 200 MB,  Flush threshold 800 KB.
+ 2. Insert 10 Million records
+ 3. MOB Compaction and Archiver
+      a) Trigger MOB Compaction (every 2 minutes)
+      b) Trigger major compaction (every 2 minutes)
+      c) Trigger archive cleaner (every 3 minutes)
+ 4. Validate MOB data after complete data load.
+
+ This class is used by MobStressTool only. This is not a unit test
+
+ */
+@SuppressWarnings("deprecation")
+public class MobStressToolRunner {
+  private static final Logger LOG = 
LoggerFactory.getLogger(MobStressToolRunner.class);
+
+
+  private HBaseTestingUtility HTU;
+
+  private final static String famStr = "f1";
+  private final static byte[] fam = Bytes.toBytes(famStr);
+  private final static byte[] qualifier = Bytes.toBytes("q1");
+  private final static long mobLen = 10;
+  private final static byte[] mobVal = Bytes
+      
.toBytes("01234567890123456789012345678901234567890123456789012345678901234567890123456789");
+
+  private Configuration conf;
+  private HTableDescriptor hdt;
+  private HColumnDescriptor hcd;
+  private Admin admin;
+  private long count = 500000;
+  private double failureProb = 0.1;
+  private Table table = null;
+  private MobFileCleanerChore chore = new MobFileCleanerChore();
+
+  private static volatile boolean run = true;
+
+  public MobStressToolRunner() {
+
+  }
+
+  public void init(Configuration conf, long numRows) throws IOException {
+    this.conf = conf;
+    this.count = numRows;
+    initConf();
+    printConf();
+    hdt = createTableDescriptor("testMobCompactTable");
+    Connection conn = ConnectionFactory.createConnection(this.conf);
+    this.admin = conn.getAdmin();
+    this.hcd = new HColumnDescriptor(fam);
+    this.hcd.setMobEnabled(true);
+    this.hcd.setMobThreshold(mobLen);
+    this.hcd.setMaxVersions(1);
+    this.hdt.addFamily(hcd);
+    if (admin.tableExists(hdt.getTableName())) {
+      admin.disableTable(hdt.getTableName());
+      admin.deleteTable(hdt.getTableName());
+    }
+    admin.createTable(hdt);
+    table = conn.getTable(hdt.getTableName());
+  }
+
+  private void printConf() {
+    LOG.info("Please ensure the following HBase configuration is set:");
+    LOG.info("hfile.format.version=3");
+    LOG.info("hbase.master.hfilecleaner.ttl=0");
+    LOG.info("hbase.hregion.max.filesize=200000000");
+    LOG.info("hbase.client.retries.number=100");
+    LOG.info("hbase.hregion.memstore.flush.size=800000");
+    LOG.info("hbase.hstore.blockingStoreFiles=150");
+    LOG.info("hbase.hstore.compaction.throughput.lower.bound=50000000");
+    LOG.info("hbase.hstore.compaction.throughput.higher.bound=100000000");
+    LOG.info("hbase.master.mob.cleaner.period=0");
+    
LOG.info("hbase.mob.default.compactor=org.apache.hadoop.hbase.mob.FaultyMobStoreCompactor");
+    LOG.warn("hbase.mob.compaction.fault.probability=x, where x is between 0. 
and 1.");
+
+  }
+
+  private HTableDescriptor createTableDescriptor(final String name, final int 
minVersions,
 
 Review comment:
   why do we have two versions of this method? It looks like we don't actually 
use any of these options. Can we just put the `new HTableDescriptor` call 
directly in the init block?

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


With regards,
Apache Git Services

Reply via email to