@Override
    public boolean init(final RocksDBOptions opts) {
        final Lock writeLock = this.readWriteLock.writeLock();
        writeLock.lock();
        try {
            if (this.db != null) {
                LOG.info("[RocksRawKVStore] already started.");
                return true;
            }
            this.opts = opts;
            this.options = createDBOptions(groupId);
            if (opts.isOpenStatisticsCollector()) {
                this.statistics = new DebugStatistics();
                this.options.setStatistics(this.statistics);
                final long intervalSeconds = opts.getStatisticsCallbackIntervalSeconds();
                if (intervalSeconds > 0) {
                    this.statisticsCollector = new RocksStatisticsCollector(TimeUnit.SECONDS.toMillis(intervalSeconds));
                    this.statisticsCollector.start();
                }
            }
            final ColumnFamilyOptions cfOptions = createColumnFamilyOptions(groupId);
            this.cfOptionsList.add(cfOptions);
            // default column family
            this.cfDescriptors.add(new ColumnFamilyDescriptor(RocksDB.DEFAULT_COLUMN_FAMILY, cfOptions));
            // sequence column family
            this.cfDescriptors.add(new ColumnFamilyDescriptor(BytesUtil.writeUtf8("RHEA_SEQUENCE"), cfOptions));
            // locking column family
            this.cfDescriptors.add(new ColumnFamilyDescriptor(BytesUtil.writeUtf8("RHEA_LOCKING"), cfOptions));
            // fencing column family
            this.cfDescriptors.add(new ColumnFamilyDescriptor(BytesUtil.writeUtf8("RHEA_FENCING"), cfOptions));
            this.writeOptions = new WriteOptions();
            this.writeOptions.setSync(opts.isSync());
            // If `sync` is true, `disableWAL` must be set false.
            this.writeOptions.setDisableWAL(!opts.isSync() && opts.isDisableWAL());
            // Delete existing data, relying on raft's snapshot and log playback
            // to reply to the data is the correct behavior.
            destroyRocksDB(opts);
            openRocksDB(opts);
            this.shutdownLock.setMaxPermits(1);
            LOG.info("[RocksRawKVStore] start successfully, options: {}.", opts);
            return true;
        } catch (final Exception e) {
            LOG.error("Fail to open rocksDB at path {}, {}.", opts.getDbPath(), StackTraceUtil.stackTrace(e));
        } finally {
            writeLock.unlock();
        }
        return false;
    }
Local KV store based on RocksDB

@author dennis
@author jiachun.fjc
jraft-rheakv/rheakv-core/src/main/java/com/alipay/sofa/jraft/rhea/storage/RocksRawKVStore.java