You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2020/06/17 11:13:50 UTC

[GitHub] [hbase] virajjasani commented on a change in pull request #1883: HBASE-24530 Introduce a split policy similar with SteppingSplitPolicy…

virajjasani commented on a change in pull request #1883:
URL: https://github.com/apache/hbase/pull/1883#discussion_r441468251



##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SteppingAllStoresSizeSplitPolicy.java
##########
@@ -0,0 +1,49 @@
+/**
+ * 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.regionserver;
+
+import org.apache.hadoop.hbase.procedure2.util.StringUtils;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@InterfaceAudience.Private
+public class SteppingAllStoresSizeSplitPolicy extends SteppingSplitPolicy {
+  private static final Logger LOG =
+    LoggerFactory.getLogger(SteppingAllStoresSizeSplitPolicy.class);
+
+  /**
+   * @return true if sum of store's size exceed the sizeToCheck
+   */
+  @Override
+  protected boolean isExceedSize(int tableRegionsCount, long sizeToCheck) {
+    long sumSize = 0;
+    for (HStore store : region.getStores()) {
+      sumSize += store.getSize();
+    }
+    if (sumSize > sizeToCheck) {
+      LOG.debug("ShouldSplit because region size is big enough " +
+        " size=" + StringUtils.humanSize(sumSize) +
+        ", sizeToCheck=" + StringUtils.humanSize(sizeToCheck) +
+        ", regionsWithCommonTable=" + tableRegionsCount);

Review comment:
       Can you use placeholders with `{}` for all arguments?




----------------------------------------------------------------
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:
users@infra.apache.org