public TRowMutations deepCopy() { return new TRowMutations(this); }
public static TRowMutations rowMutationsFromHBase(RowMutations in) { TRowMutations tRowMutations = new TRowMutations(); tRowMutations.setRow(in.getRow()); for (Mutation mutation : in.getMutations()) { TMutation tMutation = new TMutation(); if (mutation instanceof Put) { tMutation.setPut(ThriftUtilities.putFromHBase((Put)mutation)); } else if (mutation instanceof Delete) { tMutation.setDeleteSingle(ThriftUtilities.deleteFromHBase((Delete)mutation)); } else { throw new IllegalArgumentException( "Only Put and Delete is supported in mutateRow, but muation=" + mutation); } tRowMutations.addToMutations(tMutation); } return tRowMutations; }
@Test public void testMutateRowWithReadOnly() throws Exception { ThriftHBaseServiceHandler handler = createHandler(); byte[] rowName = Bytes.toBytes("testMutateRow"); ByteBuffer table = wrap(tableAname); List<TColumnValue> columnValuesA = new ArrayList<>(1); TColumnValue columnValueA = new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname)); columnValuesA.add(columnValueA); TPut putA = new TPut(wrap(rowName), columnValuesA); putA.setColumnValues(columnValuesA); TDelete delete = new TDelete(wrap(rowName)); List<TMutation> mutations = new ArrayList<>(2); TMutation mutationA = TMutation.put(putA); mutations.add(mutationA); TMutation mutationB = TMutation.deleteSingle(delete); mutations.add(mutationB); TRowMutations tRowMutations = new TRowMutations(wrap(rowName),mutations); boolean exceptionCaught = false; try { handler.mutateRow(table,tRowMutations); } catch (TIOError e) { exceptionCaught = true; assertTrue(e.getCause() instanceof DoNotRetryIOException); assertEquals("Thrift Server is in Read-only mode.", e.getMessage()); } finally { assertTrue(exceptionCaught); } }
@Test public void testCheckAndMutateWithReadOnly() throws Exception { ThriftHBaseServiceHandler handler = createHandler(); ByteBuffer table = wrap(tableAname); ByteBuffer row = wrap(Bytes.toBytes("row")); ByteBuffer family = wrap(familyAname); ByteBuffer qualifier = wrap(qualifierAname); ByteBuffer value = wrap(valueAname); List<TColumnValue> columnValuesB = new ArrayList<>(1); TColumnValue columnValueB = new TColumnValue(family, wrap(qualifierBname), wrap(valueBname)); columnValuesB.add(columnValueB); TPut putB = new TPut(row, columnValuesB); putB.setColumnValues(columnValuesB); TRowMutations tRowMutations = new TRowMutations(row, Arrays.<TMutation> asList(TMutation.put(putB))); boolean exceptionCaught = false; try { handler.checkAndMutate(table, row, family, qualifier, TCompareOp.EQUAL, value, tRowMutations); } catch (TIOError e) { exceptionCaught = true; assertTrue(e.getCause() instanceof DoNotRetryIOException); assertEquals("Thrift Server is in Read-only mode.", e.getMessage()); } finally { assertTrue(exceptionCaught); } }
public TRowMutations deepCopy() { return new TRowMutations(this); }
public TRowMutations deepCopy() { return new TRowMutations(this); }
mutations.add(mutationB); TRowMutations tRowMutations = new TRowMutations(wrap(rowName),mutations); handler.mutateRow(table,tRowMutations);
putB.setColumnValues(columnValuesB); TRowMutations tRowMutations = new TRowMutations(row, Arrays.<TMutation> asList(TMutation.put(putB)));
/** * Performs a deep copy on <i>other</i>. */ public mutateRow_args(mutateRow_args other) { if (other.isSetTable()) { this.table = org.apache.thrift.TBaseHelper.copyBinary(other.table); } if (other.isSetRowMutations()) { this.rowMutations = new TRowMutations(other.rowMutations); } }
/** * Performs a deep copy on <i>other</i>. */ public mutateRow_args(mutateRow_args other) { if (other.isSetTable()) { this.table = org.apache.thrift.TBaseHelper.copyBinary(other.table); } if (other.isSetRowMutations()) { this.rowMutations = new TRowMutations(other.rowMutations); } }
case 2: // ROW_MUTATIONS if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.rowMutations = new TRowMutations(); struct.rowMutations.read(iprot); struct.setRowMutationsIsSet(true);
case 2: // ROW_MUTATIONS if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.rowMutations = new TRowMutations(); struct.rowMutations.read(iprot); struct.setRowMutationsIsSet(true);
@Override public void read(org.apache.thrift.protocol.TProtocol prot, mutateRow_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.table = iprot.readBinary(); struct.setTableIsSet(true); struct.rowMutations = new TRowMutations(); struct.rowMutations.read(iprot); struct.setRowMutationsIsSet(true); } }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, mutateRow_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.table = iprot.readBinary(); struct.setTableIsSet(true); struct.rowMutations = new TRowMutations(); struct.rowMutations.read(iprot); struct.setRowMutationsIsSet(true); } }
public TRowMutations deepCopy() { return new TRowMutations(this); }
public TRowMutations deepCopy() { return new TRowMutations(this); }
/** * Performs a deep copy on <i>other</i>. */ public mutateRow_args(mutateRow_args other) { if (other.isSetTable()) { this.table = org.apache.thrift.TBaseHelper.copyBinary(other.table); } if (other.isSetTrowMutations()) { this.trowMutations = new TRowMutations(other.trowMutations); } }
/** * Performs a deep copy on <i>other</i>. */ public mutateRow_args(mutateRow_args other) { if (other.isSetTable()) { this.table = org.apache.thrift.TBaseHelper.copyBinary(other.table); } if (other.isSetTrowMutations()) { this.trowMutations = new TRowMutations(other.trowMutations); } }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, mutateRow_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.table = iprot.readBinary(); struct.setTableIsSet(true); struct.trowMutations = new TRowMutations(); struct.trowMutations.read(iprot); struct.setTrowMutationsIsSet(true); } }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, mutateRow_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.table = iprot.readBinary(); struct.setTableIsSet(true); struct.trowMutations = new TRowMutations(); struct.trowMutations.read(iprot); struct.setTrowMutationsIsSet(true); } }