@Override public void accept(Key k, Value v) { total++; if (k.isDeleted()) { deletes++; } }
@Override public Key getTopKey() { Key top = source.getTopKey(); if (top.isDeleted()) { throw new IllegalStateException("Saw unexpected delete " + top); } return top; } };
@Override public void accept(Key k, Value v) { seen++; if (ignoreDeletes && k.isDeleted()) { deleted++; } else { converter.convert(k, v, this::incrementCounter); } }
@Override public boolean accept(Key k, Value v) { if (!k.isDeleted() && k.compareColumnFamily(TabletsSection.BulkFileColumnFamily.NAME) == 0) { long txid = Long.parseLong(v.toString()); Status status = bulkTxStatusCache.get(txid); if (status == null) { try { if (arbitrator.transactionComplete(Constants.BULK_ARBITRATOR_TYPE, txid)) { status = Status.INACTIVE; } else { status = Status.ACTIVE; } } catch (Exception e) { status = Status.ACTIVE; log.error("{}", e.getMessage(), e); } bulkTxStatusCache.put(txid, status); } return status == Status.ACTIVE; } return true; }
/** * Make a new key with a column family, column qualifier, and column visibility. Copy the rest of * the parts of the key (including delete flag) from {@code originalKey}. */ protected Key replaceKeyParts(Key originalKey, Text newColFam, Text newColQual, Text newColVis) { byte[] row = originalKey.getRowData().toArray(); byte[] cf = newColFam.getBytes(); byte[] cq = newColQual.getBytes(); byte[] cv = newColVis.getBytes(); long timestamp = originalKey.getTimestamp(); Key newKey = new Key(row, 0, row.length, cf, 0, newColFam.getLength(), cq, 0, newColQual.getLength(), cv, 0, newColVis.getLength(), timestamp); newKey.setDeleted(originalKey.isDeleted()); return newKey; }
private void findTop() throws IOException { if (!propogateDeletes) { while (source.hasTop() && source.getTopKey().isDeleted()) { skipRowColumn(); } } }
/** * Make a new key with a column qualifier, and column visibility. Copy the rest of the parts of * the key (including delete flag) from {@code originalKey}. */ protected Key replaceKeyParts(Key originalKey, Text newColQual, Text newColVis) { byte[] row = originalKey.getRowData().toArray(); byte[] cf = originalKey.getColumnFamilyData().toArray(); byte[] cq = newColQual.getBytes(); byte[] cv = newColVis.getBytes(); long timestamp = originalKey.getTimestamp(); Key newKey = new Key(row, 0, row.length, cf, 0, cf.length, cq, 0, newColQual.getLength(), cv, 0, newColVis.getLength(), timestamp); newKey.setDeleted(originalKey.isDeleted()); return newKey; }
@Override public void next() throws IOException { if (source.getTopKey().isDeleted()) skipRowColumn(); else source.next(); findTop(); }
private boolean _hasNext() { return source.hasTop() && !source.getTopKey().isDeleted() && topKey.equals(source.getTopKey(), PartialKey.ROW_COLFAM_COLQUAL_COLVIS); }
/** * Iterates over the source until an acceptable key/value pair is found. */ private void findTop() throws IOException { while (source.hasTop()) { Key top = source.getTopKey(); if (top.isDeleted() || (accept(top, source.getTopValue()))) { break; } source.next(); } }
@VisibleForTesting public void put(Key key, Value value) { wlock.lock(); try { if (nmPointer == 0) { throw new IllegalStateException("Native Map Deleted"); } modCount++; singleUpdate(nmPointer, key.getRowData().toArray(), key.getColumnFamilyData().toArray(), key.getColumnQualifierData().toArray(), key.getColumnVisibilityData().toArray(), key.getTimestamp(), key.isDeleted(), value.get(), 0); } finally { wlock.unlock(); } }
/** * Iterates over the source until an acceptable key/value pair is found. */ private void findTop() throws IOException { while (source.hasTop()) { Key top = source.getTopKey(); if (top.isDeleted() || (accept(top, source.getTopValue()))) { break; } source.next(); } }
/** * Iterates over the source until an acceptable key/value pair is found. */ protected void findTop() { SortedKeyValueIterator<Key,Value> source = getSource(); while (source.hasTop() && !source.getTopKey().isDeleted() && (negate == accept(source.getTopKey(), source.getTopValue()))) { try { source.next(); } catch (IOException e) { throw new RuntimeException(e); } } }
return key.getColumnFamilyData().length() > 0 || key.getColumnQualifierData().length() > 0 || key.getColumnVisibilityData().length() > 0 || key.getTimestamp() < Long.MAX_VALUE || key.isDeleted(); case ROW_COLFAM: return key.getColumnQualifierData().length() > 0 || key.getColumnVisibilityData().length() > 0 || key.getTimestamp() < Long.MAX_VALUE || key.isDeleted(); case ROW_COLFAM_COLQUAL: return key.getColumnVisibilityData().length() > 0 || key.getTimestamp() < Long.MAX_VALUE || key.isDeleted(); case ROW_COLFAM_COLQUAL_COLVIS: return key.getTimestamp() < Long.MAX_VALUE || key.isDeleted(); case ROW_COLFAM_COLQUAL_COLVIS_TIME: return key.isDeleted(); case ROW_COLFAM_COLQUAL_COLVIS_TIME_DEL: return false;
/** * Make a new key with all parts (including delete flag) coming from {@code originalKey} but use * {@code newColQual} as the column qualifier. */ protected Key replaceColumnQualifier(Key originalKey, Text newColQual) { byte[] row = originalKey.getRowData().toArray(); byte[] cf = originalKey.getColumnFamilyData().toArray(); byte[] cq = newColQual.getBytes(); byte[] cv = originalKey.getColumnVisibilityData().toArray(); long timestamp = originalKey.getTimestamp(); Key newKey = new Key(row, 0, row.length, cf, 0, cf.length, cq, 0, newColQual.getLength(), cv, 0, cv.length, timestamp); newKey.setDeleted(originalKey.isDeleted()); return newKey; }
/** * Make a new key with all parts (including delete flag) coming from {@code originalKey} but use * {@code newColVis} as the column visibility. */ protected Key replaceColumnVisibility(Key originalKey, Text newColVis) { byte[] row = originalKey.getRowData().toArray(); byte[] cf = originalKey.getColumnFamilyData().toArray(); byte[] cq = originalKey.getColumnQualifierData().toArray(); byte[] cv = newColVis.getBytes(); long timestamp = originalKey.getTimestamp(); Key newKey = new Key(row, 0, row.length, cf, 0, cf.length, cq, 0, cq.length, cv, 0, newColVis.getLength(), timestamp); newKey.setDeleted(originalKey.isDeleted()); return newKey; }
/** * Make a new key with all parts (including delete flag) coming from {@code originalKey} but use * {@code newColFam} as the column family. */ protected Key replaceColumnFamily(Key originalKey, Text newColFam) { byte[] row = originalKey.getRowData().toArray(); byte[] cf = newColFam.getBytes(); byte[] cq = originalKey.getColumnQualifierData().toArray(); byte[] cv = originalKey.getColumnVisibilityData().toArray(); long timestamp = originalKey.getTimestamp(); Key newKey = new Key(row, 0, row.length, cf, 0, newColFam.getLength(), cq, 0, cq.length, cv, 0, cv.length, timestamp); newKey.setDeleted(originalKey.isDeleted()); return newKey; }
/** * Sets the topKey and topValue based on the top key of the source. If the column of the source * top key is in the set of combiners, topKey will be the top key of the source and topValue will * be the result of the reduce method. Otherwise, topKey and topValue will be unchanged. (They are * always set to null before this method is called.) */ private void findTop() throws IOException { // check if aggregation is needed if (super.hasTop()) { workKey.set(super.getTopKey()); if (combineAllColumns || combiners.contains(workKey)) { if (workKey.isDeleted()) { sawDelete(); return; } topKey = workKey; Iterator<Value> viter = new ValueIterator(getSource()); topValue = reduce(topKey, viter); while (viter.hasNext()) viter.next(); } } }
NMIterator(Key key) { if (nmPointer == 0) { throw new IllegalStateException(); } expectedModCount = modCount; nmiPointer = createNMI(nmPointer, key.getRowData().toArray(), key.getColumnFamilyData().toArray(), key.getColumnQualifierData().toArray(), key.getColumnVisibilityData().toArray(), key.getTimestamp(), key.isDeleted(), fieldsLens); hasNext = nmiPointer != 0; }
protected void findTop() throws IOException { SortedKeyValueIterator<Key,Value> src = getSource(); // advance could be null if we've just been seeked advance = null; while (src.hasTop() && !advancedPastSeek) { if (src.getTopKey().isDeleted()) { // as per. o.a.a.core.iterators.Filter, deleted keys always pass through the filter. advance = AdvanceResult.NEXT; return; } FilterResult f = filter(src.getTopKey(), src.getTopValue()); if (log.isTraceEnabled()) { log.trace("Filtered: {} result == {} hint == {}", src.getTopKey(), f, f.advance == AdvanceResult.USE_HINT ? getNextKeyHint(src.getTopKey(), src.getTopValue()) : " (none)"); } if (f.accept != negate) { // advance will be processed when next is called advance = f.advance; break; } else { advanceSource(src, f.advance); } } }