mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-11-20 15:15:18 +00:00
qol: disable compaction completely for now, also weave in notfound when relevant
This commit is contained in:
parent
741f545185
commit
0baa4ea341
@ -42,23 +42,6 @@ func newNode(
|
||||
execEngines[ceremonyExecutionEngine.GetName()] = ceremonyExecutionEngine
|
||||
}
|
||||
|
||||
intrinsicFilter := append(
|
||||
p2p.GetBloomFilter(application.CEREMONY_ADDRESS, 256, 3),
|
||||
p2p.GetBloomFilterIndices(application.CEREMONY_ADDRESS, 65536, 24)...,
|
||||
)
|
||||
logger.Info("running compaction")
|
||||
|
||||
if err := clockStore.Compact(
|
||||
intrinsicFilter,
|
||||
); err != nil {
|
||||
if errors.Is(err, store.ErrNotFound) {
|
||||
logger.Error("Missing compaction data. Skipping for now.", zap.Error(err))
|
||||
} else {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
logger.Info("compaction complete")
|
||||
|
||||
return &Node{
|
||||
logger,
|
||||
clockStore,
|
||||
|
23
node/main.go
23
node/main.go
@ -21,7 +21,10 @@ import (
|
||||
|
||||
"go.uber.org/zap"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"source.quilibrium.com/quilibrium/monorepo/node/execution/intrinsics/ceremony/application"
|
||||
"source.quilibrium.com/quilibrium/monorepo/node/p2p"
|
||||
"source.quilibrium.com/quilibrium/monorepo/node/protobufs"
|
||||
"source.quilibrium.com/quilibrium/monorepo/node/store"
|
||||
"source.quilibrium.com/quilibrium/monorepo/node/utils"
|
||||
|
||||
"github.com/libp2p/go-libp2p/core/crypto"
|
||||
@ -213,6 +216,26 @@ func main() {
|
||||
node.Stop()
|
||||
}
|
||||
|
||||
// Reintroduce at a later date
|
||||
func RunCompaction(clockStore *store.PebbleClockStore) {
|
||||
intrinsicFilter := append(
|
||||
p2p.GetBloomFilter(application.CEREMONY_ADDRESS, 256, 3),
|
||||
p2p.GetBloomFilterIndices(application.CEREMONY_ADDRESS, 65536, 24)...,
|
||||
)
|
||||
fmt.Println("running compaction")
|
||||
|
||||
if err := clockStore.Compact(
|
||||
intrinsicFilter,
|
||||
); err != nil {
|
||||
if errors.Is(err, store.ErrNotFound) {
|
||||
fmt.Println("missing compaction data, skipping for now", zap.Error(err))
|
||||
} else {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
fmt.Println("compaction complete")
|
||||
}
|
||||
|
||||
func RunSelfTestIfNeeded(
|
||||
configDir string,
|
||||
nodeConfig *config.Config,
|
||||
|
@ -611,6 +611,10 @@ func (p *PebbleClockStore) GetDataClockFrame(
|
||||
if len(value) == (len(filter) + 42) {
|
||||
frameValue, frameCloser, err := p.db.Get(value)
|
||||
if err != nil {
|
||||
if errors.Is(err, pebble.ErrNotFound) {
|
||||
return nil, nil, ErrNotFound
|
||||
}
|
||||
|
||||
return nil, nil, errors.Wrap(err, "get data clock frame")
|
||||
}
|
||||
if err := proto.Unmarshal(frameValue, frame); err != nil {
|
||||
@ -762,6 +766,10 @@ func (p *PebbleClockStore) GetLatestDataClockFrame(
|
||||
frameNumber := binary.BigEndian.Uint64(idxValue)
|
||||
frame, _, err := p.GetDataClockFrame(filter, frameNumber, false)
|
||||
if err != nil {
|
||||
if errors.Is(err, pebble.ErrNotFound) {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
return nil, errors.Wrap(err, "get latest data clock frame")
|
||||
}
|
||||
|
||||
@ -769,6 +777,10 @@ func (p *PebbleClockStore) GetLatestDataClockFrame(
|
||||
if proverTrie != nil {
|
||||
trieData, closer, err := p.db.Get(clockProverTrieKey(filter, frameNumber))
|
||||
if err != nil {
|
||||
if errors.Is(err, pebble.ErrNotFound) {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
return nil, errors.Wrap(err, "get latest data clock frame")
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user