@Test public void testValidTxnsEmpty() throws Exception { GetOpenTxnsInfoResponse txnsInfo = txnHandler.getOpenTxnsInfo(); assertEquals(0L, txnsInfo.getTxn_high_water_mark()); assertTrue(txnsInfo.getOpen_txns().isEmpty()); GetOpenTxnsResponse txns = txnHandler.getOpenTxns(); assertEquals(0L, txns.getTxn_high_water_mark()); assertTrue(txns.getOpen_txns().isEmpty()); }
public GetOpenTxnsResponse deepCopy() { return new GetOpenTxnsResponse(this); }
public void validate() throws org.apache.thrift.TException { // check for required fields if (!isSetTxn_high_water_mark()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'txn_high_water_mark' is unset! Struct:" + toString()); } if (!isSetOpen_txns()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'open_txns' is unset! Struct:" + toString()); } if (!isSetAbortedBits()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'abortedBits' is unset! Struct:" + toString()); } // check for sub-struct validity }
public Object getFieldValue(_Fields field) { switch (field) { case TXN_HIGH_WATER_MARK: return getTxn_high_water_mark(); case OPEN_TXNS: return getOpen_txns(); case MIN_OPEN_TXN: return getMin_open_txn(); case ABORTED_BITS: return getAbortedBits(); } 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 TXN_HIGH_WATER_MARK: return isSetTxn_high_water_mark(); case OPEN_TXNS: return isSetOpen_txns(); case MIN_OPEN_TXN: return isSetMin_open_txn(); case ABORTED_BITS: return isSetAbortedBits(); } throw new IllegalStateException(); }
case TXN_HIGH_WATER_MARK: if (value == null) { unsetTxn_high_water_mark(); } else { setTxn_high_water_mark((Long)value); unsetOpen_txns(); } else { setOpen_txns((List<Long>)value); unsetMin_open_txn(); } else { setMin_open_txn((Long)value); unsetAbortedBits(); } else { setAbortedBits((ByteBuffer)value);
public void setFieldValue(_Fields field, Object value) { switch (field) { case TXN_HIGH_WATER_MARK: if (value == null) { unsetTxn_high_water_mark(); } else { setTxn_high_water_mark((Long)value); } break; case OPEN_TXNS: if (value == null) { unsetOpen_txns(); } else { setOpen_txns((Set<Long>)value); } break; } }
assert currentTxn <= txns.getTxn_high_water_mark(); long highWaterMark = (currentTxn > 0) ? Math.min(currentTxn, txns.getTxn_high_water_mark()) : txns.getTxn_high_water_mark(); List<Long> openTxns = txns.getOpen_txns(); sizeToHwm = (sizeToHwm < 0) ? (-sizeToHwm) : sizeToHwm; long[] exceptions = new long[sizeToHwm]; BitSet inAbortedBits = BitSet.valueOf(txns.getAbortedBits()); BitSet outAbortedBits = new BitSet(); long minOpenTxnId = Long.MAX_VALUE;
public void validate() throws org.apache.thrift.TException { // check for required fields if (!isSetTxn_high_water_mark()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'txn_high_water_mark' is unset! Struct:" + toString()); } if (!isSetOpen_txns()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'open_txns' is unset! Struct:" + toString()); } // check for sub-struct validity }
public static ValidTxnList createValidTxnListForCleaner(GetOpenTxnsResponse txns, long minOpenTxnGLB) { long highWaterMark = minOpenTxnGLB - 1; long[] abortedTxns = new long[txns.getOpen_txnsSize()]; BitSet abortedBits = BitSet.valueOf(txns.getAbortedBits()); int i = 0; for(long txnId : txns.getOpen_txns()) { if(txnId > highWaterMark) { break; } if(abortedBits.get(i)) { abortedTxns[i] = txnId; } else { assert false : JavaUtils.txnIdToString(txnId) + " is open and <= hwm:" + highWaterMark; } ++i; } abortedTxns = Arrays.copyOf(abortedTxns, i); BitSet bitSet = new BitSet(abortedTxns.length); bitSet.set(0, abortedTxns.length); //add ValidCleanerTxnList? - could be problematic for all the places that read it from // string as they'd have to know which object to instantiate return new ValidReadTxnList(abortedTxns, bitSet, highWaterMark, Long.MAX_VALUE); } /**
boolean this_present_open_txns = true && this.isSetOpen_txns(); boolean that_present_open_txns = true && that.isSetOpen_txns(); if (this_present_open_txns || that_present_open_txns) { if (!(this_present_open_txns && that_present_open_txns)) boolean this_present_min_open_txn = true && this.isSetMin_open_txn(); boolean that_present_min_open_txn = true && that.isSetMin_open_txn(); if (this_present_min_open_txn || that_present_min_open_txn) { if (!(this_present_min_open_txn && that_present_min_open_txn)) boolean this_present_abortedBits = true && this.isSetAbortedBits(); boolean that_present_abortedBits = true && that.isSetAbortedBits(); if (this_present_abortedBits || that_present_abortedBits) { if (!(this_present_abortedBits && that_present_abortedBits))
/** 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 TXN_HIGH_WATER_MARK: return isSetTxn_high_water_mark(); case OPEN_TXNS: return isSetOpen_txns(); } throw new IllegalStateException(); }
TxnStore.FAILED_RESPONSE, resp.getCompacts().get(0).getState()); GetOpenTxnsResponse openResp = txnHandler.getOpenTxns(); Assert.assertEquals(openResp.toString(), 1, openResp.getOpen_txnsSize()); Assert.assertTrue(openResp.toString(), BitSet.valueOf(openResp.getAbortedBits()).get(0)); Assert.assertEquals(openResp.toString(), 1, openResp.getOpen_txnsSize()); Assert.assertTrue(openResp.toString(), BitSet.valueOf(openResp.getAbortedBits()).get(0)); Assert.assertEquals(1, TxnDbUtil.countQueryAgent(hiveConf, "select count(*) from TXN_COMPONENTS")); Assert.assertEquals(openResp.toString(), 0, openResp.getOpen_txnsSize());
dbConn.rollback(); ByteBuffer byteBuffer = ByteBuffer.wrap(abortedBits.toByteArray()); GetOpenTxnsResponse otr = new GetOpenTxnsResponse(hwm, openList, byteBuffer); if(minOpenTxn < Long.MAX_VALUE) { otr.setMin_open_txn(minOpenTxn);
public boolean equals(GetOpenTxnsResponse that) { if (that == null) return false; boolean this_present_txn_high_water_mark = true; boolean that_present_txn_high_water_mark = true; if (this_present_txn_high_water_mark || that_present_txn_high_water_mark) { if (!(this_present_txn_high_water_mark && that_present_txn_high_water_mark)) return false; if (this.txn_high_water_mark != that.txn_high_water_mark) return false; } boolean this_present_open_txns = true && this.isSetOpen_txns(); boolean that_present_open_txns = true && that.isSetOpen_txns(); if (this_present_open_txns || that_present_open_txns) { if (!(this_present_open_txns && that_present_open_txns)) return false; if (!this.open_txns.equals(that.open_txns)) return false; } return true; }
/** * Performs a deep copy on <i>other</i>. */ public GetOpenTxnsResponse(GetOpenTxnsResponse other) { __isset_bitfield = other.__isset_bitfield; this.txn_high_water_mark = other.txn_high_water_mark; if (other.isSetOpen_txns()) { List<Long> __this__open_txns = new ArrayList<Long>(other.open_txns); this.open_txns = __this__open_txns; } this.min_open_txn = other.min_open_txn; if (other.isSetAbortedBits()) { this.abortedBits = org.apache.thrift.TBaseHelper.copyBinary(other.abortedBits); } }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof GetOpenTxnsResponse) return this.equals((GetOpenTxnsResponse)that); return false; }
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { 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))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } }
case TXN_HIGH_WATER_MARK: if (value == null) { unsetTxn_high_water_mark(); } else { setTxn_high_water_mark((Long)value); unsetOpen_txns(); } else { setOpen_txns((List<Long>)value); unsetMin_open_txn(); } else { setMin_open_txn((Long)value); unsetAbortedBits(); } else { setAbortedBits((ByteBuffer)value);
public Object getFieldValue(_Fields field) { switch (field) { case TXN_HIGH_WATER_MARK: return getTxn_high_water_mark(); case OPEN_TXNS: return getOpen_txns(); case MIN_OPEN_TXN: return getMin_open_txn(); case ABORTED_BITS: return getAbortedBits(); } throw new IllegalStateException(); }