Skip to content

Commit

Permalink
MB-41179 Wait for 60 sec before handling commands in cbindex batch mode
Browse files Browse the repository at this point in the history
Change-Id: I8105a0e8e806061a3d29e411ef10c95d4eb3b73d
  • Loading branch information
varunv-cb committed Sep 3, 2020
1 parent 076ce1c commit c1411ab
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions secondary/querycmd/docmd.go
Expand Up @@ -74,6 +74,9 @@ type Command struct {

// Batch process cbindex commands
BatchProcessFile string

// Time to wait until client bootstraps
WaitForClientBootstrap int64
}

// ParseArgs into Command object, return the list of arguments,
Expand Down Expand Up @@ -123,6 +126,8 @@ func ParseArgs(arguments []string) (*Command, []string, *flag.FlagSet, error) {
// Input file for batch processing
fset.StringVar(&cmdOptions.BatchProcessFile, "input", "", "Path to the file containing batch processing commands")

fset.Int64Var(&cmdOptions.WaitForClientBootstrap, "bootstrap_wait", 60, "Time (in seconds) cbindex will wait for client bootstrap")

// not useful to expose in sherlock
cmdOptions.ExprType = "N1QL"
cmdOptions.PartnStr = ""
Expand Down Expand Up @@ -559,6 +564,15 @@ func HandleCommand(
return err
}

if cmd.WaitForClientBootstrap > 0 {
// TODO: This sleep is added only to allow perf QE team to get
// unblocked. Should be removed after client side logic is modified
// to handle watcher sync-up with index metadata
fmt.Fprintf(w, "cbindex Sleeping for %v seconds to allow client to catch-up with index meta", cmd.WaitForClientBootstrap)
time.Sleep(time.Duration(cmd.WaitForClientBootstrap) * time.Second)
fmt.Fprintf(w, "cbindex starting to process batch file: %v", cmd.BatchProcessFile)
}

scanner := bufio.NewScanner(fd)
for scanner.Scan() {
line := scanner.Text()
Expand Down

0 comments on commit c1411ab

Please sign in to comment.