Skip to content

Commit

Permalink
add wait flag for gc check (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
ralph-pichler authored Mar 2, 2021
1 parent 0c50489 commit 8bdff89
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions cmd/beekeeper/cmd/check_gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import (

func (c *command) initCheckGc() *cobra.Command {
const (
optionNameDbCapacity = "db-capacity"
optionNameDivisor = "capacity-divisor"
optionNameSeed = "seed"
optionNameDbCapacity = "db-capacity"
optionNameDivisor = "capacity-divisor"
optionNameSeed = "seed"
optionNameWaitBeforeCheck = "wait"
)

cmd := &cobra.Command{
Expand Down Expand Up @@ -55,6 +56,7 @@ func (c *command) initCheckGc() *cobra.Command {
NodeGroup: "nodes",
StoreSize: c.config.GetInt(optionNameDbCapacity),
StoreSizeDivisor: c.config.GetInt(optionNameDivisor),
Wait: c.config.GetInt(optionNameWaitBeforeCheck),
Seed: seed,
})
},
Expand All @@ -64,6 +66,7 @@ func (c *command) initCheckGc() *cobra.Command {
cmd.Flags().Int(optionNameDbCapacity, 1000, "DB capacity in chunks")
cmd.Flags().Int(optionNameDivisor, 3, "divide store size by which value when uploading bytes")
cmd.Flags().Int64P(optionNameSeed, "s", 0, "seed for generating files; if not set, will be random")
cmd.Flags().IntP(optionNameWaitBeforeCheck, "w", 5, "wait before check")

return cmd
}
3 changes: 2 additions & 1 deletion pkg/check/gc/chunk_notfound.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type Options struct {
StoreSize int // size of the node's localstore in chunks
StoreSizeDivisor int // divide store size by how much when uploading bytes
Seed int64
Wait int
}

// CheckChunkNotFound uploads a single chunk to a node, then uploads a lot of other chunks to see that it has been purged with gc
Expand Down Expand Up @@ -60,7 +61,7 @@ func CheckChunkNotFound(c *bee.Cluster, o Options) error {
}

// allow time for syncing and GC
time.Sleep(5 * time.Second)
time.Sleep(time.Duration(o.Wait) * time.Second)

has, err := ng.NodeClient(pivotNode).HasChunk(ctx, ref)
if err != nil {
Expand Down

0 comments on commit 8bdff89

Please sign in to comment.