Skip to content

Commit 8318708

Browse files
committed
feat(db): remove auto-repair for leveldb
1 parent dcf8982 commit 8318708

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

chainbase/src/main/java/org/tron/common/storage/leveldb/LevelDbDataSourceImpl.java

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -142,22 +142,11 @@ private void openDatabase(Options dbOptions) throws IOException {
142142
if (!Files.isSymbolicLink(dbPath.getParent())) {
143143
Files.createDirectories(dbPath.getParent());
144144
}
145-
try {
146-
database = factory.open(dbPath.toFile(), dbOptions);
147-
if (!this.getDBName().startsWith("checkpoint")) {
148-
logger.info("DB {} open success with writeBufferSize {} M, cacheSize {} M, maxOpenFiles {}.",
149-
this.getDBName(), dbOptions.writeBufferSize() / 1024 / 1024,
150-
dbOptions.cacheSize() / 1024 / 1024, dbOptions.maxOpenFiles());
151-
}
152-
} catch (IOException e) {
153-
if (e.getMessage().contains("Corruption:")) {
154-
logger.warn("DB {} corruption detected, try to repair it.", this.getDBName(), e);
155-
factory.repair(dbPath.toFile(), dbOptions);
156-
logger.warn("DB {} corruption detected, repair done.", this.getDBName());
157-
database = factory.open(dbPath.toFile(), dbOptions);
158-
} else {
159-
throw e;
160-
}
145+
database = factory.open(dbPath.toFile(), dbOptions);
146+
if (!this.getDBName().startsWith("checkpoint")) {
147+
logger.info("DB {} open success with writeBufferSize {} M, cacheSize {} M, maxOpenFiles {}.",
148+
this.getDBName(), dbOptions.writeBufferSize() / 1024 / 1024,
149+
dbOptions.cacheSize() / 1024 / 1024, dbOptions.maxOpenFiles());
161150
}
162151
}
163152

0 commit comments

Comments
 (0)