Skip to content

Commit

Permalink
remove domain keys tables (#12021)
Browse files Browse the repository at this point in the history
  • Loading branch information
AskAlexSharov authored Sep 18, 2024
1 parent 2ed4f88 commit 8f5517c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 25 deletions.
1 change: 0 additions & 1 deletion core/rawdb/rawdbreset/reset_stages.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ var stateHistoryV3Buckets = []string{
kv.TblTracesToKeys, kv.TblTracesToIdx,
}
var stateV3Buckets = []string{
kv.TblAccountKeys, kv.TblStorageKeys, kv.TblCodeKeys, kv.TblCommitmentKeys,
kv.TblAccountVals, kv.TblStorageVals, kv.TblCodeVals, kv.TblCommitmentVals,
kv.TblCommitmentHistoryKeys, kv.TblCommitmentHistoryVals, kv.TblCommitmentIdx,
kv.TblPruningProgress,
Expand Down
12 changes: 0 additions & 12 deletions erigon-lib/kv/tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,25 +352,21 @@ const (
// Domains/History/InvertedIndices
// Contants have "Tbl" prefix, to avoid collision with actual Domain names
// This constants is very rarely used in APP, but Domain/History/Idx names are widely used
TblAccountKeys = "AccountKeys"
TblAccountVals = "AccountVals"
TblAccountHistoryKeys = "AccountHistoryKeys"
TblAccountHistoryVals = "AccountHistoryVals"
TblAccountIdx = "AccountIdx"

TblStorageKeys = "StorageKeys"
TblStorageVals = "StorageVals"
TblStorageHistoryKeys = "StorageHistoryKeys"
TblStorageHistoryVals = "StorageHistoryVals"
TblStorageIdx = "StorageIdx"

TblCodeKeys = "CodeKeys"
TblCodeVals = "CodeVals"
TblCodeHistoryKeys = "CodeHistoryKeys"
TblCodeHistoryVals = "CodeHistoryVals"
TblCodeIdx = "CodeIdx"

TblCommitmentKeys = "CommitmentKeys"
TblCommitmentVals = "CommitmentVals"
TblCommitmentHistoryKeys = "CommitmentHistoryKeys"
TblCommitmentHistoryVals = "CommitmentHistoryVals"
Expand Down Expand Up @@ -549,25 +545,21 @@ var ChaindataTables = []string{
BorCheckpoints,
BorCheckpointEnds,
BorProducerSelections,
TblAccountKeys,
TblAccountVals,
TblAccountHistoryKeys,
TblAccountHistoryVals,
TblAccountIdx,

TblStorageKeys,
TblStorageVals,
TblStorageHistoryKeys,
TblStorageHistoryVals,
TblStorageIdx,

TblCodeKeys,
TblCodeVals,
TblCodeHistoryKeys,
TblCodeHistoryVals,
TblCodeIdx,

TblCommitmentKeys,
TblCommitmentVals,
TblCommitmentHistoryKeys,
TblCommitmentHistoryVals,
Expand Down Expand Up @@ -717,20 +709,16 @@ var ChaindataTablesCfg = TableCfg{
},
CallTraceSet: {Flags: DupSort},

TblAccountKeys: {Flags: DupSort},
TblAccountVals: {Flags: DupSort},
TblAccountHistoryKeys: {Flags: DupSort},
TblAccountHistoryVals: {Flags: DupSort},
TblAccountIdx: {Flags: DupSort},
TblStorageKeys: {Flags: DupSort},
TblStorageVals: {Flags: DupSort},
TblStorageHistoryKeys: {Flags: DupSort},
TblStorageHistoryVals: {Flags: DupSort},
TblStorageIdx: {Flags: DupSort},
TblCodeKeys: {Flags: DupSort},
TblCodeHistoryKeys: {Flags: DupSort},
TblCodeIdx: {Flags: DupSort},
TblCommitmentKeys: {Flags: DupSort},
TblCommitmentVals: {Flags: DupSort},
TblCommitmentHistoryKeys: {Flags: DupSort},
TblCommitmentHistoryVals: {Flags: DupSort},
Expand Down
24 changes: 12 additions & 12 deletions erigon-lib/state/domain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1583,16 +1583,16 @@ func TestPruneProgress(t *testing.T) {
tx, err := db.BeginRw(context.Background())
require.NoError(t, err)
defer tx.Rollback()
err = SaveExecV3PruneProgress(tx, kv.TblAccountKeys, latestKey)
err = SaveExecV3PruneProgress(tx, kv.TblAccountVals, latestKey)
require.NoError(t, err)
key, err := GetExecV3PruneProgress(tx, kv.TblAccountKeys)
key, err := GetExecV3PruneProgress(tx, kv.TblAccountVals)
require.NoError(t, err)
require.EqualValuesf(t, latestKey, key, "key %x", key)

err = SaveExecV3PruneProgress(tx, kv.TblAccountKeys, nil)
err = SaveExecV3PruneProgress(tx, kv.TblAccountVals, nil)
require.NoError(t, err)

key, err = GetExecV3PruneProgress(tx, kv.TblAccountKeys)
key, err = GetExecV3PruneProgress(tx, kv.TblAccountVals)
require.NoError(t, err)
require.Nil(t, key)
})
Expand All @@ -1601,17 +1601,17 @@ func TestPruneProgress(t *testing.T) {
tx, err := db.BeginRw(context.Background())
require.NoError(t, err)
defer tx.Rollback()
err = SaveExecV3PruneProgress(tx, kv.TblAccountKeys, latestKey)
err = SaveExecV3PruneProgress(tx, kv.TblAccountVals, latestKey)
require.NoError(t, err)

key, err := GetExecV3PruneProgress(tx, kv.TblAccountKeys)
key, err := GetExecV3PruneProgress(tx, kv.TblAccountVals)
require.NoError(t, err)
require.EqualValues(t, latestKey, key)

err = SaveExecV3PruneProgress(tx, kv.TblAccountKeys, nil)
err = SaveExecV3PruneProgress(tx, kv.TblAccountVals, nil)
require.NoError(t, err)

key, err = GetExecV3PruneProgress(tx, kv.TblAccountKeys)
key, err = GetExecV3PruneProgress(tx, kv.TblAccountVals)
require.NoError(t, err)
require.Nil(t, key)
})
Expand All @@ -1621,17 +1621,17 @@ func TestPruneProgress(t *testing.T) {
require.NoError(t, err)
defer tx.Rollback()
expected := []byte{}
err = SaveExecV3PruneProgress(tx, kv.TblAccountKeys, expected)
err = SaveExecV3PruneProgress(tx, kv.TblAccountVals, expected)
require.NoError(t, err)

key, err := GetExecV3PruneProgress(tx, kv.TblAccountKeys)
key, err := GetExecV3PruneProgress(tx, kv.TblAccountVals)
require.NoError(t, err)
require.EqualValues(t, expected, key)

err = SaveExecV3PruneProgress(tx, kv.TblAccountKeys, nil)
err = SaveExecV3PruneProgress(tx, kv.TblAccountVals, nil)
require.NoError(t, err)

key, err = GetExecV3PruneProgress(tx, kv.TblAccountKeys)
key, err = GetExecV3PruneProgress(tx, kv.TblAccountVals)
require.NoError(t, err)
require.Nil(t, key)
})
Expand Down

0 comments on commit 8f5517c

Please sign in to comment.