@Override public SSTableIdentityIterator cleanup(SSTableIdentityIterator row) { if (Range.isInRanges(row.getKey().getToken(), ranges)) return row; cfs.invalidateCachedRow(row.getKey()); if (indexedColumnsInRow != null) indexedColumnsInRow.clear(); while (row.hasNext()) { OnDiskAtom column = row.next(); if (column instanceof Cell && cfs.indexManager.indexes((Cell) column)) { if (indexedColumnsInRow == null) indexedColumnsInRow = new ArrayList<>(); indexedColumnsInRow.add((Cell) column); } } if (indexedColumnsInRow != null && !indexedColumnsInRow.isEmpty()) { // acquire memtable lock here because secondary index deletion may cause a race. See CASSANDRA-3712 try (OpOrder.Group opGroup = cfs.keyspace.writeOrder.start()) { cfs.indexManager.deleteFromIndexes(row.getKey(), indexedColumnsInRow, opGroup); } } return null; } }
@SuppressWarnings("resource") // caller to close @Override public UnfilteredRowIterator simpleIterator(FileDataInput dfile, DecoratedKey key, RowIndexEntry position, boolean tombstoneOnly) { return SSTableIdentityIterator.create(this, dfile, position, key, tombstoneOnly); }
public PartitionColumns columns() { return metadata().partitionColumns(); }
/** * Used only by scrubber to solve problems with data written after the END_OF_ROW marker. Iterates atoms for the given dataSize only and does not accept an END_OF_ROW marker. */ public static SSTableIdentityIterator createFragmentIterator(SSTableReader sstable, final RandomAccessReader file, DecoratedKey key, long dataSize, boolean checkData) { final ColumnSerializer.Flag flag = ColumnSerializer.Flag.LOCAL; final CellNameType type = sstable.metadata.comparator; final int expireBefore = (int) (System.currentTimeMillis() / 1000); final Version version = sstable.descriptor.version; final long dataEnd = file.getFilePointer() + dataSize; return new SSTableIdentityIterator(sstable.metadata, file, file.getPath(), key, dataSize, checkData, sstable, flag, DeletionTime.LIVE, new AbstractIterator<OnDiskAtom>() { protected OnDiskAtom computeNext() { if (file.getFilePointer() >= dataEnd) return endOfData(); try { return type.onDiskAtomSerializer().deserializeFromSSTable(file, flag, expireBefore, version); } catch (IOException e) { throw new IOError(e); } } }); }
public Unfiltered next() { try { return doCompute(); } catch (IndexOutOfBoundsException e) { sstable.markSuspect(); throw new CorruptSSTableException(e, filename); } catch (IOError e) { if (e.getCause() instanceof IOException) { sstable.markSuspect(); throw new CorruptSSTableException((Exception)e.getCause(), filename); } else { throw e; } } }
String currentKey = row.getColumnFamily().metadata().getKeyValidator().getString(row.getKey().getKey()); outs.println(","); serializeRow(row, row.getKey(), outs); checkStream(outs);
@SuppressWarnings("resource") private boolean tryAppend(DecoratedKey prevKey, DecoratedKey key, long dataSize, SSTableRewriter writer) { // OrderCheckerIterator will check, at iteration time, that the cells are in the proper order. If it detects // that one cell is out of order, it will stop returning them. The remaining cells will be sorted and added // to the outOfOrderRows that will be later written to a new SSTable. OrderCheckerIterator atoms = new OrderCheckerIterator(new SSTableIdentityIterator(sstable, dataFile, key, dataSize, validateColumns), cfs.metadata.comparator.onDiskAtomComparator()); if (prevKey != null && prevKey.compareTo(key) > 0) { saveOutOfOrderRow(prevKey, key, atoms); return false; } AbstractCompactedRow compactedRow = new LazilyCompactedRow(controller, Collections.singletonList(atoms)); if (writer.tryAppend(compactedRow) == null) emptyRows++; else goodRows++; if (atoms.hasOutOfOrderCells()) saveOutOfOrderRow(key, atoms); return true; }
public Unfiltered next() { try { return doCompute(); } catch (IndexOutOfBoundsException e) { sstable.markSuspect(); throw new CorruptSSTableException(e, filename); } catch (IOError e) { if (e.getCause() instanceof IOException) { sstable.markSuspect(); throw new CorruptSSTableException((Exception)e.getCause(), filename); } else { throw e; } } }
while (row.hasNext()) OnDiskAtom column = row.next(); long now = System.currentTimeMillis(); if (column instanceof Column && ((Column) column).isMarkedForDelete(now)) { String key; try { key = UTF8Type.instance.getString(row.getKey().key); } catch (RuntimeException e) { key = BytesType.instance.getString(row.getKey().key);
public static SSTableIdentityIterator create(SSTableReader sstable, RandomAccessReader file, DecoratedKey key) { try { DeletionTime partitionLevelDeletion = DeletionTime.serializer.deserialize(file); SerializationHelper helper = new SerializationHelper(sstable.metadata, sstable.descriptor.version.correspondingMessagingVersion(), SerializationHelper.Flag.LOCAL); SSTableSimpleIterator iterator = SSTableSimpleIterator.create(sstable.metadata, file, sstable.header, helper, partitionLevelDeletion); return new SSTableIdentityIterator(sstable, key, partitionLevelDeletion, file.getPath(), iterator); } catch (IOException e) { sstable.markSuspect(); throw new CorruptSSTableException(e, file.getPath()); } }
@SuppressWarnings("resource") // caller to close @Override public UnfilteredRowIterator simpleIterator(FileDataInput dfile, DecoratedKey key, RowIndexEntry position, boolean tombstoneOnly) { return SSTableIdentityIterator.create(this, dfile, position, key, tombstoneOnly); }
public PartitionColumns columns() { return metadata().partitionColumns(); }
public Unfiltered next() { try { return doCompute(); } catch (IndexOutOfBoundsException e) { sstable.markSuspect(); throw new CorruptSSTableException(e, filename); } catch (IOError e) { if (e.getCause() instanceof IOException) { sstable.markSuspect(); throw new CorruptSSTableException((Exception)e.getCause(), filename); } else { throw e; } } }
public static SSTableIdentityIterator create(SSTableReader sstable, RandomAccessReader file, DecoratedKey key) { try { DeletionTime partitionLevelDeletion = DeletionTime.serializer.deserialize(file); SerializationHelper helper = new SerializationHelper(sstable.metadata, sstable.descriptor.version.correspondingMessagingVersion(), SerializationHelper.Flag.LOCAL); SSTableSimpleIterator iterator = SSTableSimpleIterator.create(sstable.metadata, file, sstable.header, helper, partitionLevelDeletion); return new SSTableIdentityIterator(sstable, key, partitionLevelDeletion, file.getPath(), iterator); } catch (IOException e) { sstable.markSuspect(); throw new CorruptSSTableException(e, file.getPath()); } }
@SuppressWarnings("resource") // caller to close @Override public UnfilteredRowIterator simpleIterator(FileDataInput dfile, DecoratedKey key, RowIndexEntry position, boolean tombstoneOnly) { return SSTableIdentityIterator.create(this, dfile, position, key, tombstoneOnly); }
public PartitionColumns columns() { return metadata().partitionColumns(); }
public Unfiltered next() { try { return doCompute(); } catch (IndexOutOfBoundsException e) { sstable.markSuspect(); throw new CorruptSSTableException(e, filename); } catch (IOError e) { if (e.getCause() instanceof IOException) { sstable.markSuspect(); throw new CorruptSSTableException((Exception)e.getCause(), filename); } else { throw e; } } }