Skip to content

Commit

Permalink
Problem: need run fixdata multiple times when no timestamp checking (c…
Browse files Browse the repository at this point in the history
…rypto-org-chain#1748)

* Problem: need run fixdata multiple times when no timestamp checking

query with GetCFWithTS to compare both timestamp and key

* cleanup

* doc
  • Loading branch information
mmsqe committed Feb 24, 2025
1 parent e465f74 commit 2a0e608
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

* [#1720](https://github.com/crypto-org-chain/cronos/pull/1720) Include the fix of performance regression after upgrade in iavl.

### Improvements

* [#1747](https://github.com/crypto-org-chain/cronos/pull/1747) Skip batch initialization and flush when fixdata with dry-run.

*Nov 13, 2024*

## v1.3.4
Expand Down
6 changes: 3 additions & 3 deletions versiondb/tsrocksdb/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,14 @@ func (s Store) fixDataStore(storeName string, dryRun bool) error {
realKey := cloneAppend(prefix, pair.Key)

readOpts.SetTimestamp(pair.Timestamp)
oldValue, err := s.db.GetCF(readOpts, s.cfHandle, realKey)
oldValue, oldTimestamp, err := s.db.GetCFWithTS(readOpts, s.cfHandle, realKey)
if err != nil {
return err
}

clean := bytes.Equal(oldValue.Data(), pair.Value)
clean := bytes.Equal(oldValue.Data(), pair.Value) && bytes.Equal(oldTimestamp.Data(), pair.Timestamp)
oldValue.Free()

oldTimestamp.Free()
if clean {
continue
}
Expand Down

0 comments on commit 2a0e608

Please sign in to comment.