Repository: accumulo Updated Branches: refs/heads/master 7aca0326e -> eaaebdf33
ACCUMULO-3249 Remove an unnecessary utility method for clarity and reduce visibility on some internal methods A number of the methods in ReplicationTableUtil shouldn't be directly accessed by clients but were still public or protected. Make things a little more specific by making them package private instead (to still allow for tests to work). Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/ebc4a041 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/ebc4a041 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/ebc4a041 Branch: refs/heads/master Commit: ebc4a0411bc523343a0b38fe75d221f28cd1e5c6 Parents: d75be63 Author: Josh Elser <els...@apache.org> Authored: Wed Oct 22 13:22:13 2014 -0400 Committer: Josh Elser <els...@apache.org> Committed: Thu Oct 23 11:18:33 2014 -0400 ---------------------------------------------------------------------- .../org/apache/accumulo/server/fs/VolumeUtil.java | 4 +++- .../accumulo/server/util/ReplicationTableUtil.java | 15 ++++----------- 2 files changed, 7 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/ebc4a041/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java ---------------------------------------------------------------------- diff --git a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java b/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java index 82b77ee..13f1e83 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java +++ b/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java @@ -241,7 +241,9 @@ public class VolumeUtil { Status status = StatusUtil.fileClosed(); log.debug("Tablet directory switched, need to record old log files " + logsToRemove + " " + ProtobufUtil.toString(status)); // Before deleting these logs, we need to mark them for replication - ReplicationTableUtil.updateLogs(creds, extent, logsToRemove, status); + for (LogEntry logEntry : logsToRemove) { + ReplicationTableUtil.updateFiles(creds, extent, logEntry.logSet, status); + } } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/ebc4a041/server/base/src/main/java/org/apache/accumulo/server/util/ReplicationTableUtil.java ---------------------------------------------------------------------- diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/ReplicationTableUtil.java b/server/base/src/main/java/org/apache/accumulo/server/util/ReplicationTableUtil.java index ab5ee86..8f0656c 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/util/ReplicationTableUtil.java +++ b/server/base/src/main/java/org/apache/accumulo/server/util/ReplicationTableUtil.java @@ -45,7 +45,6 @@ import org.apache.accumulo.core.protobuf.ProtobufUtil; import org.apache.accumulo.core.replication.StatusFormatter; import org.apache.accumulo.core.replication.proto.Replication.Status; import org.apache.accumulo.core.security.Credentials; -import org.apache.accumulo.core.tabletserver.log.LogEntry; import org.apache.accumulo.core.tabletserver.thrift.ConstraintViolationException; import org.apache.accumulo.core.util.UtilWaitThread; import org.apache.accumulo.server.client.HdfsZooInstance; @@ -78,11 +77,11 @@ public class ReplicationTableUtil { * @param writer * A Writer to use for the given credentials */ - protected synchronized static void addWriter(Credentials creds, Writer writer) { + synchronized static void addWriter(Credentials creds, Writer writer) { writers.put(creds, writer); } - protected synchronized static Writer getWriter(Credentials credentials) { + synchronized static Writer getWriter(Credentials credentials) { Writer replicationTable = writers.get(credentials); if (replicationTable == null) { Instance inst = HdfsZooInstance.getInstance(); @@ -157,7 +156,7 @@ public class ReplicationTableUtil { /** * Write the given Mutation to the replication table. */ - protected static void update(Credentials credentials, Mutation m, KeyExtent extent) { + static void update(Credentials credentials, Mutation m, KeyExtent extent) { Writer t = getWriter(credentials); while (true) { try { @@ -176,12 +175,6 @@ public class ReplicationTableUtil { } } - public static void updateLogs(Credentials creds, KeyExtent extent, Collection<LogEntry> logs, Status stat) { - for (LogEntry entry : logs) { - updateFiles(creds, extent, entry.logSet, stat); - } - } - /** * Write replication ingest entries for each provided file with the given {@link Status}. */ @@ -201,7 +194,7 @@ public class ReplicationTableUtil { } } - public static Mutation createUpdateMutation(Path file, Value v, KeyExtent extent) { + static Mutation createUpdateMutation(Path file, Value v, KeyExtent extent) { // Need to normalize the file path so we can assuredly find it again later return createUpdateMutation(new Text(ReplicationSection.getRowPrefix() + file.toString()), v, extent); }