HBASE-26025 Add a flag to mark if the IOError can be solved by retry in thrift IOError (#3429)

Signed-off-by: Reid Chan <reidchan@apache.org>
This commit is contained in:
YutSean 2021-06-28 10:25:42 +08:00 committed by GitHub
parent fd2f8a581f
commit b2f8ec993e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 248 additions and 44 deletions

View File

@ -33,6 +33,7 @@ import java.util.TreeMap;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.DoNotRetryIOException;
import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HRegionInfo;
@ -1220,6 +1221,7 @@ public class ThriftHBaseServiceHandler extends HBaseServiceHandler implements Hb
private static IOError getIOError(Throwable throwable) { private static IOError getIOError(Throwable throwable) {
IOError error = new IOErrorWithCause(throwable); IOError error = new IOErrorWithCause(throwable);
error.setMessage(Throwables.getStackTraceAsString(throwable)); error.setMessage(Throwables.getStackTraceAsString(throwable));
error.setCanRetry(!(throwable instanceof DoNotRetryIOException));
return error; return error;
} }

View File

@ -17,15 +17,18 @@ public class IOError extends org.apache.thrift.TException implements org.apache.
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("IOError"); private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("IOError");
private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField CAN_RETRY_FIELD_DESC = new org.apache.thrift.protocol.TField("canRetry", org.apache.thrift.protocol.TType.BOOL, (short)2);
private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new IOErrorStandardSchemeFactory(); private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new IOErrorStandardSchemeFactory();
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new IOErrorTupleSchemeFactory(); private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new IOErrorTupleSchemeFactory();
public @org.apache.thrift.annotation.Nullable java.lang.String message; // required public @org.apache.thrift.annotation.Nullable java.lang.String message; // required
public boolean canRetry; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum { public enum _Fields implements org.apache.thrift.TFieldIdEnum {
MESSAGE((short)1, "message"); MESSAGE((short)1, "message"),
CAN_RETRY((short)2, "canRetry");
private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>(); private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
@ -43,6 +46,8 @@ public class IOError extends org.apache.thrift.TException implements org.apache.
switch(fieldId) { switch(fieldId) {
case 1: // MESSAGE case 1: // MESSAGE
return MESSAGE; return MESSAGE;
case 2: // CAN_RETRY
return CAN_RETRY;
default: default:
return null; return null;
} }
@ -84,11 +89,15 @@ public class IOError extends org.apache.thrift.TException implements org.apache.
} }
// isset id assignments // isset id assignments
private static final int __CANRETRY_ISSET_ID = 0;
private byte __isset_bitfield = 0;
public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static { static {
java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT, tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.CAN_RETRY, new org.apache.thrift.meta_data.FieldMetaData("canRetry", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(IOError.class, metaDataMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(IOError.class, metaDataMap);
} }
@ -97,19 +106,24 @@ public class IOError extends org.apache.thrift.TException implements org.apache.
} }
public IOError( public IOError(
java.lang.String message) java.lang.String message,
boolean canRetry)
{ {
this(); this();
this.message = message; this.message = message;
this.canRetry = canRetry;
setCanRetryIsSet(true);
} }
/** /**
* Performs a deep copy on <i>other</i>. * Performs a deep copy on <i>other</i>.
*/ */
public IOError(IOError other) { public IOError(IOError other) {
__isset_bitfield = other.__isset_bitfield;
if (other.isSetMessage()) { if (other.isSetMessage()) {
this.message = other.message; this.message = other.message;
} }
this.canRetry = other.canRetry;
} }
public IOError deepCopy() { public IOError deepCopy() {
@ -119,6 +133,8 @@ public class IOError extends org.apache.thrift.TException implements org.apache.
@Override @Override
public void clear() { public void clear() {
this.message = null; this.message = null;
setCanRetryIsSet(false);
this.canRetry = false;
} }
@org.apache.thrift.annotation.Nullable @org.apache.thrift.annotation.Nullable
@ -146,6 +162,29 @@ public class IOError extends org.apache.thrift.TException implements org.apache.
} }
} }
public boolean isCanRetry() {
return this.canRetry;
}
public IOError setCanRetry(boolean canRetry) {
this.canRetry = canRetry;
setCanRetryIsSet(true);
return this;
}
public void unsetCanRetry() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __CANRETRY_ISSET_ID);
}
/** Returns true if field canRetry is set (has been assigned a value) and false otherwise */
public boolean isSetCanRetry() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __CANRETRY_ISSET_ID);
}
public void setCanRetryIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __CANRETRY_ISSET_ID, value);
}
public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
switch (field) { switch (field) {
case MESSAGE: case MESSAGE:
@ -156,6 +195,14 @@ public class IOError extends org.apache.thrift.TException implements org.apache.
} }
break; break;
case CAN_RETRY:
if (value == null) {
unsetCanRetry();
} else {
setCanRetry((java.lang.Boolean)value);
}
break;
} }
} }
@ -165,6 +212,9 @@ public class IOError extends org.apache.thrift.TException implements org.apache.
case MESSAGE: case MESSAGE:
return getMessage(); return getMessage();
case CAN_RETRY:
return isCanRetry();
} }
throw new java.lang.IllegalStateException(); throw new java.lang.IllegalStateException();
} }
@ -178,14 +228,14 @@ public class IOError extends org.apache.thrift.TException implements org.apache.
switch (field) { switch (field) {
case MESSAGE: case MESSAGE:
return isSetMessage(); return isSetMessage();
case CAN_RETRY:
return isSetCanRetry();
} }
throw new java.lang.IllegalStateException(); throw new java.lang.IllegalStateException();
} }
@Override @Override
public boolean equals(java.lang.Object that) { public boolean equals(java.lang.Object that) {
if (that == null)
return false;
if (that instanceof IOError) if (that instanceof IOError)
return this.equals((IOError)that); return this.equals((IOError)that);
return false; return false;
@ -206,6 +256,15 @@ public class IOError extends org.apache.thrift.TException implements org.apache.
return false; return false;
} }
boolean this_present_canRetry = true;
boolean that_present_canRetry = true;
if (this_present_canRetry || that_present_canRetry) {
if (!(this_present_canRetry && that_present_canRetry))
return false;
if (this.canRetry != that.canRetry)
return false;
}
return true; return true;
} }
@ -217,6 +276,8 @@ public class IOError extends org.apache.thrift.TException implements org.apache.
if (isSetMessage()) if (isSetMessage())
hashCode = hashCode * 8191 + message.hashCode(); hashCode = hashCode * 8191 + message.hashCode();
hashCode = hashCode * 8191 + ((canRetry) ? 131071 : 524287);
return hashCode; return hashCode;
} }
@ -228,7 +289,7 @@ public class IOError extends org.apache.thrift.TException implements org.apache.
int lastComparison = 0; int lastComparison = 0;
lastComparison = java.lang.Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage()); lastComparison = java.lang.Boolean.compare(isSetMessage(), other.isSetMessage());
if (lastComparison != 0) { if (lastComparison != 0) {
return lastComparison; return lastComparison;
} }
@ -238,6 +299,16 @@ public class IOError extends org.apache.thrift.TException implements org.apache.
return lastComparison; return lastComparison;
} }
} }
lastComparison = java.lang.Boolean.compare(isSetCanRetry(), other.isSetCanRetry());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCanRetry()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.canRetry, other.canRetry);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0; return 0;
} }
@ -266,6 +337,10 @@ public class IOError extends org.apache.thrift.TException implements org.apache.
sb.append(this.message); sb.append(this.message);
} }
first = false; first = false;
if (!first) sb.append(", ");
sb.append("canRetry:");
sb.append(this.canRetry);
first = false;
sb.append(")"); sb.append(")");
return sb.toString(); return sb.toString();
} }
@ -285,6 +360,8 @@ public class IOError extends org.apache.thrift.TException implements org.apache.
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
try { try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) { } catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te); throw new java.io.IOException(te);
@ -317,6 +394,14 @@ public class IOError extends org.apache.thrift.TException implements org.apache.
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
} }
break; break;
case 2: // CAN_RETRY
if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
struct.canRetry = iprot.readBool();
struct.setCanRetryIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default: default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
} }
@ -337,6 +422,9 @@ public class IOError extends org.apache.thrift.TException implements org.apache.
oprot.writeString(struct.message); oprot.writeString(struct.message);
oprot.writeFieldEnd(); oprot.writeFieldEnd();
} }
oprot.writeFieldBegin(CAN_RETRY_FIELD_DESC);
oprot.writeBool(struct.canRetry);
oprot.writeFieldEnd();
oprot.writeFieldStop(); oprot.writeFieldStop();
oprot.writeStructEnd(); oprot.writeStructEnd();
} }
@ -358,20 +446,30 @@ public class IOError extends org.apache.thrift.TException implements org.apache.
if (struct.isSetMessage()) { if (struct.isSetMessage()) {
optionals.set(0); optionals.set(0);
} }
oprot.writeBitSet(optionals, 1); if (struct.isSetCanRetry()) {
optionals.set(1);
}
oprot.writeBitSet(optionals, 2);
if (struct.isSetMessage()) { if (struct.isSetMessage()) {
oprot.writeString(struct.message); oprot.writeString(struct.message);
} }
if (struct.isSetCanRetry()) {
oprot.writeBool(struct.canRetry);
}
} }
@Override @Override
public void read(org.apache.thrift.protocol.TProtocol prot, IOError struct) throws org.apache.thrift.TException { public void read(org.apache.thrift.protocol.TProtocol prot, IOError struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
java.util.BitSet incoming = iprot.readBitSet(1); java.util.BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) { if (incoming.get(0)) {
struct.message = iprot.readString(); struct.message = iprot.readString();
struct.setMessageIsSet(true); struct.setMessageIsSet(true);
} }
if (incoming.get(1)) {
struct.canRetry = iprot.readBool();
struct.setCanRetryIsSet(true);
}
} }
} }

