You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2013/04/03 22:10:35 UTC
svn commit: r1464189 - in /accumulo/branches/1.5/proxy/src:
main/java/org/apache/accumulo/proxy/ProxyServer.java
main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java
main/thrift/proxy.thrift test/java/org/apache/accumulo/proxy/SimpleTest.java
Author: ecn
Date: Wed Apr 3 20:10:34 2013
New Revision: 1464189
URL: http://svn.apache.org/r1464189
Log:
ACCUMULO-1190 make update a oneway call again
Modified:
accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java
accumulo/branches/1.5/proxy/src/main/thrift/proxy.thrift
accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
Modified: accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java?rev=1464189&r1=1464188&r2=1464189&view=diff
==============================================================================
--- accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java (original)
+++ accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java Wed Apr 3 20:10:34 2013
@@ -104,11 +104,19 @@ public class ProxyServer implements Accu
public Iterator<Map.Entry<Key,Value>> iterator;
}
- static class CloseWriter implements RemovalListener<UUID,BatchWriter> {
+ static protected class BatchWriterPlusException {
+ public BatchWriter writer;
+ public MutationsRejectedException exception = null;
+ }
+
+ static class CloseWriter implements RemovalListener<UUID,BatchWriterPlusException> {
@Override
- public void onRemoval(RemovalNotification<UUID,BatchWriter> notification) {
+ public void onRemoval(RemovalNotification<UUID,BatchWriterPlusException> notification) {
try {
- notification.getValue().close();
+ BatchWriterPlusException value = notification.getValue();
+ if (value.exception != null)
+ throw value.exception;
+ notification.getValue().writer.close();
} catch (MutationsRejectedException e) {
logger.warn(e, e);
}
@@ -131,7 +139,7 @@ public class ProxyServer implements Accu
}
protected Cache<UUID,ScannerPlusIterator> scannerCache;
- protected Cache<UUID,BatchWriter> writerCache;
+ protected Cache<UUID,BatchWriterPlusException> writerCache;
public ProxyServer(Properties props) {
@@ -904,10 +912,12 @@ public class ProxyServer implements Accu
@Override
public void updateAndFlush(ByteBuffer login, String tableName, Map<ByteBuffer,List<ColumnUpdate>> cells) throws TException {
try {
- BatchWriter writer = getWriter(login, tableName, null);
- addCellsToWriter(cells, writer);
- writer.flush();
- writer.close();
+ BatchWriterPlusException bwpe = getWriter(login, tableName, null);
+ addCellsToWriter(cells, bwpe);
+ if (bwpe.exception != null)
+ throw bwpe.exception;
+ bwpe.writer.flush();
+ bwpe.writer.close();
} catch (Exception e) {
throw translateException(e);
}
@@ -915,7 +925,10 @@ public class ProxyServer implements Accu
private static final ColumnVisibility EMPTY_VIS = new ColumnVisibility();
- private void addCellsToWriter(Map<ByteBuffer,List<ColumnUpdate>> cells, BatchWriter writer) throws MutationsRejectedException {
+ private void addCellsToWriter(Map<ByteBuffer,List<ColumnUpdate>> cells, BatchWriterPlusException bwpe) throws MutationsRejectedException {
+ if (bwpe.exception != null)
+ return;
+
HashMap<Text,ColumnVisibility> vizMap = new HashMap<Text,ColumnVisibility>();
for (Entry<ByteBuffer,List<ColumnUpdate>> entry : cells.entrySet()) {
@@ -947,14 +960,18 @@ public class ProxyServer implements Accu
m.put(update.getColFamily(), update.getColQualifier(), viz, value);
}
}
- writer.addMutation(m);
+ try {
+ bwpe.writer.addMutation(m);
+ } catch (MutationsRejectedException mre) {
+ bwpe.exception = mre;
+ }
}
}
@Override
public String createWriter(ByteBuffer login, String tableName, WriterOptions opts) throws TException {
try {
- BatchWriter writer = getWriter(login, tableName, opts);
+ BatchWriterPlusException writer = getWriter(login, tableName, opts);
UUID uuid = UUID.randomUUID();
writerCache.put(uuid, writer);
return uuid.toString();
@@ -966,11 +983,11 @@ public class ProxyServer implements Accu
@Override
public void update(String writer, Map<ByteBuffer,List<ColumnUpdate>> cells) throws TException {
try {
- BatchWriter batchwriter = writerCache.getIfPresent(UUID.fromString(writer));
- if (batchwriter == null) {
+ BatchWriterPlusException bwpe = writerCache.getIfPresent(UUID.fromString(writer));
+ if (bwpe == null) {
throw new UnknownWriter("Writer never existed or no longer exists");
}
- addCellsToWriter(cells, batchwriter);
+ addCellsToWriter(cells, bwpe);
} catch (Exception e) {
throw translateException(e);
}
@@ -979,11 +996,13 @@ public class ProxyServer implements Accu
@Override
public void flush(String writer) throws TException {
try {
- BatchWriter batchwriter = writerCache.getIfPresent(UUID.fromString(writer));
- if (batchwriter == null) {
+ BatchWriterPlusException bwpe = writerCache.getIfPresent(UUID.fromString(writer));
+ if (bwpe == null) {
throw new UnknownWriter("Writer never existed or no longer exists");
}
- batchwriter.flush();
+ if (bwpe.exception != null)
+ throw bwpe.exception;
+ bwpe.writer.flush();
} catch (Exception e) {
throw translateException(e);
}
@@ -992,18 +1011,20 @@ public class ProxyServer implements Accu
@Override
public void closeWriter(String writer) throws TException {
try {
- BatchWriter batchwriter = writerCache.getIfPresent(UUID.fromString(writer));
- if (batchwriter == null) {
+ BatchWriterPlusException bwpe = writerCache.getIfPresent(UUID.fromString(writer));
+ if (bwpe == null) {
throw new UnknownWriter("Writer never existed or no longer exists");
}
- batchwriter.close();
+ if (bwpe.exception != null)
+ throw bwpe.exception;
+ bwpe.writer.close();
writerCache.invalidate(UUID.fromString(writer));
} catch (Exception e) {
throw translateException(e);
}
}
- private BatchWriter getWriter(ByteBuffer login, String tableName, WriterOptions opts) throws Exception {
+ private BatchWriterPlusException getWriter(ByteBuffer login, String tableName, WriterOptions opts) throws Exception {
BatchWriterConfig cfg = new BatchWriterConfig();
if (opts != null) {
if (opts.maxMemory != 0)
@@ -1015,7 +1036,9 @@ public class ProxyServer implements Accu
if (opts.latencyMs != 0)
cfg.setMaxLatency(opts.latencyMs, TimeUnit.MILLISECONDS);
}
- return getConnector(login).createBatchWriter(tableName, cfg);
+ BatchWriterPlusException result = new BatchWriterPlusException();
+ result.writer = getConnector(login).createBatchWriter(tableName, cfg);
+ return result;
}
private IteratorSetting getIteratorSetting(org.apache.accumulo.proxy.thrift.IteratorSetting setting) {
Modified: accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java?rev=1464189&r1=1464188&r2=1464189&view=diff
==============================================================================
--- accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java (original)
+++ accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java Wed Apr 3 20:10:34 2013
@@ -182,7 +182,7 @@ import org.slf4j.LoggerFactory;
public String createWriter(ByteBuffer login, String tableName, WriterOptions opts) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, org.apache.thrift.TException;
- public void update(String writer, Map<ByteBuffer,List<ColumnUpdate>> cells) throws UnknownWriter, MutationsRejectedException, org.apache.thrift.TException;
+ public void update(String writer, Map<ByteBuffer,List<ColumnUpdate>> cells) throws org.apache.thrift.TException;
public void flush(String writer) throws UnknownWriter, MutationsRejectedException, org.apache.thrift.TException;
@@ -2358,10 +2358,9 @@ import org.slf4j.LoggerFactory;
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "createWriter failed: unknown result");
}
- public void update(String writer, Map<ByteBuffer,List<ColumnUpdate>> cells) throws UnknownWriter, MutationsRejectedException, org.apache.thrift.TException
+ public void update(String writer, Map<ByteBuffer,List<ColumnUpdate>> cells) throws org.apache.thrift.TException
{
send_update(writer, cells);
- recv_update();
}
public void send_update(String writer, Map<ByteBuffer,List<ColumnUpdate>> cells) throws org.apache.thrift.TException
@@ -2372,19 +2371,6 @@ import org.slf4j.LoggerFactory;
sendBase("update", args);
}
- public void recv_update() throws UnknownWriter, MutationsRejectedException, org.apache.thrift.TException
- {
- update_result result = new update_result();
- receiveBase(result, "update");
- if (result.ouch1 != null) {
- throw result.ouch1;
- }
- if (result.ouch2 != null) {
- throw result.ouch2;
- }
- return;
- }
-
public void flush(String writer) throws UnknownWriter, MutationsRejectedException, org.apache.thrift.TException
{
send_flush(writer);
@@ -4994,7 +4980,7 @@ import org.slf4j.LoggerFactory;
private String writer;
private Map<ByteBuffer,List<ColumnUpdate>> cells;
public update_call(String writer, Map<ByteBuffer,List<ColumnUpdate>> cells, org.apache.thrift.async.AsyncMethodCallback<update_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
+ super(client, protocolFactory, transport, resultHandler, true);
this.writer = writer;
this.cells = cells;
}
@@ -5008,13 +4994,12 @@ import org.slf4j.LoggerFactory;
prot.writeMessageEnd();
}
- public void getResult() throws UnknownWriter, MutationsRejectedException, org.apache.thrift.TException {
+ public void getResult() throws org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- (new Client(prot)).recv_update();
}
}
@@ -7007,19 +6992,12 @@ import org.slf4j.LoggerFactory;
}
protected boolean isOneway() {
- return false;
+ return true;
}
- public update_result getResult(I iface, update_args args) throws org.apache.thrift.TException {
- update_result result = new update_result();
- try {
- iface.update(args.writer, args.cells);
- } catch (UnknownWriter ouch1) {
- result.ouch1 = ouch1;
- } catch (MutationsRejectedException ouch2) {
- result.ouch2 = ouch2;
- }
- return result;
+ public org.apache.thrift.TBase getResult(I iface, update_args args) throws org.apache.thrift.TException {
+ iface.update(args.writer, args.cells);
+ return null;
}
}
@@ -81630,464 +81608,6 @@ import org.slf4j.LoggerFactory;
}
- public static class update_result implements org.apache.thrift.TBase<update_result, update_result._Fields>, java.io.Serializable, Cloneable {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("update_result");
-
- private static final org.apache.thrift.protocol.TField OUCH1_FIELD_DESC = new org.apache.thrift.protocol.TField("ouch1", org.apache.thrift.protocol.TType.STRUCT, (short)1);
- private static final org.apache.thrift.protocol.TField OUCH2_FIELD_DESC = new org.apache.thrift.protocol.TField("ouch2", org.apache.thrift.protocol.TType.STRUCT, (short)2);
-
- private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
- static {
- schemes.put(StandardScheme.class, new update_resultStandardSchemeFactory());
- schemes.put(TupleScheme.class, new update_resultTupleSchemeFactory());
- }
-
- public UnknownWriter ouch1; // required
- public MutationsRejectedException ouch2; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- OUCH1((short)1, "ouch1"),
- OUCH2((short)2, "ouch2");
-
- private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
- static {
- for (_Fields field : EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // OUCH1
- return OUCH1;
- case 2: // OUCH2
- return OUCH2;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.OUCH1, new org.apache.thrift.meta_data.FieldMetaData("ouch1", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
- tmpMap.put(_Fields.OUCH2, new org.apache.thrift.meta_data.FieldMetaData("ouch2", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
- metaDataMap = Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(update_result.class, metaDataMap);
- }
-
- public update_result() {
- }
-
- public update_result(
- UnknownWriter ouch1,
- MutationsRejectedException ouch2)
- {
- this();
- this.ouch1 = ouch1;
- this.ouch2 = ouch2;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public update_result(update_result other) {
- if (other.isSetOuch1()) {
- this.ouch1 = new UnknownWriter(other.ouch1);
- }
- if (other.isSetOuch2()) {
- this.ouch2 = new MutationsRejectedException(other.ouch2);
- }
- }
-
- public update_result deepCopy() {
- return new update_result(this);
- }
-
- @Override
- public void clear() {
- this.ouch1 = null;
- this.ouch2 = null;
- }
-
- public UnknownWriter getOuch1() {
- return this.ouch1;
- }
-
- public update_result setOuch1(UnknownWriter ouch1) {
- this.ouch1 = ouch1;
- return this;
- }
-
- public void unsetOuch1() {
- this.ouch1 = null;
- }
-
- /** Returns true if field ouch1 is set (has been assigned a value) and false otherwise */
- public boolean isSetOuch1() {
- return this.ouch1 != null;
- }
-
- public void setOuch1IsSet(boolean value) {
- if (!value) {
- this.ouch1 = null;
- }
- }
-
- public MutationsRejectedException getOuch2() {
- return this.ouch2;
- }
-
- public update_result setOuch2(MutationsRejectedException ouch2) {
- this.ouch2 = ouch2;
- return this;
- }
-
- public void unsetOuch2() {
- this.ouch2 = null;
- }
-
- /** Returns true if field ouch2 is set (has been assigned a value) and false otherwise */
- public boolean isSetOuch2() {
- return this.ouch2 != null;
- }
-
- public void setOuch2IsSet(boolean value) {
- if (!value) {
- this.ouch2 = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case OUCH1:
- if (value == null) {
- unsetOuch1();
- } else {
- setOuch1((UnknownWriter)value);
- }
- break;
-
- case OUCH2:
- if (value == null) {
- unsetOuch2();
- } else {
- setOuch2((MutationsRejectedException)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case OUCH1:
- return getOuch1();
-
- case OUCH2:
- return getOuch2();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case OUCH1:
- return isSetOuch1();
- case OUCH2:
- return isSetOuch2();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof update_result)
- return this.equals((update_result)that);
- return false;
- }
-
- public boolean equals(update_result that) {
- if (that == null)
- return false;
-
- boolean this_present_ouch1 = true && this.isSetOuch1();
- boolean that_present_ouch1 = true && that.isSetOuch1();
- if (this_present_ouch1 || that_present_ouch1) {
- if (!(this_present_ouch1 && that_present_ouch1))
- return false;
- if (!this.ouch1.equals(that.ouch1))
- return false;
- }
-
- boolean this_present_ouch2 = true && this.isSetOuch2();
- boolean that_present_ouch2 = true && that.isSetOuch2();
- if (this_present_ouch2 || that_present_ouch2) {
- if (!(this_present_ouch2 && that_present_ouch2))
- return false;
- if (!this.ouch2.equals(that.ouch2))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return 0;
- }
-
- public int compareTo(update_result other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
- update_result typedOther = (update_result)other;
-
- lastComparison = Boolean.valueOf(isSetOuch1()).compareTo(typedOther.isSetOuch1());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetOuch1()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ouch1, typedOther.ouch1);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetOuch2()).compareTo(typedOther.isSetOuch2());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetOuch2()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ouch2, typedOther.ouch2);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("update_result(");
- boolean first = true;
-
- sb.append("ouch1:");
- if (this.ouch1 == null) {
- sb.append("null");
- } else {
- sb.append(this.ouch1);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("ouch2:");
- if (this.ouch2 == null) {
- sb.append("null");
- } else {
- sb.append(this.ouch2);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- // check for sub-struct validity
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class update_resultStandardSchemeFactory implements SchemeFactory {
- public update_resultStandardScheme getScheme() {
- return new update_resultStandardScheme();
- }
- }
-
- private static class update_resultStandardScheme extends StandardScheme<update_result> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, update_result struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // OUCH1
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.ouch1 = new UnknownWriter();
- struct.ouch1.read(iprot);
- struct.setOuch1IsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // OUCH2
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.ouch2 = new MutationsRejectedException();
- struct.ouch2.read(iprot);
- struct.setOuch2IsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- struct.validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot, update_result struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.ouch1 != null) {
- oprot.writeFieldBegin(OUCH1_FIELD_DESC);
- struct.ouch1.write(oprot);
- oprot.writeFieldEnd();
- }
- if (struct.ouch2 != null) {
- oprot.writeFieldBegin(OUCH2_FIELD_DESC);
- struct.ouch2.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class update_resultTupleSchemeFactory implements SchemeFactory {
- public update_resultTupleScheme getScheme() {
- return new update_resultTupleScheme();
- }
- }
-
- private static class update_resultTupleScheme extends TupleScheme<update_result> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, update_result struct) throws org.apache.thrift.TException {
- TTupleProtocol oprot = (TTupleProtocol) prot;
- BitSet optionals = new BitSet();
- if (struct.isSetOuch1()) {
- optionals.set(0);
- }
- if (struct.isSetOuch2()) {
- optionals.set(1);
- }
- oprot.writeBitSet(optionals, 2);
- if (struct.isSetOuch1()) {
- struct.ouch1.write(oprot);
- }
- if (struct.isSetOuch2()) {
- struct.ouch2.write(oprot);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, update_result struct) throws org.apache.thrift.TException {
- TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(2);
- if (incoming.get(0)) {
- struct.ouch1 = new UnknownWriter();
- struct.ouch1.read(iprot);
- struct.setOuch1IsSet(true);
- }
- if (incoming.get(1)) {
- struct.ouch2 = new MutationsRejectedException();
- struct.ouch2.read(iprot);
- struct.setOuch2IsSet(true);
- }
- }
- }
-
- }
-
public static class flush_args implements org.apache.thrift.TBase<flush_args, flush_args._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("flush_args");
Modified: accumulo/branches/1.5/proxy/src/main/thrift/proxy.thrift
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/proxy/src/main/thrift/proxy.thrift?rev=1464189&r1=1464188&r2=1464189&view=diff
==============================================================================
--- accumulo/branches/1.5/proxy/src/main/thrift/proxy.thrift (original)
+++ accumulo/branches/1.5/proxy/src/main/thrift/proxy.thrift Wed Apr 3 20:10:34 2013
@@ -330,7 +330,7 @@ service AccumuloProxy
string createWriter(1:binary login, 2:string tableName, 3:WriterOptions opts) throws(1:AccumuloException outch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
// use the writer
- void update(1:string writer, 2:map<binary, list<ColumnUpdate>> cells) throws (1:UnknownWriter ouch1, 2:MutationsRejectedException ouch2);
+ oneway void update(1:string writer, 2:map<binary, list<ColumnUpdate>> cells);
void flush(1:string writer) throws (1:UnknownWriter ouch1, 2:MutationsRejectedException ouch2);
void closeWriter(1:string writer) throws (1:UnknownWriter ouch1, 2:MutationsRejectedException ouch2);
Modified: accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java?rev=1464189&r1=1464188&r2=1464189&view=diff
==============================================================================
--- accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java (original)
+++ accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java Wed Apr 3 20:10:34 2013
@@ -334,11 +334,8 @@ public class SimpleTest {
writerOptions.setTimeoutMs(100000);
String batchWriter = client.createWriter(creds, TABLE_TEST, writerOptions);
- try {
- client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
- client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
- fail("constraint did not fire");
- } catch (MutationsRejectedException ex) {}
+ client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
+ client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
try {
client.flush(batchWriter);
fail("constraint did not fire");