Skip to content

Commit

Permalink
fixed rollups
Browse files Browse the repository at this point in the history
  • Loading branch information
harshil-goel committed Dec 27, 2024
1 parent 1ca15d4 commit 6569378
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 26 deletions.
3 changes: 0 additions & 3 deletions dgraphtest/paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ func init() {
if err != nil {
panic(err)
}
if err := ensureDgraphClone(); err != nil {
panic(err)
}

log.Printf("[INFO] baseRepoDir: %v", baseRepoDir)
log.Printf("[INFO] repoDir: %v", repoDir)
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@ github.com/dgraph-io/gqlparser/v2 v2.2.2 h1:CnxXOKL4EPguKqcGV/z4u4VoW5izUkOTIsNM
github.com/dgraph-io/gqlparser/v2 v2.2.2/go.mod h1:MYS4jppjyx8b9tuUtjV7jU1UFZK6P9fvO8TsIsQtRKU=
github.com/dgraph-io/graphql-transport-ws v0.0.0-20210511143556-2cef522f1f15 h1:X2NRsgAtVUAp2nmTPCq+x+wTcRRrj74CEpy7E0Unsl4=
github.com/dgraph-io/graphql-transport-ws v0.0.0-20210511143556-2cef522f1f15/go.mod h1:7z3c/5w0sMYYZF5bHsrh8IH4fKwG5O5Y70cPH1ZLLRQ=
github.com/dgraph-io/ristretto/v2 v2.0.1-0.20241225051636-a881a3ee595b h1:HFfYu0UFFwjUU2q63wTtNtc4vXQbw55m2WVoMcFXhzA=
github.com/dgraph-io/ristretto/v2 v2.0.1-0.20241225051636-a881a3ee595b/go.mod h1:K7caLeufSdxm+ITp1n/73U+VbFVAHrexfLbz4n14hpo=
github.com/dgraph-io/ristretto/v2 v2.0.1-0.20241225154905-c692ff024470 h1:rVn0l0Hvab+/kCvTMFrUFtRtob+jagzgVVSfbyqCJ5E=
github.com/dgraph-io/ristretto/v2 v2.0.1-0.20241225154905-c692ff024470/go.mod h1:K7caLeufSdxm+ITp1n/73U+VbFVAHrexfLbz4n14hpo=
github.com/dgraph-io/simdjson-go v0.3.0 h1:h71LO7vR4LHMPUhuoGN8bqGm1VNfGOlAG8BI6iDUKw0=
Expand Down
40 changes: 19 additions & 21 deletions posting/mvcc.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,25 +171,25 @@ func (ir *incrRollupi) addKeyToBatch(key []byte, priority int) {
}
}

func (ir *incrRollupi) mem(getNewTs func(bool) uint64) {
forceRollupTick := time.NewTicker(500 * time.Millisecond)
defer forceRollupTick.Stop()
deleteCacheTick := time.NewTicker(1 * time.Second)
defer deleteCacheTick.Stop()

for {
select {
case <-deleteCacheTick.C:
//memoryLayer.deleteOldItems(ir.getNewTs(false))
case <-forceRollupTick.C:
t := 10000
memoryLayer.insert += t
if memoryLayer.insert > 5*t {
memoryLayer.insert = 5 * t
}
}
}
}
// func (ir *incrRollupi) mem(getNewTs func(bool) uint64) {
// forceRollupTick := time.NewTicker(500 * time.Millisecond)
// defer forceRollupTick.Stop()
// deleteCacheTick := time.NewTicker(1 * time.Second)
// defer deleteCacheTick.Stop()
//
// for {
// select {
// case <-deleteCacheTick.C:
// //memoryLayer.deleteOldItems(ir.getNewTs(false))
// case <-forceRollupTick.C:
// t := 10000
// memoryLayer.insert += t
// if memoryLayer.insert > 5*t {
// memoryLayer.insert = 5 * t
// }
// }
// }
// }

// Process will rollup batches of 64 keys in a go routine.
func (ir *incrRollupi) Process(closer *z.Closer, getNewTs func(bool) uint64) {
Expand All @@ -209,8 +209,6 @@ func (ir *incrRollupi) Process(closer *z.Closer, getNewTs func(bool) uint64) {
forceRollupTick := time.NewTicker(500 * time.Millisecond)
defer forceRollupTick.Stop()

ir.mem(getNewTs)

doRollup := func(batch *[][]byte, priority int) {
currTs := time.Now().Unix()
for _, key := range *batch {
Expand Down

0 comments on commit 6569378

Please sign in to comment.