View File

@ -175,6 +175,7 @@ public class ThriftHBaseServiceHandler extends HBaseServiceHandler implements TH
private TIOError getTIOError(IOException e) { private TIOError getTIOError(IOException e) {
TIOError err = new TIOErrorWithCause(e); TIOError err = new TIOErrorWithCause(e);
err.setMessage(e.getMessage()); err.setMessage(e.getMessage());
err.setCanRetry(!(e instanceof DoNotRetryIOException));
return err; return err;
} }

View File

@ -17,15 +17,18 @@ public class TIOError extends org.apache.thrift.TException implements org.apache
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TIOError"); private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TIOError");
private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField CAN_RETRY_FIELD_DESC = new org.apache.thrift.protocol.TField("canRetry", org.apache.thrift.protocol.TType.BOOL, (short)2);
private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new TIOErrorStandardSchemeFactory(); private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new TIOErrorStandardSchemeFactory();
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new TIOErrorTupleSchemeFactory(); private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new TIOErrorTupleSchemeFactory();
public @org.apache.thrift.annotation.Nullable java.lang.String message; // optional public @org.apache.thrift.annotation.Nullable java.lang.String message; // optional
public boolean canRetry; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum { public enum _Fields implements org.apache.thrift.TFieldIdEnum {
MESSAGE((short)1, "message"); MESSAGE((short)1, "message"),
CAN_RETRY((short)2, "canRetry");
private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>(); private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
@ -43,6 +46,8 @@ public class TIOError extends org.apache.thrift.TException implements org.apache
switch(fieldId) { switch(fieldId) {
case 1: // MESSAGE case 1: // MESSAGE
return MESSAGE; return MESSAGE;
case 2: // CAN_RETRY
return CAN_RETRY;
default: default:
return null; return null;
} }
@ -84,12 +89,16 @@ public class TIOError extends org.apache.thrift.TException implements org.apache
} }
// isset id assignments // isset id assignments
private static final _Fields optionals[] = {_Fields.MESSAGE}; private static final int __CANRETRY_ISSET_ID = 0;
private byte __isset_bitfield = 0;
private static final _Fields optionals[] = {_Fields.MESSAGE,_Fields.CAN_RETRY};
public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static { static {
java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.OPTIONAL, tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.CAN_RETRY, new org.apache.thrift.meta_data.FieldMetaData("canRetry", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TIOError.class, metaDataMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TIOError.class, metaDataMap);
} }
@ -101,9 +110,11 @@ public class TIOError extends org.apache.thrift.TException implements org.apache
* Performs a deep copy on <i>other</i>. * Performs a deep copy on <i>other</i>.
*/ */
public TIOError(TIOError other) { public TIOError(TIOError other) {
__isset_bitfield = other.__isset_bitfield;
if (other.isSetMessage()) { if (other.isSetMessage()) {
this.message = other.message; this.message = other.message;
} }
this.canRetry = other.canRetry;
} }
public TIOError deepCopy() { public TIOError deepCopy() {
@ -113,6 +124,8 @@ public class TIOError extends org.apache.thrift.TException implements org.apache
@Override @Override
public void clear() { public void clear() {
this.message = null; this.message = null;
setCanRetryIsSet(false);
this.canRetry = false;
} }
@org.apache.thrift.annotation.Nullable @org.apache.thrift.annotation.Nullable
@ -140,6 +153,29 @@ public class TIOError extends org.apache.thrift.TException implements org.apache
} }
} }
public boolean isCanRetry() {
return this.canRetry;
}
public TIOError setCanRetry(boolean canRetry) {
this.canRetry = canRetry;
setCanRetryIsSet(true);
return this;
}
public void unsetCanRetry() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __CANRETRY_ISSET_ID);
}
/** Returns true if field canRetry is set (has been assigned a value) and false otherwise */
public boolean isSetCanRetry() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __CANRETRY_ISSET_ID);
}
public void setCanRetryIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __CANRETRY_ISSET_ID, value);
}
public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
switch (field) { switch (field) {
case MESSAGE: case MESSAGE:
@ -150,6 +186,14 @@ public class TIOError extends org.apache.thrift.TException implements org.apache
} }
break; break;
case CAN_RETRY:
if (value == null) {
unsetCanRetry();
} else {
setCanRetry((java.lang.Boolean)value);
}
break;
} }
} }
@ -159,6 +203,9 @@ public class TIOError extends org.apache.thrift.TException implements org.apache
case MESSAGE: case MESSAGE:
return getMessage(); return getMessage();
case CAN_RETRY:
return isCanRetry();
} }
throw new java.lang.IllegalStateException(); throw new java.lang.IllegalStateException();
} }
@ -172,14 +219,14 @@ public class TIOError extends org.apache.thrift.TException implements org.apache
switch (field) { switch (field) {
case MESSAGE: case MESSAGE:
return isSetMessage(); return isSetMessage();
case CAN_RETRY:
return isSetCanRetry();
} }
throw new java.lang.IllegalStateException(); throw new java.lang.IllegalStateException();
} }
@Override @Override
public boolean equals(java.lang.Object that) { public boolean equals(java.lang.Object that) {
if (that == null)
return false;
if (that instanceof TIOError) if (that instanceof TIOError)
return this.equals((TIOError)that); return this.equals((TIOError)that);
return false; return false;
@ -200,6 +247,15 @@ public class TIOError extends org.apache.thrift.TException implements org.apache
return false; return false;
} }
boolean this_present_canRetry = true && this.isSetCanRetry();
boolean that_present_canRetry = true && that.isSetCanRetry();
if (this_present_canRetry || that_present_canRetry) {
if (!(this_present_canRetry && that_present_canRetry))
return false;
if (this.canRetry != that.canRetry)
return false;
}
return true; return true;
} }
@ -211,6 +267,10 @@ public class TIOError extends org.apache.thrift.TException implements org.apache
if (isSetMessage()) if (isSetMessage())
hashCode = hashCode * 8191 + message.hashCode(); hashCode = hashCode * 8191 + message.hashCode();
hashCode = hashCode * 8191 + ((isSetCanRetry()) ? 131071 : 524287);
if (isSetCanRetry())
hashCode = hashCode * 8191 + ((canRetry) ? 131071 : 524287);
return hashCode; return hashCode;
} }
@ -222,7 +282,7 @@ public class TIOError extends org.apache.thrift.TException implements org.apache
int lastComparison = 0; int lastComparison = 0;
lastComparison = java.lang.Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage()); lastComparison = java.lang.Boolean.compare(isSetMessage(), other.isSetMessage());
if (lastComparison != 0) { if (lastComparison != 0) {
return lastComparison; return lastComparison;
} }
@ -232,6 +292,16 @@ public class TIOError extends org.apache.thrift.TException implements org.apache
return lastComparison; return lastComparison;
} }
} }
lastComparison = java.lang.Boolean.compare(isSetCanRetry(), other.isSetCanRetry());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCanRetry()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.canRetry, other.canRetry);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0; return 0;
} }
@ -262,6 +332,12 @@ public class TIOError extends org.apache.thrift.TException implements org.apache
} }
first = false; first = false;
} }
if (isSetCanRetry()) {
if (!first) sb.append(", ");
sb.append("canRetry:");
sb.append(this.canRetry);
first = false;
}
sb.append(")"); sb.append(")");
return sb.toString(); return sb.toString();
} }
@ -281,6 +357,8 @@ public class TIOError extends org.apache.thrift.TException implements org.apache
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
try { try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) { } catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te); throw new java.io.IOException(te);
@ -313,6 +391,14 @@ public class TIOError extends org.apache.thrift.TException implements org.apache
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
} }
break; break;
case 2: // CAN_RETRY
if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
struct.canRetry = iprot.readBool();
struct.setCanRetryIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default: default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
} }
@ -335,6 +421,11 @@ public class TIOError extends org.apache.thrift.TException implements org.apache
oprot.writeFieldEnd(); oprot.writeFieldEnd();
} }
} }
if (struct.isSetCanRetry()) {
oprot.writeFieldBegin(CAN_RETRY_FIELD_DESC);
oprot.writeBool(struct.canRetry);
oprot.writeFieldEnd();
}
oprot.writeFieldStop(); oprot.writeFieldStop();
oprot.writeStructEnd(); oprot.writeStructEnd();
} }
@ -356,20 +447,30 @@ public class TIOError extends org.apache.thrift.TException implements org.apache
if (struct.isSetMessage()) { if (struct.isSetMessage()) {
optionals.set(0); optionals.set(0);
} }
oprot.writeBitSet(optionals, 1); if (struct.isSetCanRetry()) {
optionals.set(1);
}
oprot.writeBitSet(optionals, 2);
if (struct.isSetMessage()) { if (struct.isSetMessage()) {
oprot.writeString(struct.message); oprot.writeString(struct.message);
} }
if (struct.isSetCanRetry()) {
oprot.writeBool(struct.canRetry);
}
} }
@Override @Override
public void read(org.apache.thrift.protocol.TProtocol prot, TIOError struct) throws org.apache.thrift.TException { public void read(org.apache.thrift.protocol.TProtocol prot, TIOError struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
java.util.BitSet incoming = iprot.readBitSet(1); java.util.BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) { if (incoming.get(0)) {
struct.message = iprot.readString(); struct.message = iprot.readString();
struct.setMessageIsSet(true); struct.setMessageIsSet(true);
} }
if (incoming.get(1)) {
struct.canRetry = iprot.readBool();
struct.setCanRetryIsSet(true);
}
} }
} }

View File

@ -174,6 +174,7 @@ struct TAppend {
*/ */
exception IOError { exception IOError {
1:string message 1:string message
2:bool canRetry
} }
/** /**

View File

@ -511,6 +511,7 @@ struct TOnlineLogRecord {
*/ */
exception TIOError { exception TIOError {
1: optional string message 1: optional string message
2: optional bool canRetry
} }
/** /**