This repository was archived by the owner on Dec 5, 2024. It is now read-only.
This repository was archived by the owner on Dec 5, 2024. It is now read-only.
DBSettings should be initialized in writeLock #1254
Open
Description
org.ethereum.datasource.rocksdb.RocksDbDataSource#init(org.ethereum.datasource.DbSettings)
old code is:
public void init(DbSettings settings) {
(1)this.settings = settings;
(2)resetDbLock.writeLock().lock();
try {
logger.debug("~> RocksDbDataSource.init(): " + name);
but it should be like this:
public void init(DbSettings settings) {
resetDbLock.writeLock().lock();
try {
this.settings = settings;
logger.debug("~> RocksDbDataSource.init(): " + name);
For old code, if two thread(T1 and T2) call the method with different DbSettings, follow code may be wrong(T1(1)->T2(1)->T1(2)->T2(2)):
options.setMaxOpenFiles(settings.getMaxOpenFiles());
options.setIncreaseParallelism(settings.getMaxThreads());
Metadata
Metadata
Assignees
Labels
No labels