qol: disable compaction completely for now, also weave in notfound when relevant

This commit is contained in:
Cassandra Heart 2024-03-24 21:00:45 -05:00
parent 741f545185
commit 0baa4ea341
No known key found for this signature in database
GPG Key ID: 6352152859385958
3 changed files with 35 additions and 17 deletions

View File

@ -42,23 +42,6 @@ func newNode(
execEngines[ceremonyExecutionEngine.GetName()] = ceremonyExecutionEngine 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{ return &Node{
logger, logger,
clockStore, clockStore,

View File

@ -21,7 +21,10 @@ import (
"go.uber.org/zap" "go.uber.org/zap"
"google.golang.org/protobuf/proto" "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/protobufs"
"source.quilibrium.com/quilibrium/monorepo/node/store"
"source.quilibrium.com/quilibrium/monorepo/node/utils" "source.quilibrium.com/quilibrium/monorepo/node/utils"
"github.com/libp2p/go-libp2p/core/crypto" "github.com/libp2p/go-libp2p/core/crypto"
@ -213,6 +216,26 @@ func main() {
node.Stop() 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( func RunSelfTestIfNeeded(
configDir string, configDir string,
nodeConfig *config.Config, nodeConfig *config.Config,

View File

@ -611,6 +611,10 @@ func (p *PebbleClockStore) GetDataClockFrame(
if len(value) == (len(filter) + 42) { if len(value) == (len(filter) + 42) {
frameValue, frameCloser, err := p.db.Get(value) frameValue, frameCloser, err := p.db.Get(value)
if err != nil { if err != nil {
if errors.Is(err, pebble.ErrNotFound) {
return nil, nil, ErrNotFound
}
return nil, nil, errors.Wrap(err, "get data clock frame") return nil, nil, errors.Wrap(err, "get data clock frame")
} }
if err := proto.Unmarshal(frameValue, frame); err != nil { if err := proto.Unmarshal(frameValue, frame); err != nil {
@ -762,6 +766,10 @@ func (p *PebbleClockStore) GetLatestDataClockFrame(
frameNumber := binary.BigEndian.Uint64(idxValue) frameNumber := binary.BigEndian.Uint64(idxValue)
frame, _, err := p.GetDataClockFrame(filter, frameNumber, false) frame, _, err := p.GetDataClockFrame(filter, frameNumber, false)
if err != nil { if err != nil {
if errors.Is(err, pebble.ErrNotFound) {
return nil, ErrNotFound
}
return nil, errors.Wrap(err, "get latest data clock frame") return nil, errors.Wrap(err, "get latest data clock frame")
} }
@ -769,6 +777,10 @@ func (p *PebbleClockStore) GetLatestDataClockFrame(
if proverTrie != nil { if proverTrie != nil {
trieData, closer, err := p.db.Get(clockProverTrieKey(filter, frameNumber)) trieData, closer, err := p.db.Get(clockProverTrieKey(filter, frameNumber))
if err != nil { if err != nil {
if errors.Is(err, pebble.ErrNotFound) {
return nil, ErrNotFound
}
return nil, errors.Wrap(err, "get latest data clock frame") return nil, errors.Wrap(err, "get latest data clock frame")
} }