cshannon commented on code in PR #4317:
URL: https://github.com/apache/accumulo/pull/4317#discussion_r1517876467


##########
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:
   Seems fine to add the extent as well, there is no harm since it is supposed 
to be per tablet anyways.



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