diff --git a/go/storage/mkvs/db/rocksdb/iterator.go b/go/storage/mkvs/db/rocksdb/iterator.go index 663c5d5cff0..208bd0bd87b 100644 --- a/go/storage/mkvs/db/rocksdb/iterator.go +++ b/go/storage/mkvs/db/rocksdb/iterator.go @@ -81,6 +81,11 @@ func (itr *iterator) Key() []byte { return copyAndFreeSlice(itr.source.Key()) } +func (itr *iterator) Timestamp() []byte { + itr.assertIsValid() + return copyAndFreeSlice(itr.source.Timestamp()) +} + func (itr *iterator) Value() []byte { itr.assertIsValid() return copyAndFreeSlice(itr.source.Value()) diff --git a/go/storage/mkvs/db/rocksdb/rocksdb.go b/go/storage/mkvs/db/rocksdb/rocksdb.go index 0a20809ff57..178254ad286 100644 --- a/go/storage/mkvs/db/rocksdb/rocksdb.go +++ b/go/storage/mkvs/db/rocksdb/rocksdb.go @@ -108,7 +108,7 @@ func newOptions(versioned bool, maxCacheSize int64) *grocksdb.Options { // TODO: Consider separate options for state vs. io. opts := grocksdb.NewDefaultOptions() - opts.SetParanoidChecks(true) + // opts.SetParanoidChecks(true) opts.SetCreateIfMissing(true) if versioned { opts.SetComparator(createTimestampComparator()) @@ -828,23 +828,23 @@ func (d *rocksdbNodeDB) Prune(ctx context.Context, version uint64) error { itRo := timestampReadOptions(root.Version) defer itRo.Destroy() - s, ts, err := d.db.GetCFWithTS(itRo, cf, nodeKeyFmt.Encode(&h)) + s, itemTs, err := d.db.GetCFWithTS(itRo, cf, nodeKeyFmt.Encode(&h)) if err != nil { return false } defer s.Free() if !s.Exists() { - ts.Free() + itemTs.Free() return false } - itemTs, err := versionFromTimestamp(ts) + itemVersion, err := versionFromTimestamp(itemTs) if err != nil { // Shouldn't happen unless corrupted db. panic(fmt.Errorf("mkvs/rocksdb: missing/corrupted timestamp for node: %s", h)) } - if itemTs == version { - batch.DeleteCFWithTS(cf, nodeKeyFmt.Encode(&h), ts.Data()) + if itemVersion == version { + batch.DeleteCFWithTS(cf, nodeKeyFmt.Encode(&h), ts[:]) } return true })