From 7df33f98756b8f4e69d7cb729d6a11697d095dc7 Mon Sep 17 00:00:00 2001 From: Zhihong Yu Date: Tue, 13 Sep 2011 03:56:48 +0000 Subject: [PATCH] HBASE-4347 addendum that moves CLUSTER_ID_ATTR to Mutation git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1170025 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/java/org/apache/hadoop/hbase/HConstants.java | 6 ------ src/main/java/org/apache/hadoop/hbase/client/Mutation.java | 7 +++++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/apache/hadoop/hbase/HConstants.java b/src/main/java/org/apache/hadoop/hbase/HConstants.java index 45fefe4c71d..a96522b987f 100644 --- a/src/main/java/org/apache/hadoop/hbase/HConstants.java +++ b/src/main/java/org/apache/hadoop/hbase/HConstants.java @@ -204,12 +204,6 @@ public final class HConstants { /** Configuration key storing the cluster ID */ public static final String CLUSTER_ID = "hbase.cluster.id"; - /** - * Attribute used in Puts and Gets to indicate the originating - * cluster. - */ - public static final String CLUSTER_ID_ATTR = "_c.id_"; - // Always store the location of the root table's HRegion. // This HRegion is never split. diff --git a/src/main/java/org/apache/hadoop/hbase/client/Mutation.java b/src/main/java/org/apache/hadoop/hbase/client/Mutation.java index 42ab9b4badf..9113ed5e1db 100644 --- a/src/main/java/org/apache/hadoop/hbase/client/Mutation.java +++ b/src/main/java/org/apache/hadoop/hbase/client/Mutation.java @@ -32,6 +32,9 @@ import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.util.Bytes; public abstract class Mutation extends OperationWithAttributes { + // Attribute used in Mutations to indicate the originating cluster. + private static final String CLUSTER_ID_ATTR = "_c.id_"; + protected byte [] row = null; protected long ts = HConstants.LATEST_TIMESTAMP; protected long lockId = -1L; @@ -179,14 +182,14 @@ public abstract class Mutation extends OperationWithAttributes { byte[] val = new byte[2*Bytes.SIZEOF_LONG]; Bytes.putLong(val, 0, clusterId.getMostSignificantBits()); Bytes.putLong(val, Bytes.SIZEOF_LONG, clusterId.getLeastSignificantBits()); - setAttribute(HConstants.CLUSTER_ID_ATTR, val); + setAttribute(CLUSTER_ID_ATTR, val); } /** * @return The replication cluster id. */ public UUID getClusterId() { - byte[] attr = getAttribute(HConstants.CLUSTER_ID_ATTR); + byte[] attr = getAttribute(CLUSTER_ID_ATTR); if (attr == null) { return HConstants.DEFAULT_CLUSTER_ID; }