Rename badBlocks, check failures in rocksdb iterator
This commit is contained in:
parent
0cb1ad55a8
commit
3df0dcf36a
@ -64,7 +64,7 @@ public interface LLDictionary extends LLKeyValueDatabaseStructure {
|
||||
int prefixLength,
|
||||
boolean smallRange);
|
||||
|
||||
Stream<VerificationProgress> badBlocks(LLRange range);
|
||||
Stream<VerificationProgress> verifyChecksum(LLRange range);
|
||||
|
||||
void setRange(LLRange range, Stream<LLEntry> entries, boolean smallRange);
|
||||
|
||||
|
@ -269,8 +269,8 @@ public class DatabaseMapDictionaryDeep<T, U, US extends DatabaseStage<U>> implem
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<VerificationProgress> badBlocks() {
|
||||
return dictionary.badBlocks(range);
|
||||
public Stream<VerificationProgress> verifyChecksum() {
|
||||
return dictionary.verifyChecksum(range);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -148,8 +148,8 @@ public class DatabaseMapDictionaryHashed<T, U, TH> implements DatabaseStageMap<T
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<VerificationProgress> badBlocks() {
|
||||
return this.subDictionary.badBlocks();
|
||||
public Stream<VerificationProgress> verifyChecksum() {
|
||||
return this.subDictionary.verifyChecksum();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -121,8 +121,8 @@ public final class DatabaseMapSingle<U> implements DatabaseStageEntry<U> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<VerificationProgress> badBlocks() {
|
||||
return dictionary.badBlocks(LLRange.single(key));
|
||||
public Stream<VerificationProgress> verifyChecksum() {
|
||||
return dictionary.verifyChecksum(LLRange.single(key));
|
||||
}
|
||||
|
||||
}
|
@ -124,8 +124,8 @@ public class DatabaseSingleBucket<K, V, TH> implements DatabaseStageEntry<V> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<VerificationProgress> badBlocks() {
|
||||
return bucketStage.badBlocks();
|
||||
public Stream<VerificationProgress> verifyChecksum() {
|
||||
return bucketStage.verifyChecksum();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -107,8 +107,8 @@ public class DatabaseSingleMapped<A, B> implements DatabaseStageEntry<A> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<VerificationProgress> badBlocks() {
|
||||
return this.serializedSingle.badBlocks();
|
||||
public Stream<VerificationProgress> verifyChecksum() {
|
||||
return this.serializedSingle.verifyChecksum();
|
||||
}
|
||||
|
||||
private A unMap(B bytes) throws SerializationException {
|
||||
|
@ -119,7 +119,7 @@ public class DatabaseSingleton<U> implements DatabaseStageEntry<U> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<VerificationProgress> badBlocks() {
|
||||
public Stream<VerificationProgress> verifyChecksum() {
|
||||
return Stream.empty();
|
||||
}
|
||||
}
|
@ -64,5 +64,5 @@ public interface DatabaseStage<T> extends DatabaseStageWithEntry<T> {
|
||||
return leavesCount(snapshot, false) <= 0;
|
||||
}
|
||||
|
||||
Stream<VerificationProgress> badBlocks();
|
||||
Stream<VerificationProgress> verifyChecksum();
|
||||
}
|
||||
|
@ -637,7 +637,7 @@ public class LLLocalDictionary implements LLDictionary {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<VerificationProgress> badBlocks(LLRange rangeFull) {
|
||||
public Stream<VerificationProgress> verifyChecksum(LLRange rangeFull) {
|
||||
Set<String> brokenFiles = new ConcurrentHashMap<String, Boolean>().keySet(true);
|
||||
LongAdder totalScanned = new LongAdder();
|
||||
AtomicLong totalEstimate = new AtomicLong();
|
||||
|
@ -438,8 +438,7 @@ public class LLLocalKeyValueDatabase extends Backuppable implements LLKeyValueDa
|
||||
}
|
||||
this.db = RocksDB.openAsSecondary(rocksdbOptions,
|
||||
dbPathString,
|
||||
secondaryPath
|
||||
.toString(),
|
||||
secondaryPath.toString(),
|
||||
descriptors,
|
||||
handles
|
||||
);
|
||||
|
@ -47,7 +47,11 @@ public final class LLLocalMigrationReactiveRocksIterator {
|
||||
if (iterator.isValid()) {
|
||||
var key = iterator.keyBuf().copy();
|
||||
var value = iterator.valueBuf().copy();
|
||||
iterator.next(false);
|
||||
try {
|
||||
iterator.next(false);
|
||||
} catch (RocksDBException e) {
|
||||
throw new CompletionException(e);
|
||||
}
|
||||
return LLEntry.of(key, value);
|
||||
} else {
|
||||
return null;
|
||||
|
@ -50,7 +50,6 @@ public class RocksIteratorObj extends SimpleResource {
|
||||
|
||||
public synchronized void seek(byte[] seekArray) throws RocksDBException {
|
||||
ensureOpen();
|
||||
rocksIterator.status();
|
||||
startedIterSeek.increment();
|
||||
try {
|
||||
iterSeekTime.record(() -> rocksIterator.seek(seekArray));
|
||||
@ -102,7 +101,6 @@ public class RocksIteratorObj extends SimpleResource {
|
||||
*/
|
||||
public synchronized void seekTo(Buf key) throws RocksDBException {
|
||||
ensureOpen();
|
||||
rocksIterator.status();
|
||||
var keyArray = LLUtils.asArray(key);
|
||||
startedIterSeek.increment();
|
||||
try {
|
||||
@ -166,7 +164,7 @@ public class RocksIteratorObj extends SimpleResource {
|
||||
next(true);
|
||||
}
|
||||
|
||||
public synchronized void next(boolean traceStats) {
|
||||
public synchronized void next(boolean traceStats) throws RocksDBException {
|
||||
ensureOpen();
|
||||
if (traceStats) {
|
||||
startedIterNext.increment();
|
||||
@ -175,13 +173,14 @@ public class RocksIteratorObj extends SimpleResource {
|
||||
} else {
|
||||
rocksIterator.next();
|
||||
}
|
||||
rocksIterator.status();
|
||||
}
|
||||
|
||||
public void prev() throws RocksDBException {
|
||||
prev(true);
|
||||
}
|
||||
|
||||
public synchronized void prev(boolean traceStats) {
|
||||
public synchronized void prev(boolean traceStats) throws RocksDBException {
|
||||
ensureOpen();
|
||||
if (traceStats) {
|
||||
startedIterNext.increment();
|
||||
@ -190,6 +189,7 @@ public class RocksIteratorObj extends SimpleResource {
|
||||
} else {
|
||||
rocksIterator.prev();
|
||||
}
|
||||
rocksIterator.status();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -358,7 +358,7 @@ public class LLMemoryDictionary implements LLDictionary {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<VerificationProgress> badBlocks(LLRange range) {
|
||||
public Stream<VerificationProgress> verifyChecksum(LLRange range) {
|
||||
return Stream.empty();
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ public class Repair {
|
||||
db.getAllColumnFamilyHandles().forEach((column, cfh) -> {
|
||||
System.err.printf("Scanning column: %s%n", column.name());
|
||||
LLLocalDictionary dict = db.getDictionary(column.name().getBytes(StandardCharsets.UTF_8), UpdateMode.DISALLOW);
|
||||
StreamUtils.collectOn(StreamUtils.ROCKSDB_POOL, dict.badBlocks(LLRange.all()), StreamUtils.executing(block -> {
|
||||
StreamUtils.collectOn(StreamUtils.ROCKSDB_POOL, dict.verifyChecksum(LLRange.all()), StreamUtils.executing(block -> {
|
||||
synchronized (Repair.class) {
|
||||
switch (block) {
|
||||
case null -> {}
|
||||
|
Loading…
Reference in New Issue
Block a user