Skip to content

Commit 9711b73

Browse files
author
HuangYi
committed
cleanup
1 parent 9711730 commit 9711b73

File tree

5 files changed

+4
-86
lines changed

5 files changed

+4
-86
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Bug Fixes
66

77
* [#1679](https://github.com/crypto-org-chain/cronos/pull/1679) Include no trace detail on insufficient balance fix.
8+
* [#1685](https://github.com/crypto-org-chain/cronos/pull/1685) Fix versiondb corrupted data on startup.
89

910
### Improvements
1011

app/versiondb.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ func (app *App) setupVersionDB(
3535
return nil, err
3636
}
3737

38+
// see: https://github.com/crypto-org-chain/cronos/issues/1683
3839
if err := versionDB.FixData(exposedKeys); err != nil {
3940
return nil, err
4041
}

versiondb/client/cmd.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ func ChangeSetGroupCmd(opts Options) *cobra.Command {
2828
ChangeSetToVersionDBCmd(),
2929
RestoreAppDBCmd(opts),
3030
RestoreVersionDBCmd(),
31-
FixDataCmd(),
3231
)
3332
return cmd
3433
}

versiondb/client/fixdata.go

Lines changed: 0 additions & 83 deletions
This file was deleted.

versiondb/tsrocksdb/store.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ func (s Store) fixDataStore(name string) error {
257257
batch := grocksdb.NewWriteBatch()
258258
defer batch.Destroy()
259259

260+
prefix := storePrefix(name)
260261
for ; iter.Valid(); iter.Next() {
261262
key := iter.Key()
262263
if len(key) < TimestampSize {
@@ -280,8 +281,7 @@ func (s Store) fixDataStore(name string) error {
280281
continue
281282
}
282283

283-
fmt.Println("[debug] fix key", string(key), "ts", binary.LittleEndian.Uint64(ts))
284-
batch.PutCFWithTS(s.cfHandle, key, ts, iter.Value())
284+
batch.PutCFWithTS(s.cfHandle, cloneAppend(prefix, key), ts, iter.Value())
285285
}
286286

287287
return s.db.Write(defaultSyncWriteOpts, batch)

0 commit comments

Comments
 (0)