Skip to content

Commit

Permalink
Problem: need run fixdata multiple times when no timestamp checking (#…
Browse files Browse the repository at this point in the history
…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 authored Feb 18, 2025
1 parent b2742e2 commit a0d77b3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
* [#1720](https://github.com/crypto-org-chain/cronos/pull/1720) Include the fix of performance regression after upgrade in iavl.
* [#1725](https://github.com/crypto-org-chain/cronos/pull/1725) Include the fix of deadlock when close tree in iavl.
* [#1724](https://github.com/crypto-org-chain/cronos/pull/1724) Include the fix of nonce management in batch tx in ethermint.
* [#1748](https://github.com/crypto-org-chain/cronos/pull/1748) Query with GetCFWithTS to compare both timestamp and key to avoid run fixdata multiple times.

### Improvements

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

### State Machine Breaking

Expand All @@ -24,7 +29,6 @@
### Improvements

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

*Dec 2, 2024*

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 a0d77b3

Please sign in to comment.