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
This commit is contained in:
Zhihong Yu 2011-09-13 03:56:48 +00:00
parent 71e8db15fb
commit 7df33f9875
2 changed files with 5 additions and 8 deletions

View File

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

View File

@ -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;
}