tangled
alpha
login
or
join now
gbl08ma.com
/
didplcbft
24
fork
atom
A very experimental PLC implementation which uses BFT consensus for decentralization
24
fork
atom
overview
issues
pulls
pipelines
Fine-tuning
gbl08ma.com
2 months ago
562e402d
d65facfb
verified
This commit was signed with the committer's
known signature
.
gbl08ma.com
SSH Key Fingerprint:
SHA256:NkaTDGnGWRZlEnrKxt4ih8fpbNEuHeYdbkJk7VYd+1o=
+12
-5
3 changed files
expand all
collapse all
unified
split
abciapp
app.go
execution.go
main.go
+2
-2
abciapp/app.go
···
37
37
func NewDIDPLCApplication(badgerDB *badger.DB, snapshotDirectory string) (*DIDPLCApplication, plc.PLC, func(), error) {
38
38
treePrefix := []byte{}
39
39
mkTree := func() *iavl.MutableTree {
40
40
-
return iavl.NewMutableTree(badgeradapter.AdaptBadger(badgerDB, treePrefix), 2048, false, iavl.NewNopLogger(), iavl.AsyncPruningOption(true))
40
40
+
return iavl.NewMutableTree(badgeradapter.AdaptBadger(badgerDB, treePrefix), 2048, false, iavl.NewNopLogger(), iavl.AsyncPruningOption(false))
41
41
}
42
42
43
43
tree := mkTree()
···
102
102
case <-time.After(5 * time.Minute):
103
103
}
104
104
treeVersion := tree.Version()
105
105
-
if treeVersion > int64(lastSnapshotVersion+1000) {
105
105
+
if treeVersion > int64(lastSnapshotVersion+10000) {
106
106
err = d.createSnapshot(treeVersion, filepath.Join(snapshotDirectory, "snapshot.tmp"))
107
107
if err != nil {
108
108
fmt.Println("FAILED TO TAKE SNAPSHOT", stacktrace.Propagate(err, ""))
+3
-2
abciapp/execution.go
···
5
5
"context"
6
6
"fmt"
7
7
"slices"
8
8
+
"strings"
8
9
"time"
9
10
10
11
abcitypes "github.com/cometbft/cometbft/abci/types"
···
214
215
}
215
216
}
216
217
217
217
-
minHeightToKeep := max(newVersion-100, 0)
218
218
+
minHeightToKeep := max(newVersion-5, 0)
218
219
minVerToKeep := max(minHeightToKeep-5, 0)
219
220
if minVerToKeep > 0 {
220
221
err = d.tree.DeleteVersionsTo(minVerToKeep)
221
221
-
if err != nil {
222
222
+
if err != nil && !strings.Contains(err.Error(), "active readers") {
222
223
return nil, stacktrace.Propagate(err, "")
223
224
}
224
225
}
+7
-1
main.go
···
55
55
badgerDBPath := filepath.Join(homeDir, "badger")
56
56
badgerDB, err := badger.Open(badger.
57
57
DefaultOptions(badgerDBPath).
58
58
+
WithBlockCacheSize(2 << 30).
58
59
WithBlockSize(8 * 1024).
59
60
WithNumMemtables(3).
60
61
WithNumLevelZeroTables(3).
61
61
-
WithCompression(options.ZSTD))
62
62
+
WithCompression(options.Snappy))
62
63
if err != nil {
63
64
log.Fatalf("Opening badger database: %v", err)
64
65
}
···
66
67
for err == nil {
67
68
err = badgerDB.RunValueLogGC(0.5)
68
69
}
70
70
+
71
71
+
/*err = badgerDB.Flatten(4)
72
72
+
if err != nil {
73
73
+
log.Fatalf("Flattening badger database: %v", err)
74
74
+
}*/
69
75
70
76
var wg sync.WaitGroup
71
77
closeGoroutinesCh := make(chan struct{})