e3: remove settings table (#946)

This commit is contained in:
Alex Sharov 2023-03-22 12:21:11 +07:00 committed by GitHub
parent dc74cf0404
commit 39f1d090c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 45 deletions

View File

@ -371,28 +371,24 @@ const (
AccountVals = "AccountVals"
AccountHistoryKeys = "AccountHistoryKeys"
AccountHistoryVals = "AccountHistoryVals"
AccountSettings = "AccountSettings"
AccountIdx = "AccountIdx"
StorageKeys = "StorageKeys"
StorageVals = "StorageVals"
StorageHistoryKeys = "StorageHistoryKeys"
StorageHistoryVals = "StorageHistoryVals"
StorageSettings = "StorageSettings"
StorageIdx = "StorageIdx"
CodeKeys = "CodeKeys"
CodeVals = "CodeVals"
CodeHistoryKeys = "CodeHistoryKeys"
CodeHistoryVals = "CodeHistoryVals"
CodeSettings = "CodeSettings"
CodeIdx = "CodeIdx"
CommitmentKeys = "CommitmentKeys"
CommitmentVals = "CommitmentVals"
CommitmentHistoryKeys = "CommitmentHistoryKeys"
CommitmentHistoryVals = "CommitmentHistoryVals"
CommitmentSettings = "CommitmentSettings"
CommitmentIdx = "CommitmentIdx"
LogAddressKeys = "LogAddressKeys"
@ -537,28 +533,24 @@ var ChaindataTables = []string{
AccountVals,
AccountHistoryKeys,
AccountHistoryVals,
AccountSettings,
AccountIdx,
StorageKeys,
StorageVals,
StorageHistoryKeys,
StorageHistoryVals,
StorageSettings,
StorageIdx,
CodeKeys,
CodeVals,
CodeHistoryKeys,
CodeHistoryVals,
CodeSettings,
CodeIdx,
CommitmentKeys,
CommitmentVals,
CommitmentHistoryKeys,
CommitmentHistoryVals,
CommitmentSettings,
CommitmentIdx,
LogAddressKeys,

View File

@ -116,17 +116,17 @@ func NewAggregator(dir, tmpdir string, aggregationStep uint64, commitmentMode Co
if err != nil {
return nil, err
}
if a.accounts, err = NewDomain(dir, tmpdir, aggregationStep, "accounts", kv.AccountKeys, kv.AccountVals, kv.AccountHistoryKeys, kv.AccountHistoryVals, kv.AccountSettings, kv.AccountIdx, false /* compressVals */, false); err != nil {
if a.accounts, err = NewDomain(dir, tmpdir, aggregationStep, "accounts", kv.AccountKeys, kv.AccountVals, kv.AccountHistoryKeys, kv.AccountHistoryVals, kv.AccountIdx, false, false); err != nil {
return nil, err
}
if a.storage, err = NewDomain(dir, tmpdir, aggregationStep, "storage", kv.StorageKeys, kv.StorageVals, kv.StorageHistoryKeys, kv.StorageHistoryVals, kv.StorageSettings, kv.StorageIdx, false /* compressVals */, false); err != nil {
if a.storage, err = NewDomain(dir, tmpdir, aggregationStep, "storage", kv.StorageKeys, kv.StorageVals, kv.StorageHistoryKeys, kv.StorageHistoryVals, kv.StorageIdx, false, false); err != nil {
return nil, err
}
if a.code, err = NewDomain(dir, tmpdir, aggregationStep, "code", kv.CodeKeys, kv.CodeVals, kv.CodeHistoryKeys, kv.CodeHistoryVals, kv.CodeSettings, kv.CodeIdx, true /* compressVals */, true); err != nil {
if a.code, err = NewDomain(dir, tmpdir, aggregationStep, "code", kv.CodeKeys, kv.CodeVals, kv.CodeHistoryKeys, kv.CodeHistoryVals, kv.CodeIdx, true, true); err != nil {
return nil, err
}
commitd, err := NewDomain(dir, tmpdir, aggregationStep, "commitment", kv.CommitmentKeys, kv.CommitmentVals, kv.CommitmentHistoryKeys, kv.CommitmentHistoryVals, kv.CommitmentSettings, kv.CommitmentIdx, false /* compressVals */, true)
commitd, err := NewDomain(dir, tmpdir, aggregationStep, "commitment", kv.CommitmentKeys, kv.CommitmentVals, kv.CommitmentHistoryKeys, kv.CommitmentHistoryVals, kv.CommitmentIdx, false, true)
if err != nil {
return nil, err
}

View File

@ -82,13 +82,13 @@ func NewAggregatorV3(ctx context.Context, dir, tmpdir string, aggregationStep ui
ctx, ctxCancel := context.WithCancel(ctx)
a := &AggregatorV3{ctx: ctx, ctxCancel: ctxCancel, onFreeze: func(frozenFileNames []string) {}, dir: dir, tmpdir: tmpdir, aggregationStep: aggregationStep, backgroundResult: &BackgroundResult{}, db: db, keepInDB: 2 * aggregationStep}
var err error
if a.accounts, err = NewHistory(dir, a.tmpdir, aggregationStep, "accounts", kv.AccountHistoryKeys, kv.AccountIdx, kv.AccountHistoryVals, kv.AccountSettings, false /* compressVals */, nil, false); err != nil {
if a.accounts, err = NewHistory(dir, a.tmpdir, aggregationStep, "accounts", kv.AccountHistoryKeys, kv.AccountIdx, kv.AccountHistoryVals, false, nil, false); err != nil {
return nil, err
}
if a.storage, err = NewHistory(dir, a.tmpdir, aggregationStep, "storage", kv.StorageHistoryKeys, kv.StorageIdx, kv.StorageHistoryVals, kv.StorageSettings, false /* compressVals */, nil, false); err != nil {
if a.storage, err = NewHistory(dir, a.tmpdir, aggregationStep, "storage", kv.StorageHistoryKeys, kv.StorageIdx, kv.StorageHistoryVals, false, nil, false); err != nil {
return nil, err
}
if a.code, err = NewHistory(dir, a.tmpdir, aggregationStep, "code", kv.CodeHistoryKeys, kv.CodeIdx, kv.CodeHistoryVals, kv.CodeSettings, true /* compressVals */, nil, true); err != nil {
if a.code, err = NewHistory(dir, a.tmpdir, aggregationStep, "code", kv.CodeHistoryKeys, kv.CodeIdx, kv.CodeHistoryVals, true, nil, true); err != nil {
return nil, err
}
if a.logAddrs, err = NewInvertedIndex(dir, a.tmpdir, aggregationStep, "logaddrs", kv.LogAddressKeys, kv.LogAddressIdx, false, nil); err != nil {

View File

@ -145,19 +145,9 @@ type Domain struct {
mergesCount uint64
}
func NewDomain(
dir, tmpdir string,
aggregationStep uint64,
filenameBase string,
keysTable string,
valsTable string,
indexKeysTable string,
historyValsTable string,
settingsTable string,
indexTable string,
compressVals bool,
largeValues bool,
) (*Domain, error) {
func NewDomain(dir, tmpdir string, aggregationStep uint64,
filenameBase, keysTable, valsTable, indexKeysTable, historyValsTable, indexTable string,
compressVals, largeValues bool) (*Domain, error) {
d := &Domain{
keysTable: keysTable,
valsTable: valsTable,
@ -166,7 +156,7 @@ func NewDomain(
}
var err error
if d.History, err = NewHistory(dir, tmpdir, aggregationStep, filenameBase, indexKeysTable, indexTable, historyValsTable, settingsTable, compressVals, []string{"kv"}, largeValues); err != nil {
if d.History, err = NewHistory(dir, tmpdir, aggregationStep, filenameBase, indexKeysTable, indexTable, historyValsTable, compressVals, []string{"kv"}, largeValues); err != nil {
return nil, err
}

View File

@ -56,7 +56,7 @@ func testDbAndDomain(t *testing.T) (string, kv.RwDB, *Domain) {
}
}).MustOpen()
t.Cleanup(db.Close)
d, err := NewDomain(path, path, 16 /* aggregationStep */, "base" /* filenameBase */, keysTable, valsTable, historyKeysTable, historyValsTable, settingsTable, indexTable, true /* compressVals */, false)
d, err := NewDomain(path, path, 16, "base", keysTable, valsTable, historyKeysTable, historyValsTable, indexTable, true, false)
require.NoError(t, err)
t.Cleanup(d.Close)
return path, db, d

View File

@ -63,7 +63,6 @@ type History struct {
roFiles atomic2.Pointer[[]ctxItem]
historyValsTable string // key1+key2+txnNum -> oldValue , stores values BEFORE change
settingsTable string
compressWorkers int
compressVals bool
integrityFileExtensions []string
@ -72,23 +71,13 @@ type History struct {
wal *historyWAL
}
func NewHistory(
dir, tmpdir string,
aggregationStep uint64,
filenameBase string,
indexKeysTable string,
indexTable string,
historyValsTable string,
settingsTable string,
compressVals bool,
integrityFileExtensions []string,
largeValues bool,
) (*History, error) {
func NewHistory(dir, tmpdir string, aggregationStep uint64,
filenameBase, indexKeysTable, indexTable, historyValsTable string,
compressVals bool, integrityFileExtensions []string, largeValues bool) (*History, error) {
h := History{
files: btree2.NewBTreeGOptions[*filesItem](filesItemLess, btree2.Options{Degree: 128, NoLocks: false}),
roFiles: *atomic2.NewPointer(&[]ctxItem{}),
historyValsTable: historyValsTable,
settingsTable: settingsTable,
compressVals: compressVals,
compressWorkers: 1,
integrityFileExtensions: integrityFileExtensions,

View File

@ -53,7 +53,7 @@ func testDbAndHistory(tb testing.TB, largeValues bool) (string, kv.RwDB, *Histor
settingsTable: kv.TableCfgItem{},
}
}).MustOpen()
h, err := NewHistory(path, path, 16 /* aggregationStep */, "hist" /* filenameBase */, keysTable, indexTable, valsTable, settingsTable, false /* compressVals */, nil, false)
h, err := NewHistory(path, path, 16, "hist", keysTable, indexTable, valsTable, false, nil, false)
require.NoError(tb, err)
tb.Cleanup(db.Close)
tb.Cleanup(h.Close)