Skip to content
This repository was archived by the owner on Jan 20, 2026. It is now read-only.

Commit c88ff86

Browse files
committed
Fix for rocksdb
1 parent ae39c82 commit c88ff86

1 file changed

Lines changed: 16 additions & 19 deletions

File tree

ss/rocksdb/db.go

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -110,20 +110,18 @@ func New(dataDir string, config config.StateStoreConfig) (*Database, error) {
110110
pendingChanges: make(chan VersionedChangesets, config.AsyncWriteBuffer),
111111
}
112112

113-
if config.DedicatedChangelog {
114-
streamHandler, _ := changelog.NewStream(
115-
logger.NewNopLogger(),
116-
utils.GetChangelogPath(dataDir),
117-
changelog.Config{
118-
DisableFsync: true,
119-
ZeroCopy: true,
120-
KeepRecent: uint64(config.KeepRecent),
121-
PruneInterval: 300 * time.Second,
122-
},
123-
)
124-
database.streamHandler = streamHandler
125-
go database.writeAsyncInBackground()
126-
}
113+
streamHandler, _ := changelog.NewStream(
114+
logger.NewNopLogger(),
115+
utils.GetChangelogPath(dataDir),
116+
changelog.Config{
117+
DisableFsync: true,
118+
ZeroCopy: true,
119+
KeepRecent: uint64(config.KeepRecent),
120+
PruneInterval: time.Duration(config.PruneIntervalSeconds) * time.Second,
121+
},
122+
)
123+
database.streamHandler = streamHandler
124+
go database.writeAsyncInBackground()
127125

128126
return database, nil
129127
}
@@ -494,17 +492,16 @@ func (db *Database) WriteBlockRangeHash(storeKey string, beginBlockRange, endBlo
494492
}
495493

496494
func (db *Database) Close() error {
495+
// Close the pending changes channel to signal the background goroutine to stop
496+
close(db.pendingChanges)
497+
// Wait for the async writes to finish processing all buffered items
498+
db.asyncWriteWG.Wait()
497499
if db.streamHandler != nil {
498500
// Close the changelog stream first
499501
db.streamHandler.Close()
500-
// Close the pending changes channel to signal the background goroutine to stop
501-
close(db.pendingChanges)
502-
// Wait for the async writes to finish processing all buffered items
503-
db.asyncWriteWG.Wait()
504502
// Only set to nil after background goroutine has finished
505503
db.streamHandler = nil
506504
}
507-
508505
db.storage.Close()
509506
db.storage = nil
510507
db.cfHandle = nil

0 commit comments

Comments
 (0)