keith-turner commented on code in PR #4317:
URL: https://github.com/apache/accumulo/pull/4317#discussion_r1517793549


##########
core/src/main/java/org/apache/accumulo/core/metadata/schema/TabletMetadata.java:
##########
@@ -316,6 +322,11 @@ public Map<StoredTabletFile,DataFileValue> getFilesMap() {
     return files;
   }
 
+  public long getFileSize() {

Review Comment:
   ```suggestion
      /**
       * @return the sum of the tablets files sizes
       */
     public long getFileSize() {
   ```
   
   
   Would be nice to add a unit test for this new method.



##########
core/src/main/java/org/apache/accumulo/core/metadata/schema/UnSplittableMetadata.java:
##########
@@ -0,0 +1,102 @@
+/*
+ * 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
+ *
+ *   https://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.accumulo.core.metadata.schema;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+import java.util.Base64;
+import java.util.Objects;
+import java.util.Set;
+
+import org.apache.accumulo.core.metadata.StoredTabletFile;
+
+import com.google.common.base.Preconditions;
+import com.google.common.hash.HashCode;
+import com.google.common.hash.Hashing;
+
+public class UnSplittableMetadata {
+
+  private final HashCode hashOfSplitParameters;
+
+  public UnSplittableMetadata(long splitThreshold, long maxEndRowSize, int 
maxFilesToOpen,
+      Set<StoredTabletFile> files) {
+    this(caclulateSplitParamsHash(splitThreshold, maxEndRowSize, 
maxFilesToOpen, files));
+  }
+
+  public UnSplittableMetadata(HashCode hashOfSplitParameters) {
+    this.hashOfSplitParameters = Objects.requireNonNull(hashOfSplitParameters);
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) {
+      return true;
+    }
+    if (o == null || getClass() != o.getClass()) {
+      return false;
+    }
+    UnSplittableMetadata that = (UnSplittableMetadata) o;
+    return Objects.equals(hashOfSplitParameters, that.hashOfSplitParameters);
+  }
+
+  @Override
+  public int hashCode() {
+    return Objects.hash(hashOfSplitParameters);
+  }
+
+  @Override
+  public String toString() {
+    return toBase64();
+  }
+
+  public String toBase64() {
+    return Base64.getEncoder().encodeToString(hashOfSplitParameters.asBytes());
+  }
+
+  @SuppressWarnings("UnstableApiUsage")
+  private static HashCode caclulateSplitParamsHash(long splitThreshold, long 
maxEndRowSize,

Review Comment:
   Not really sure if implementing this comment is worthwhile, but also can not 
think of any harm implementing it may cause.
   
   If a tablet is merged and this column is present, then merge should remove 
it.  To make the hash itself more strict, wondering if we should add the extent 
into the hash calculation.  That way if a merge happened and the column was not 
removed, then the hash would still differ if the extent is the only thing that 
is not the same between the pre and post merge tablet.  Maybe this overkill 
though.
   
   
   ```suggestion
     private static HashCode caclulateSplitParamsHash(KeyExtent extent, long 
splitThreshold, long maxEndRowSize,
   ```



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

To unsubscribe, e-mail: notifications-unsubscr...@accumulo.apache.org

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

Reply via email to