@Override public boolean equals(Object o) { if (o == null || !(o instanceof InProgressTx)) { return false; } if (this == o) { return true; } InProgressTx other = (InProgressTx) o; return Objects.equal(visibilityUpperBound, other.getVisibilityUpperBound()) && Objects.equal(expiration, other.getExpiration()) && Objects.equal(type, other.type) && Objects.equal(checkpointWritePointers, other.checkpointWritePointers); }
@Override public boolean equals(Object o) { if (o == null || !(o instanceof InProgressTx)) { return false; } if (this == o) { return true; } InProgressTx other = (InProgressTx) o; return Objects.equal(visibilityUpperBound, other.getVisibilityUpperBound()) && Objects.equal(expiration, other.getExpiration()) && Objects.equal(type, other.type) && Objects.equal(checkpointWritePointers, other.checkpointWritePointers); }
List<Long> timedOut = Lists.newArrayList(); for (Map.Entry<Long, InProgressTx> tx : inProgress.entrySet()) { long expiration = tx.getValue().getExpiration(); if (expiration >= 0L && currentTime > expiration) {
List<Long> timedOut = Lists.newArrayList(); for (Map.Entry<Long, InProgressTx> tx : inProgress.entrySet()) { long expiration = tx.getValue().getExpiration(); if (expiration >= 0L && currentTime > expiration) {
for (Map.Entry<Long, InProgressTx> entry : inProgress.entrySet()) { long writePointer = entry.getKey(); long expiration = entry.getValue().getExpiration(); } else if (entry.getValue().getType() == null) { InProgressTx compatTx = new InProgressTx(entry.getValue().getVisibilityUpperBound(), entry.getValue().getExpiration(), TransactionType.SHORT, entry.getValue().getCheckpointWritePointers()); entry.setValue(compatTx);
for (Map.Entry<Long, InProgressTx> entry : inProgress.entrySet()) { long writePointer = entry.getKey(); long expiration = entry.getValue().getExpiration(); } else if (entry.getValue().getType() == null) { InProgressTx compatTx = new InProgressTx(entry.getValue().getVisibilityUpperBound(), entry.getValue().getExpiration(), TransactionType.SHORT, entry.getValue().getCheckpointWritePointers()); entry.setValue(compatTx);
@Override protected void encodeInProgress(BinaryEncoder encoder, Map<Long, TransactionManager.InProgressTx> inProgress) throws IOException { if (!inProgress.isEmpty()) { encoder.writeInt(inProgress.size()); for (Map.Entry<Long, TransactionManager.InProgressTx> entry : inProgress.entrySet()) { encoder.writeLong(entry.getKey()); // tx id encoder.writeLong(entry.getValue().getExpiration()); encoder.writeLong(entry.getValue().getVisibilityUpperBound()); encoder.writeInt(entry.getValue().getType().ordinal()); // write checkpoint tx IDs LongArrayList checkpointPointers = entry.getValue().getCheckpointWritePointers(); if (checkpointPointers != null && !checkpointPointers.isEmpty()) { encoder.writeInt(checkpointPointers.size()); for (int i = 0; i < checkpointPointers.size(); i++) { encoder.writeLong(checkpointPointers.getLong(i)); } } encoder.writeInt(0); } } encoder.writeInt(0); // zero denotes end of list as per AVRO spec }
@Override protected void encodeInProgress(BinaryEncoder encoder, Map<Long, TransactionManager.InProgressTx> inProgress) throws IOException { if (!inProgress.isEmpty()) { encoder.writeInt(inProgress.size()); for (Map.Entry<Long, TransactionManager.InProgressTx> entry : inProgress.entrySet()) { encoder.writeLong(entry.getKey()); // tx id encoder.writeLong(entry.getValue().getExpiration()); encoder.writeLong(entry.getValue().getVisibilityUpperBound()); encoder.writeInt(entry.getValue().getType().ordinal()); // write checkpoint tx IDs LongArrayList checkpointPointers = entry.getValue().getCheckpointWritePointers(); if (checkpointPointers != null && !checkpointPointers.isEmpty()) { encoder.writeInt(checkpointPointers.size()); for (int i = 0; i < checkpointPointers.size(); i++) { encoder.writeLong(checkpointPointers.getLong(i)); } } encoder.writeInt(0); } } encoder.writeInt(0); // zero denotes end of list as per AVRO spec }
@Override protected void encodeInProgress(BinaryEncoder encoder, Map<Long, TransactionManager.InProgressTx> inProgress) throws IOException { if (!inProgress.isEmpty()) { encoder.writeInt(inProgress.size()); for (Map.Entry<Long, TransactionManager.InProgressTx> entry : inProgress.entrySet()) { encoder.writeLong(entry.getKey()); // tx id encoder.writeLong(entry.getValue().getExpiration()); encoder.writeLong(entry.getValue().getVisibilityUpperBound()); encoder.writeInt(entry.getValue().getType().ordinal()); } } encoder.writeInt(0); // zero denotes end of list as per AVRO spec }
@Override protected void encodeInProgress(BinaryEncoder encoder, Map<Long, TransactionManager.InProgressTx> inProgress) throws IOException { if (!inProgress.isEmpty()) { encoder.writeInt(inProgress.size()); for (Map.Entry<Long, TransactionManager.InProgressTx> entry : inProgress.entrySet()) { encoder.writeLong(entry.getKey()); // tx id encoder.writeLong(entry.getValue().getExpiration()); encoder.writeLong(entry.getValue().getVisibilityUpperBound()); encoder.writeInt(entry.getValue().getType().ordinal()); } } encoder.writeInt(0); // zero denotes end of list as per AVRO spec }
private void verifyInProgress(TransactionManager.InProgressTx inProgressTx, TransactionType type, long expiration) throws Exception { Assert.assertEquals(type, inProgressTx.getType()); Assert.assertTrue(inProgressTx.getExpiration() == expiration); } }
protected void encodeInProgress(BinaryEncoder encoder, Map<Long, TransactionManager.InProgressTx> inProgress) throws IOException { if (!inProgress.isEmpty()) { encoder.writeInt(inProgress.size()); for (Map.Entry<Long, TransactionManager.InProgressTx> entry : inProgress.entrySet()) { encoder.writeLong(entry.getKey()); // tx id encoder.writeLong(entry.getValue().getExpiration()); encoder.writeLong(entry.getValue().getVisibilityUpperBound()); } } encoder.writeInt(0); // zero denotes end of list as per AVRO spec }
protected void encodeInProgress(BinaryEncoder encoder, Map<Long, TransactionManager.InProgressTx> inProgress) throws IOException { if (!inProgress.isEmpty()) { encoder.writeInt(inProgress.size()); for (Map.Entry<Long, TransactionManager.InProgressTx> entry : inProgress.entrySet()) { encoder.writeLong(entry.getKey()); // tx id encoder.writeLong(entry.getValue().getExpiration()); encoder.writeLong(entry.getValue().getVisibilityUpperBound()); } } encoder.writeInt(0); // zero denotes end of list as per AVRO spec }