private void saveOutOfOrderRow(DecoratedKey prevKey, DecoratedKey key, UnfilteredRowIterator iterator) { // TODO bitch if the row is too large? if it is there's not much we can do ... outputHandler.warn(String.format("Out of order row detected (%s found after %s)", key, prevKey)); outOfOrder.add(ImmutableBTreePartition.create(iterator)); }
private void throwIfCommutative(DecoratedKey key, Throwable th) { if (isCommutative && !skipCorrupted) { outputHandler.warn(String.format("An error occurred while scrubbing the row with key '%s'. Skipping corrupt " + "rows in counter tables will result in undercounts for the affected " + "counters (see CASSANDRA-2759 for more details), so by default the scrub will " + "stop at this point. If you would like to skip the row anyway and continue " + "scrubbing, re-run the scrub with the --skip-corrupted option.", key)); throw new IOError(th); } }
private void saveOutOfOrderRow(DecoratedKey prevKey, DecoratedKey key, UnfilteredRowIterator iterator) { // TODO bitch if the row is too large? if it is there's not much we can do ... outputHandler.warn(String.format("Out of order row detected (%s found after %s)", key, prevKey)); outOfOrder.add(ImmutableBTreePartition.create(iterator)); }
private void saveOutOfOrderRow(DecoratedKey prevKey, DecoratedKey key, UnfilteredRowIterator iterator) { // TODO bitch if the row is too large? if it is there's not much we can do ... outputHandler.warn(String.format("Out of order row detected (%s found after %s)", key, prevKey)); outOfOrder.add(ImmutableBTreePartition.create(iterator)); }
private void throwIfCannotContinue(DecoratedKey key, Throwable th) { if (isIndex) { outputHandler.warn(String.format("An error occurred while scrubbing the row with key '%s' for an index table. " + "Scrubbing will abort for this table and the index will be rebuilt.", key)); throw new IOError(th); } if (isCommutative && !skipCorrupted) { outputHandler.warn(String.format("An error occurred while scrubbing the row with key '%s'. Skipping corrupt " + "rows in counter tables will result in undercounts for the affected " + "counters (see CASSANDRA-2759 for more details), so by default the scrub will " + "stop at this point. If you would like to skip the row anyway and continue " + "scrubbing, re-run the scrub with the --skip-corrupted option.", key)); throw new IOError(th); } }
private void throwIfCannotContinue(DecoratedKey key, Throwable th) { if (isIndex) { outputHandler.warn(String.format("An error occurred while scrubbing the row with key '%s' for an index table. " + "Scrubbing will abort for this table and the index will be rebuilt.", key)); throw new IOError(th); } if (isCommutative && !skipCorrupted) { outputHandler.warn(String.format("An error occurred while scrubbing the row with key '%s'. Skipping corrupt " + "rows in counter tables will result in undercounts for the affected " + "counters (see CASSANDRA-2759 for more details), so by default the scrub will " + "stop at this point. If you would like to skip the row anyway and continue " + "scrubbing, re-run the scrub with the --skip-corrupted option.", key)); throw new IOError(th); } }
private void throwIfCannotContinue(DecoratedKey key, Throwable th) { if (isIndex) { outputHandler.warn(String.format("An error occurred while scrubbing the row with key '%s' for an index table. " + "Scrubbing will abort for this table and the index will be rebuilt.", key)); throw new IOError(th); } if (isCommutative && !skipCorrupted) { outputHandler.warn(String.format("An error occurred while scrubbing the row with key '%s'. Skipping corrupt " + "rows in counter tables will result in undercounts for the affected " + "counters (see CASSANDRA-2759 for more details), so by default the scrub will " + "stop at this point. If you would like to skip the row anyway and continue " + "scrubbing, re-run the scrub with the --skip-corrupted option.", key)); throw new IOError(th); } }
void saveOutOfOrderRow(DecoratedKey key, OrderCheckerIterator atoms) { outputHandler.warn(String.format("Out of order cells found at key %s", key)); outOfOrderRows.add(new Row(key, atoms.getOutOfOrderCells())); }
private void seekToNextRow() { while(nextRowPositionFromIndex < dataFile.length()) { try { dataFile.seek(nextRowPositionFromIndex); return; } catch (Throwable th) { throwIfFatal(th); outputHandler.warn(String.format("Failed to seek to next row position %d", nextRowPositionFromIndex), th); badRows++; } updateIndexKey(); } }
private void seekToNextRow() { while(nextRowPositionFromIndex < dataFile.length()) { try { dataFile.seek(nextRowPositionFromIndex); return; } catch (Throwable th) { throwIfFatal(th); outputHandler.warn(String.format("Failed to seek to next row position %d", nextRowPositionFromIndex), th); badRows++; } updateIndexKey(); } }
private void seekToNextRow() { while(nextRowPositionFromIndex < dataFile.length()) { try { dataFile.seek(nextRowPositionFromIndex); return; } catch (Throwable th) { throwIfFatal(th); outputHandler.warn(String.format("Failed to seek to next row position %d", nextRowPositionFromIndex), th); badRows++; } updateIndexKey(); } }
private void seekToNextRow() { while(nextRowPositionFromIndex < dataFile.length()) { try { dataFile.seek(nextRowPositionFromIndex); return; } catch (Throwable th) { throwIfFatal(th); outputHandler.warn(String.format("Failed to seek to next row position %d", nextRowPositionFromIndex), th); badRows++; } updateIndexKey(); } }
void saveOutOfOrderRow(DecoratedKey key, OnDiskAtomIterator atoms, String message) { // TODO bitch if the row is too large? if it is there's not much we can do ... outputHandler.warn(message); // adding atoms in sorted order is worst-case for TMBSC, but we shouldn't need to do this very often // and there's no sense in failing on mis-sorted cells when a TreeMap could safe us ColumnFamily cf = atoms.getColumnFamily().cloneMeShallow(ArrayBackedSortedColumns.factory, false); while (atoms.hasNext()) { OnDiskAtom atom = atoms.next(); cf.addAtom(atom); } outOfOrderRows.add(new Row(key, cf)); }
@SuppressWarnings("resource") private boolean tryAppend(DecoratedKey prevKey, DecoratedKey key, SSTableRewriter writer) { // OrderCheckerIterator will check, at iteration time, that the rows are in the proper order. If it detects // that one row is out of order, it will stop returning them. The remaining rows will be sorted and added // to the outOfOrder set that will be later written to a new SSTable. OrderCheckerIterator sstableIterator = new OrderCheckerIterator(getIterator(key), cfs.metadata.comparator); try (UnfilteredRowIterator iterator = withValidation(sstableIterator, dataFile.getPath())) { if (prevKey != null && prevKey.compareTo(key) > 0) { saveOutOfOrderRow(prevKey, key, iterator); return false; } if (writer.tryAppend(iterator) == null) emptyRows++; else goodRows++; } if (sstableIterator.hasRowsOutOfOrder()) { outputHandler.warn(String.format("Out of order rows found in partition: %s", key)); outOfOrder.add(sstableIterator.getRowsOutOfOrder()); } return true; }
@SuppressWarnings("resource") private boolean tryAppend(DecoratedKey prevKey, DecoratedKey key, SSTableRewriter writer) { // OrderCheckerIterator will check, at iteration time, that the rows are in the proper order. If it detects // that one row is out of order, it will stop returning them. The remaining rows will be sorted and added // to the outOfOrder set that will be later written to a new SSTable. OrderCheckerIterator sstableIterator = new OrderCheckerIterator(getIterator(key), cfs.metadata.comparator); try (UnfilteredRowIterator iterator = withValidation(sstableIterator, dataFile.getPath())) { if (prevKey != null && prevKey.compareTo(key) > 0) { saveOutOfOrderRow(prevKey, key, iterator); return false; } if (writer.tryAppend(iterator) == null) emptyRows++; else goodRows++; } if (sstableIterator.hasRowsOutOfOrder()) { outputHandler.warn(String.format("Out of order rows found in partition: %s", key)); outOfOrder.add(sstableIterator.getRowsOutOfOrder()); } return true; }
@SuppressWarnings("resource") private boolean tryAppend(DecoratedKey prevKey, DecoratedKey key, SSTableRewriter writer) { // OrderCheckerIterator will check, at iteration time, that the rows are in the proper order. If it detects // that one row is out of order, it will stop returning them. The remaining rows will be sorted and added // to the outOfOrder set that will be later written to a new SSTable. OrderCheckerIterator sstableIterator = new OrderCheckerIterator(getIterator(key), cfs.metadata.comparator); try (UnfilteredRowIterator iterator = withValidation(sstableIterator, dataFile.getPath())) { if (prevKey != null && prevKey.compareTo(key) > 0) { saveOutOfOrderRow(prevKey, key, iterator); return false; } if (writer.tryAppend(iterator) == null) emptyRows++; else goodRows++; } if (sstableIterator.hasRowsOutOfOrder()) { outputHandler.warn(String.format("Out of order rows found in partition: %s", key)); outOfOrder.add(sstableIterator.getRowsOutOfOrder()); } return true; }
private void updateIndexKey() { currentIndexKey = nextIndexKey; currentRowPositionFromIndex = nextRowPositionFromIndex; try { nextIndexKey = !indexAvailable() ? null : ByteBufferUtil.readWithShortLength(indexFile); nextRowPositionFromIndex = !indexAvailable() ? dataFile.length() : rowIndexEntrySerializer.deserializePositionAndSkip(indexFile); } catch (Throwable th) { JVMStabilityInspector.inspectThrowable(th); outputHandler.warn("Error reading index file", th); nextIndexKey = null; nextRowPositionFromIndex = dataFile.length(); } }
private void updateIndexKey() { currentIndexKey = nextIndexKey; currentRowPositionFromIndex = nextRowPositionFromIndex; try { nextIndexKey = !indexAvailable() ? null : ByteBufferUtil.readWithShortLength(indexFile); nextRowPositionFromIndex = !indexAvailable() ? dataFile.length() : rowIndexEntrySerializer.deserializePositionAndSkip(indexFile); } catch (Throwable th) { JVMStabilityInspector.inspectThrowable(th); outputHandler.warn("Error reading index file", th); nextIndexKey = null; nextRowPositionFromIndex = dataFile.length(); } }
private void updateIndexKey() { currentIndexKey = nextIndexKey; currentRowPositionFromIndex = nextRowPositionFromIndex; try { nextIndexKey = !indexAvailable() ? null : ByteBufferUtil.readWithShortLength(indexFile); nextRowPositionFromIndex = !indexAvailable() ? dataFile.length() : rowIndexEntrySerializer.deserializePositionAndSkip(indexFile); } catch (Throwable th) { JVMStabilityInspector.inspectThrowable(th); outputHandler.warn("Error reading index file", th); nextIndexKey = null; nextRowPositionFromIndex = dataFile.length(); } }
private void updateIndexKey() { currentIndexKey = nextIndexKey; currentRowPositionFromIndex = nextRowPositionFromIndex; try { nextIndexKey = !indexAvailable() ? null : ByteBufferUtil.readWithShortLength(indexFile); nextRowPositionFromIndex = !indexAvailable() ? dataFile.length() : sstable.metadata.comparator.rowIndexEntrySerializer().deserialize(indexFile, sstable.descriptor.version).position; } catch (Throwable th) { JVMStabilityInspector.inspectThrowable(th); outputHandler.warn("Error reading index file", th); nextIndexKey = null; nextRowPositionFromIndex = dataFile.length(); } }