@Override public Iterator<Result> write(Iterator<ConditionalMutation> mutations) { BlockingQueue<Result> resultQueue = new LinkedBlockingQueue<>(); List<QCMutation> mutationList = new ArrayList<>(); int count = 0; long entryTime = System.currentTimeMillis(); mloop: while (mutations.hasNext()) { ConditionalMutation mut = mutations.next(); count++; if (mut.getConditions().size() == 0) throw new IllegalArgumentException( "ConditionalMutation had no conditions " + new String(mut.getRow(), UTF_8)); for (Condition cond : mut.getConditions()) { if (!isVisible(cond.getVisibility())) { resultQueue.add(new Result(Status.INVISIBLE_VISIBILITY, mut, null)); continue mloop; } } // copy the mutations so that even if caller changes it, it will not matter mutationList.add(new QCMutation(mut, resultQueue, entryTime)); } queue(mutationList); return new RQIterator(resultQueue, count); }
@Override public boolean processResults(CommitData cd, Iterator<Result> results) throws Exception { while (results.hasNext()) { Result result = results.next(); // TODO handle unknown? Bytes row = Bytes.of(result.getMutation().getRow()); if (result.getStatus() == Status.ACCEPTED) { cd.acceptedRows.add(row); } else { cd.addToRejected(row, updates.get(row).keySet()); } } return cd.getRejected().isEmpty(); }
@Override public boolean processResults(CommitData cd, Iterator<Result> results) throws Exception { while (results.hasNext()) { Result result = results.next(); // TODO handle unknown? Bytes row = Bytes.of(result.getMutation().getRow()); if (result.getStatus() == Status.ACCEPTED) { cd.acceptedRows.add(row); } else { cd.addToRejected(row, updates.get(row).keySet()); } } return cd.getRejected().size() == 0; }
@Override public Iterator<Result> write(Iterator<ConditionalMutation> mutations) { BlockingQueue<Result> resultQueue = new LinkedBlockingQueue<>(); List<QCMutation> mutationList = new ArrayList<>(); int count = 0; long entryTime = System.currentTimeMillis(); mloop: while (mutations.hasNext()) { ConditionalMutation mut = mutations.next(); count++; if (mut.getConditions().size() == 0) throw new IllegalArgumentException( "ConditionalMutation had no conditions " + new String(mut.getRow(), UTF_8)); for (Condition cond : mut.getConditions()) { if (!isVisible(cond.getVisibility())) { resultQueue.add(new Result(Status.INVISIBLE_VISIBILITY, mut, null)); continue mloop; } } // copy the mutations so that even if caller changes it, it will not matter mutationList.add(new QCMutation(mut, resultQueue, entryTime)); } queue(mutationList); return new RQIterator(resultQueue, count); }
while (results.hasNext()) { Result result = results.next(); changed.add(new ArrayByteSequence(result.getMutation().getRow()));
ByteBuffer key = ByteBuffer.wrap(mutation.getRow()); ConditionalUpdates update = updates.get(key);
Result result = resultsIter.next(); Bytes row = Bytes.of(result.getMutation().getRow()); if (result.getStatus() == Status.ACCEPTED) { cd.acceptedRows.add(row);
Result result = results.next(); Assert.assertEquals(Status.ACCEPTED, result.getStatus()); rows2.add(new ArrayByteSequence(result.getMutation().getRow()));
ByteBuffer row = ByteBuffer.wrap(result.getMutation().getRow()); ConditionalStatus status = ConditionalStatus.valueOf(result.getStatus().name()); resultMap.put(row, status);
while (results.hasNext()) { Result result = results.next(); String row = new String(result.getMutation().getRow()); if (row.equals("19059")) { Assert.assertEquals(Status.ACCEPTED, result.getStatus());
while (results.hasNext()) { Result result = results.next(); if (new String(result.getMutation().getRow()).equals("99006")) { Assert.assertEquals(Status.ACCEPTED, result.getStatus()); accepted++;
String k = new String(result.getMutation().getRow()); Assert.assertFalse("Did not expect to see multiple resultus for the row: " + k, actual.containsKey(k));
String k = new String(result.getMutation().getRow()); Assert.assertFalse("Did not expect to see multiple resultus for the row: " + k, actual.containsKey(k));
private boolean checkForAckCollision(ConditionalMutation cm) { Bytes row = Bytes.of(cm.getRow());
private boolean checkForAckCollision(ConditionalMutation cm) { Bytes row = Bytes.of(cm.getRow());
private boolean checkForAckCollision(ConditionalMutation cm) { Bytes row = Bytes.of(cm.getRow());