8000 Controller: improve the performance on putting the scanner database. by jayhuang-suse · Pull Request #1106 · neuvector/neuvector · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Controller: improve the performance on putting the scanner database. #1106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions controller/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,27 @@ func (ss *ScanService) scannerRegister(data *share.ScannerRegisterData) error {
return err
}

res := make(chan error)
for i, zb := range zbs {
key := fmt.Sprintf("%s%d", newStore, i)
if err = cluster.PutBinary(key, zb); err != nil {
log.WithFields(log.Fields{"error": err, "slot": i, "size": len(zb)}).Error()
ss.registerFailureCleanup(newStore)
return err
go func() {
res <- cluster.PutBinary(key, zb)
}()
}

var lastError error
for i := 0; i < len(zbs); i++ {
if err := <- res; err != nil {
lastError = err
log.WithFields(log.Fields{"error": err}).Error()
}
}
close(res)

if lastError != nil {
ss.registerFailureCleanup(newStore)
return err
}

// The idea is to use a dummy scanner to indicate the new database has been written.
dbVerScanner := share.CLUSScanner{
Expand Down
0