HBASE-10024 Add an interface to create put with immutable arrays
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1545592 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
edbf698cc1
commit
38d454dc2b
@ -138,10 +138,28 @@ public class Put extends Mutation implements HeapSize, Comparable<Row> {
|
|||||||
return add(family, qualifier, this.ts, value);
|
return add(family, qualifier, this.ts, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See {@link #add(byte[], byte[], byte[])}. This version expects
|
||||||
|
* that the underlying arrays won't change. It's intended
|
||||||
|
* for usage internal HBase to and for advanced client applications.
|
||||||
|
*/
|
||||||
|
public Put addImmutable(byte [] family, byte [] qualifier, byte [] value) {
|
||||||
|
return addImmutable(family, qualifier, this.ts, value);
|
||||||
|
}
|
||||||
|
|
||||||
public Put add(byte[] family, byte [] qualifier, byte [] value, Tag[] tag) {
|
public Put add(byte[] family, byte [] qualifier, byte [] value, Tag[] tag) {
|
||||||
return add(family, qualifier, this.ts, value, tag);
|
return add(family, qualifier, this.ts, value, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See {@link #add(byte[], byte[], byte[], Tag[] tag)}. This version expects
|
||||||
|
* that the underlying arrays won't change. It's intended
|
||||||
|
* for usage internal HBase to and for advanced client applications.
|
||||||
|
*/
|
||||||
|
public Put addImmutable(byte[] family, byte [] qualifier, byte [] value, Tag[] tag) {
|
||||||
|
return addImmutable(family, qualifier, this.ts, value, tag);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the specified column and value, with the specified timestamp as
|
* Add the specified column and value, with the specified timestamp as
|
||||||
* its version to this Put operation.
|
* its version to this Put operation.
|
||||||
@ -152,6 +170,22 @@ public class Put extends Mutation implements HeapSize, Comparable<Row> {
|
|||||||
* @return this
|
* @return this
|
||||||
*/
|
*/
|
||||||
public Put add(byte [] family, byte [] qualifier, long ts, byte [] value) {
|
public Put add(byte [] family, byte [] qualifier, long ts, byte [] value) {
|
||||||
|
if (ts < 0) {
|
||||||
|
throw new IllegalArgumentException("Timestamp cannot be negative. ts=" + ts);
|
||||||
|
}
|
||||||
|
List<Cell> list = getCellList(family);
|
||||||
|
KeyValue kv = createPutKeyValue(family, qualifier, ts, value);
|
||||||
|
list.add(kv);
|
||||||
|
familyMap.put(CellUtil.cloneFamily(kv), list);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See {@link #add(byte[], byte[], long, byte[])}. This version expects
|
||||||
|
* that the underlying arrays won't change. It's intended
|
||||||
|
* for usage internal HBase to and for advanced client applications.
|
||||||
|
*/
|
||||||
|
public Put addImmutable(byte [] family, byte [] qualifier, long ts, byte [] value) {
|
||||||
if (ts < 0) {
|
if (ts < 0) {
|
||||||
throw new IllegalArgumentException("Timestamp cannot be negative. ts=" + ts);
|
throw new IllegalArgumentException("Timestamp cannot be negative. ts=" + ts);
|
||||||
}
|
}
|
||||||
@ -170,7 +204,21 @@ public class Put extends Mutation implements HeapSize, Comparable<Row> {
|
|||||||
List<Cell> list = getCellList(family);
|
List<Cell> list = getCellList(family);
|
||||||
KeyValue kv = createPutKeyValue(family, qualifier, ts, value, tag);
|
KeyValue kv = createPutKeyValue(family, qualifier, ts, value, tag);
|
||||||
list.add(kv);
|
list.add(kv);
|
||||||
familyMap.put(kv.getFamily(), list);
|
familyMap.put(CellUtil.cloneFamily(kv), list);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See {@link #add(byte[], byte[], long, byte[], Tag[] tag)}. This version expects
|
||||||
|
* that the underlying arrays won't change. It's intended
|
||||||
|
* for usage internal HBase to and for advanced client applications.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public Put addImmutable(byte[] family, byte[] qualifier, long ts, byte[] value, Tag[] tag) {
|
||||||
|
List<Cell> list = getCellList(family);
|
||||||
|
KeyValue kv = createPutKeyValue(family, qualifier, ts, value, tag);
|
||||||
|
list.add(kv);
|
||||||
|
familyMap.put(family, list);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,10 +239,29 @@ public class Put extends Mutation implements HeapSize, Comparable<Row> {
|
|||||||
List<Cell> list = getCellList(family);
|
List<Cell> list = getCellList(family);
|
||||||
KeyValue kv = createPutKeyValue(family, qualifier, ts, value, tag);
|
KeyValue kv = createPutKeyValue(family, qualifier, ts, value, tag);
|
||||||
list.add(kv);
|
list.add(kv);
|
||||||
familyMap.put(kv.getFamily(), list);
|
familyMap.put(CellUtil.cloneFamily(kv), list);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See {@link #add(byte[], ByteBuffer, long, ByteBuffer, Tag[] tag)}. This version expects
|
||||||
|
* that the underlying arrays won't change. It's intended
|
||||||
|
* for usage internal HBase to and for advanced client applications.
|
||||||
|
*/
|
||||||
|
public Put addImmutable(byte[] family, ByteBuffer qualifier, long ts, ByteBuffer value,
|
||||||
|
Tag[] tag) {
|
||||||
|
if (ts < 0) {
|
||||||
|
throw new IllegalArgumentException("Timestamp cannot be negative. ts=" + ts);
|
||||||
|
}
|
||||||
|
List<Cell> list = getCellList(family);
|
||||||
|
KeyValue kv = createPutKeyValue(family, qualifier, ts, value, tag);
|
||||||
|
list.add(kv);
|
||||||
|
familyMap.put(family, list);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the specified column and value, with the specified timestamp as
|
* Add the specified column and value, with the specified timestamp as
|
||||||
* its version to this Put operation.
|
* its version to this Put operation.
|
||||||
@ -211,7 +278,23 @@ public class Put extends Mutation implements HeapSize, Comparable<Row> {
|
|||||||
List<Cell> list = getCellList(family);
|
List<Cell> list = getCellList(family);
|
||||||
KeyValue kv = createPutKeyValue(family, qualifier, ts, value, null);
|
KeyValue kv = createPutKeyValue(family, qualifier, ts, value, null);
|
||||||
list.add(kv);
|
list.add(kv);
|
||||||
familyMap.put(kv.getFamily(), list);
|
familyMap.put(CellUtil.cloneFamily(kv), list);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See {@link #add(byte[], ByteBuffer, long, ByteBuffer)}. This version expects
|
||||||
|
* that the underlying arrays won't change. It's intended
|
||||||
|
* for usage internal HBase to and for advanced client applications.
|
||||||
|
*/
|
||||||
|
public Put addImmutable(byte[] family, ByteBuffer qualifier, long ts, ByteBuffer value) {
|
||||||
|
if (ts < 0) {
|
||||||
|
throw new IllegalArgumentException("Timestamp cannot be negative. ts=" + ts);
|
||||||
|
}
|
||||||
|
List<Cell> list = getCellList(family);
|
||||||
|
KeyValue kv = createPutKeyValue(family, qualifier, ts, value, null);
|
||||||
|
list.add(kv);
|
||||||
|
familyMap.put(family, list);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,7 +503,7 @@ public final class ProtobufUtil {
|
|||||||
if (put == null) {
|
if (put == null) {
|
||||||
put = new Put(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength(), timestamp);
|
put = new Put(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength(), timestamp);
|
||||||
}
|
}
|
||||||
put.add(KeyValueUtil.ensureKeyValue(cell));
|
put.add(cell);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (proto.hasRow()) {
|
if (proto.hasRow()) {
|
||||||
@ -535,9 +535,9 @@ public final class ProtobufUtil {
|
|||||||
for(int i = 0; i< array.length; i++) {
|
for(int i = 0; i< array.length; i++) {
|
||||||
tagArray[i] = (Tag)array[i];
|
tagArray[i] = (Tag)array[i];
|
||||||
}
|
}
|
||||||
put.add(family, qualifier, ts, value, tagArray);
|
put.addImmutable(family, qualifier, ts, value, tagArray);
|
||||||
} else {
|
} else {
|
||||||
put.add(family, qualifier, ts, value);
|
put.addImmutable(family, qualifier, ts, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,10 +84,12 @@ public class MetaEditor {
|
|||||||
*/
|
*/
|
||||||
public static Put addDaughtersToPut(Put put, HRegionInfo splitA, HRegionInfo splitB) {
|
public static Put addDaughtersToPut(Put put, HRegionInfo splitA, HRegionInfo splitB) {
|
||||||
if (splitA != null) {
|
if (splitA != null) {
|
||||||
put.add(HConstants.CATALOG_FAMILY, HConstants.SPLITA_QUALIFIER, splitA.toByteArray());
|
put.addImmutable(
|
||||||
|
HConstants.CATALOG_FAMILY, HConstants.SPLITA_QUALIFIER, splitA.toByteArray());
|
||||||
}
|
}
|
||||||
if (splitB != null) {
|
if (splitB != null) {
|
||||||
put.add(HConstants.CATALOG_FAMILY, HConstants.SPLITB_QUALIFIER, splitB.toByteArray());
|
put.addImmutable(
|
||||||
|
HConstants.CATALOG_FAMILY, HConstants.SPLITB_QUALIFIER, splitB.toByteArray());
|
||||||
}
|
}
|
||||||
return put;
|
return put;
|
||||||
}
|
}
|
||||||
@ -315,9 +317,9 @@ public class MetaEditor {
|
|||||||
|
|
||||||
// Put for parent
|
// Put for parent
|
||||||
Put putOfMerged = makePutFromRegionInfo(copyOfMerged);
|
Put putOfMerged = makePutFromRegionInfo(copyOfMerged);
|
||||||
putOfMerged.add(HConstants.CATALOG_FAMILY, HConstants.MERGEA_QUALIFIER,
|
putOfMerged.addImmutable(HConstants.CATALOG_FAMILY, HConstants.MERGEA_QUALIFIER,
|
||||||
regionA.toByteArray());
|
regionA.toByteArray());
|
||||||
putOfMerged.add(HConstants.CATALOG_FAMILY, HConstants.MERGEB_QUALIFIER,
|
putOfMerged.addImmutable(HConstants.CATALOG_FAMILY, HConstants.MERGEB_QUALIFIER,
|
||||||
regionB.toByteArray());
|
regionB.toByteArray());
|
||||||
|
|
||||||
// Deletes for merging regions
|
// Deletes for merging regions
|
||||||
@ -561,17 +563,17 @@ public class MetaEditor {
|
|||||||
|
|
||||||
private static Put addRegionInfo(final Put p, final HRegionInfo hri)
|
private static Put addRegionInfo(final Put p, final HRegionInfo hri)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
p.add(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER,
|
p.addImmutable(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER,
|
||||||
hri.toByteArray());
|
hri.toByteArray());
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Put addLocation(final Put p, final ServerName sn, long openSeqNum) {
|
private static Put addLocation(final Put p, final ServerName sn, long openSeqNum) {
|
||||||
p.add(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER,
|
p.addImmutable(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER,
|
||||||
Bytes.toBytes(sn.getHostAndPort()));
|
Bytes.toBytes(sn.getHostAndPort()));
|
||||||
p.add(HConstants.CATALOG_FAMILY, HConstants.STARTCODE_QUALIFIER,
|
p.addImmutable(HConstants.CATALOG_FAMILY, HConstants.STARTCODE_QUALIFIER,
|
||||||
Bytes.toBytes(sn.getStartcode()));
|
Bytes.toBytes(sn.getStartcode()));
|
||||||
p.add(HConstants.CATALOG_FAMILY, HConstants.SEQNUM_QUALIFIER,
|
p.addImmutable(HConstants.CATALOG_FAMILY, HConstants.SEQNUM_QUALIFIER,
|
||||||
Bytes.toBytes(openSeqNum));
|
Bytes.toBytes(openSeqNum));
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ public class MetaMigrationConvertingToPB {
|
|||||||
//This will 'migrate' the HRI from 092.x and 0.94.x to 0.96+ by reading the
|
//This will 'migrate' the HRI from 092.x and 0.94.x to 0.96+ by reading the
|
||||||
//writable serialization
|
//writable serialization
|
||||||
HRegionInfo hri = parseFrom(hriSplitBytes);
|
HRegionInfo hri = parseFrom(hriSplitBytes);
|
||||||
p.add(HConstants.CATALOG_FAMILY, which, hri.toByteArray());
|
p.addImmutable(HConstants.CATALOG_FAMILY, which, hri.toByteArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ public class TableNamespaceManager {
|
|||||||
|
|
||||||
private void upsert(HTable table, NamespaceDescriptor ns) throws IOException {
|
private void upsert(HTable table, NamespaceDescriptor ns) throws IOException {
|
||||||
Put p = new Put(Bytes.toBytes(ns.getName()));
|
Put p = new Put(Bytes.toBytes(ns.getName()));
|
||||||
p.add(HTableDescriptor.NAMESPACE_FAMILY_INFO_BYTES,
|
p.addImmutable(HTableDescriptor.NAMESPACE_FAMILY_INFO_BYTES,
|
||||||
HTableDescriptor.NAMESPACE_COL_DESC_BYTES,
|
HTableDescriptor.NAMESPACE_COL_DESC_BYTES,
|
||||||
ProtobufUtil.toProtoNamespaceDescriptor(ns).toByteArray());
|
ProtobufUtil.toProtoNamespaceDescriptor(ns).toByteArray());
|
||||||
table.put(p);
|
table.put(p);
|
||||||
|
@ -143,7 +143,7 @@ public class FavoredNodeAssignmentHelper {
|
|||||||
if (favoredNodeList != null) {
|
if (favoredNodeList != null) {
|
||||||
put = MetaEditor.makePutFromRegionInfo(regionInfo);
|
put = MetaEditor.makePutFromRegionInfo(regionInfo);
|
||||||
byte[] favoredNodes = getFavoredNodes(favoredNodeList);
|
byte[] favoredNodes = getFavoredNodes(favoredNodeList);
|
||||||
put.add(HConstants.CATALOG_FAMILY, FAVOREDNODES_QUALIFIER,
|
put.addImmutable(HConstants.CATALOG_FAMILY, FAVOREDNODES_QUALIFIER,
|
||||||
EnvironmentEdgeManager.currentTimeMillis(), favoredNodes);
|
EnvironmentEdgeManager.currentTimeMillis(), favoredNodes);
|
||||||
LOG.info("Create the region " + regionInfo.getRegionNameAsString() +
|
LOG.info("Create the region " + regionInfo.getRegionNameAsString() +
|
||||||
" with favored nodes " + Bytes.toString(favoredNodes));
|
" with favored nodes " + Bytes.toString(favoredNodes));
|
||||||
|
@ -462,7 +462,7 @@ public class NamespaceUpgrade implements Tool {
|
|||||||
// create a put for new _acl_ entry with rowkey as hbase:acl
|
// create a put for new _acl_ entry with rowkey as hbase:acl
|
||||||
Put p = new Put(AccessControlLists.ACL_GLOBAL_NAME);
|
Put p = new Put(AccessControlLists.ACL_GLOBAL_NAME);
|
||||||
for (Cell c : r.rawCells()) {
|
for (Cell c : r.rawCells()) {
|
||||||
p.add(CellUtil.cloneFamily(c), CellUtil.cloneQualifier(c), CellUtil.cloneValue(c));
|
p.addImmutable(CellUtil.cloneFamily(c), CellUtil.cloneQualifier(c), CellUtil.cloneValue(c));
|
||||||
}
|
}
|
||||||
region.put(p);
|
region.put(p);
|
||||||
// delete the old entry
|
// delete the old entry
|
||||||
|
@ -605,11 +605,11 @@ public class SplitTransaction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Put addLocation(final Put p, final ServerName sn, long openSeqNum) {
|
public Put addLocation(final Put p, final ServerName sn, long openSeqNum) {
|
||||||
p.add(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER,
|
p.addImmutable(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER,
|
||||||
Bytes.toBytes(sn.getHostAndPort()));
|
Bytes.toBytes(sn.getHostAndPort()));
|
||||||
p.add(HConstants.CATALOG_FAMILY, HConstants.STARTCODE_QUALIFIER,
|
p.addImmutable(HConstants.CATALOG_FAMILY, HConstants.STARTCODE_QUALIFIER,
|
||||||
Bytes.toBytes(sn.getStartcode()));
|
Bytes.toBytes(sn.getStartcode()));
|
||||||
p.add(HConstants.CATALOG_FAMILY, HConstants.SEQNUM_QUALIFIER,
|
p.addImmutable(HConstants.CATALOG_FAMILY, HConstants.SEQNUM_QUALIFIER,
|
||||||
Bytes.toBytes(openSeqNum));
|
Bytes.toBytes(openSeqNum));
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
@ -224,7 +224,7 @@ public class RowResource extends ResourceBase {
|
|||||||
.type(MIMETYPE_TEXT).entity("Bad request" + CRLF)
|
.type(MIMETYPE_TEXT).entity("Bad request" + CRLF)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
put.add(parts[0], parts[1], cell.getTimestamp(), cell.getValue());
|
put.addImmutable(parts[0], parts[1], cell.getTimestamp(), cell.getValue());
|
||||||
}
|
}
|
||||||
puts.add(put);
|
puts.add(put);
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
@ -293,7 +293,7 @@ public class RowResource extends ResourceBase {
|
|||||||
.type(MIMETYPE_TEXT).entity("Bad request" + CRLF)
|
.type(MIMETYPE_TEXT).entity("Bad request" + CRLF)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
put.add(parts[0], parts[1], timestamp, message);
|
put.addImmutable(parts[0], parts[1], timestamp, message);
|
||||||
table = servlet.getTable(tableResource.getName());
|
table = servlet.getTable(tableResource.getName());
|
||||||
table.put(put);
|
table.put(put);
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
@ -471,7 +471,7 @@ public class RowResource extends ResourceBase {
|
|||||||
.type(MIMETYPE_TEXT).entity("Bad request" + CRLF)
|
.type(MIMETYPE_TEXT).entity("Bad request" + CRLF)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
put.add(valueToPutParts[0], valueToPutParts[1], valueToPutCell
|
put.addImmutable(valueToPutParts[0], valueToPutParts[1], valueToPutCell
|
||||||
.getTimestamp(), valueToPutCell.getValue());
|
.getTimestamp(), valueToPutCell.getValue());
|
||||||
|
|
||||||
table = servlet.getTable(this.tableResource.getName());
|
table = servlet.getTable(this.tableResource.getName());
|
||||||
|
@ -157,7 +157,7 @@ public class AccessControlLists {
|
|||||||
for (int i = 0; i < actions.length; i++) {
|
for (int i = 0; i < actions.length; i++) {
|
||||||
value[i] = actions[i].code();
|
value[i] = actions[i].code();
|
||||||
}
|
}
|
||||||
p.add(ACL_LIST_FAMILY, key, value);
|
p.addImmutable(ACL_LIST_FAMILY, key, value);
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug("Writing permission with rowKey "+
|
LOG.debug("Writing permission with rowKey "+
|
||||||
Bytes.toString(rowKey)+" "+
|
Bytes.toString(rowKey)+" "+
|
||||||
|
@ -568,11 +568,12 @@ public class VisibilityController extends BaseRegionObserver implements MasterOb
|
|||||||
Map<String, List<Integer>> userAuths) throws IOException {
|
Map<String, List<Integer>> userAuths) throws IOException {
|
||||||
if (!labels.containsKey(SYSTEM_LABEL)) {
|
if (!labels.containsKey(SYSTEM_LABEL)) {
|
||||||
Put p = new Put(Bytes.toBytes(SYSTEM_LABEL_ORDINAL));
|
Put p = new Put(Bytes.toBytes(SYSTEM_LABEL_ORDINAL));
|
||||||
p.add(LABELS_TABLE_FAMILY, LABEL_QUALIFIER, Bytes.toBytes(SYSTEM_LABEL));
|
p.addImmutable(LABELS_TABLE_FAMILY, LABEL_QUALIFIER, Bytes.toBytes(SYSTEM_LABEL));
|
||||||
// Set auth for "system" label for all super users.
|
// Set auth for "system" label for all super users.
|
||||||
List<String> superUsers = getSystemAndSuperUsers();
|
List<String> superUsers = getSystemAndSuperUsers();
|
||||||
for (String superUser : superUsers) {
|
for (String superUser : superUsers) {
|
||||||
p.add(LABELS_TABLE_FAMILY, Bytes.toBytes(superUser), DUMMY_VALUE, LABELS_TABLE_TAGS);
|
p.addImmutable(
|
||||||
|
LABELS_TABLE_FAMILY, Bytes.toBytes(superUser), DUMMY_VALUE, LABELS_TABLE_TAGS);
|
||||||
}
|
}
|
||||||
region.put(p);
|
region.put(p);
|
||||||
labels.put(SYSTEM_LABEL, SYSTEM_LABEL_ORDINAL);
|
labels.put(SYSTEM_LABEL, SYSTEM_LABEL_ORDINAL);
|
||||||
@ -1037,7 +1038,8 @@ public class VisibilityController extends BaseRegionObserver implements MasterOb
|
|||||||
response.addResult(failureResultBuilder.build());
|
response.addResult(failureResultBuilder.build());
|
||||||
} else {
|
} else {
|
||||||
Put p = new Put(Bytes.toBytes(ordinalCounter));
|
Put p = new Put(Bytes.toBytes(ordinalCounter));
|
||||||
p.add(LABELS_TABLE_FAMILY, LABEL_QUALIFIER, label, LABELS_TABLE_TAGS);
|
p.addImmutable(
|
||||||
|
LABELS_TABLE_FAMILY, LABEL_QUALIFIER, label, LABELS_TABLE_TAGS);
|
||||||
puts.add(p);
|
puts.add(p);
|
||||||
ordinalCounter++;
|
ordinalCounter++;
|
||||||
response.addResult(successResult);
|
response.addResult(successResult);
|
||||||
@ -1127,7 +1129,8 @@ public class VisibilityController extends BaseRegionObserver implements MasterOb
|
|||||||
response.addResult(failureResultBuilder.build());
|
response.addResult(failureResultBuilder.build());
|
||||||
} else {
|
} else {
|
||||||
Put p = new Put(Bytes.toBytes(labelOrdinal));
|
Put p = new Put(Bytes.toBytes(labelOrdinal));
|
||||||
p.add(LABELS_TABLE_FAMILY, user, DUMMY_VALUE, LABELS_TABLE_TAGS);
|
p.addImmutable(
|
||||||
|
LABELS_TABLE_FAMILY, user, DUMMY_VALUE, LABELS_TABLE_TAGS);
|
||||||
puts.add(p);
|
puts.add(p);
|
||||||
response.addResult(successResult);
|
response.addResult(successResult);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,6 @@ import org.apache.hadoop.conf.Configuration;
|
|||||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||||
import org.apache.hadoop.hbase.MediumTests;
|
import org.apache.hadoop.hbase.MediumTests;
|
||||||
import org.apache.hadoop.hbase.Server;
|
|
||||||
import org.apache.hadoop.hbase.ServerName;
|
import org.apache.hadoop.hbase.ServerName;
|
||||||
import org.apache.hadoop.hbase.SplitLogCounters;
|
import org.apache.hadoop.hbase.SplitLogCounters;
|
||||||
import org.apache.hadoop.hbase.SplitLogTask;
|
import org.apache.hadoop.hbase.SplitLogTask;
|
||||||
@ -357,7 +356,7 @@ public class TestSplitLogWorker {
|
|||||||
SplitLogWorker slw = new SplitLogWorker(zkw, testConf, mockedRS, neverEndingTask);
|
SplitLogWorker slw = new SplitLogWorker(zkw, testConf, mockedRS, neverEndingTask);
|
||||||
slw.start();
|
slw.start();
|
||||||
try {
|
try {
|
||||||
waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 0, maxTasks, 3000);
|
waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 0, maxTasks, 6000);
|
||||||
for (int i = 0; i < maxTasks; i++) {
|
for (int i = 0; i < maxTasks; i++) {
|
||||||
byte[] bytes = ZKUtil.getData(zkw, ZKSplitLog.getEncodedNodeName(zkw, TATAS + i));
|
byte[] bytes = ZKUtil.getData(zkw, ZKSplitLog.getEncodedNodeName(zkw, TATAS + i));
|
||||||
SplitLogTask slt = SplitLogTask.parseFrom(bytes);
|
SplitLogTask slt = SplitLogTask.parseFrom(bytes);
|
||||||
@ -402,7 +401,7 @@ public class TestSplitLogWorker {
|
|||||||
slw.start();
|
slw.start();
|
||||||
try {
|
try {
|
||||||
int acquiredTasks = 0;
|
int acquiredTasks = 0;
|
||||||
waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 0, 2, 3000);
|
waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 0, 2, 6000);
|
||||||
for (int i = 0; i < maxTasks; i++) {
|
for (int i = 0; i < maxTasks; i++) {
|
||||||
byte[] bytes = ZKUtil.getData(zkw, ZKSplitLog.getEncodedNodeName(zkw, TATAS + i));
|
byte[] bytes = ZKUtil.getData(zkw, ZKSplitLog.getEncodedNodeName(zkw, TATAS + i));
|
||||||
SplitLogTask slt = SplitLogTask.parseFrom(bytes);
|
SplitLogTask slt = SplitLogTask.parseFrom(bytes);
|
||||||
|
@ -1033,7 +1033,7 @@ public class ThriftServerRunner implements Runnable {
|
|||||||
LOG.warn("No column qualifier specified. Delete is the only mutation supported "
|
LOG.warn("No column qualifier specified. Delete is the only mutation supported "
|
||||||
+ "over the whole column family.");
|
+ "over the whole column family.");
|
||||||
} else {
|
} else {
|
||||||
put.add(famAndQf[0], famAndQf[1],
|
put.addImmutable(famAndQf[0], famAndQf[1],
|
||||||
m.value != null ? getBytes(m.value)
|
m.value != null ? getBytes(m.value)
|
||||||
: HConstants.EMPTY_BYTE_ARRAY);
|
: HConstants.EMPTY_BYTE_ARRAY);
|
||||||
}
|
}
|
||||||
@ -1092,7 +1092,7 @@ public class ThriftServerRunner implements Runnable {
|
|||||||
+ "over the whole column family.");
|
+ "over the whole column family.");
|
||||||
}
|
}
|
||||||
if (famAndQf.length == 2) {
|
if (famAndQf.length == 2) {
|
||||||
put.add(famAndQf[0], famAndQf[1],
|
put.addImmutable(famAndQf[0], famAndQf[1],
|
||||||
m.value != null ? getBytes(m.value)
|
m.value != null ? getBytes(m.value)
|
||||||
: HConstants.EMPTY_BYTE_ARRAY);
|
: HConstants.EMPTY_BYTE_ARRAY);
|
||||||
} else {
|
} else {
|
||||||
|
@ -198,10 +198,12 @@ public class ThriftUtilities {
|
|||||||
|
|
||||||
for (TColumnValue columnValue : in.getColumnValues()) {
|
for (TColumnValue columnValue : in.getColumnValues()) {
|
||||||
if (columnValue.isSetTimestamp()) {
|
if (columnValue.isSetTimestamp()) {
|
||||||
out.add(columnValue.getFamily(), columnValue.getQualifier(), columnValue.getTimestamp(),
|
out.addImmutable(
|
||||||
|
columnValue.getFamily(), columnValue.getQualifier(), columnValue.getTimestamp(),
|
||||||
columnValue.getValue());
|
columnValue.getValue());
|
||||||
} else {
|
} else {
|
||||||
out.add(columnValue.getFamily(), columnValue.getQualifier(), columnValue.getValue());
|
out.addImmutable(
|
||||||
|
columnValue.getFamily(), columnValue.getQualifier(), columnValue.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user