From bede693470e373a7d602abe7d97db0971bb1f1ff Mon Sep 17 00:00:00 2001 From: Alexander Chuprov Date: Tue, 10 Sep 2024 11:56:40 +0300 Subject: [PATCH] [#153] selector: Add VU synchronization in 'Oneshot' mode Signed-off-by: Alexander Chuprov --- internal/registry/obj_selector.go | 3 +++ scenarios/s3.js | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/internal/registry/obj_selector.go b/internal/registry/obj_selector.go index 78abb37..7e40d1e 100644 --- a/internal/registry/obj_selector.go +++ b/internal/registry/obj_selector.go @@ -3,6 +3,7 @@ package registry import ( "context" "fmt" + "sync" "time" "github.com/nspcc-dev/neo-go/pkg/io" @@ -23,6 +24,8 @@ type ObjSelector struct { filter *ObjFilter cacheSize int kind SelectorKind + // Sync synchronizes VU used for deletion. + Sync sync.WaitGroup } // objectSelectCache is the default maximum size of a batch to select from DB. diff --git a/scenarios/s3.js b/scenarios/s3.js index 22b031a..aa707c9 100644 --- a/scenarios/s3.js +++ b/scenarios/s3.js @@ -132,6 +132,10 @@ export function setup() { const start_timestamp = Date.now() console.log( `Load started at: ${Date(start_timestamp).toString()}`) + + if (delete_vu_count > 0){ + obj_to_delete_selector.sync.add(delete_vu_count) + } } export function teardown(data) { @@ -204,6 +208,8 @@ export function obj_delete() { const obj = obj_to_delete_selector.nextObject(); if (!obj) { if (obj_to_delete_exit_on_null) { + obj_to_delete_selector.sync.done() + obj_to_delete_selector.sync.wait() exec.test.abort("No more objects to select"); } return;