summaryrefslogtreecommitdiffstats
path: root/staging_vespalib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2021-11-08 18:34:29 +0100
committerTor Egge <Tor.Egge@online.no>2021-11-08 18:52:06 +0100
commitf1e231eab069edfa5eb499f324e3ee7bcca89a40 (patch)
treea382ceb5a2e9537ec7956cb8468234d7afdcaddf /staging_vespalib
parent401ef5852764dee9a7e1568057c11f240ae6be9e (diff)
Use alternate executor id for push stage when sharing sequenced task executor
with invert stage.
Diffstat (limited to 'staging_vespalib')
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/isequencedtaskexecutor.cpp9
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/isequencedtaskexecutor.h9
2 files changed, 18 insertions, 0 deletions
diff --git a/staging_vespalib/src/vespa/vespalib/util/isequencedtaskexecutor.cpp b/staging_vespalib/src/vespa/vespalib/util/isequencedtaskexecutor.cpp
index 41653889b8f..c54f182891c 100644
--- a/staging_vespalib/src/vespa/vespalib/util/isequencedtaskexecutor.cpp
+++ b/staging_vespalib/src/vespa/vespalib/util/isequencedtaskexecutor.cpp
@@ -18,4 +18,13 @@ ISequencedTaskExecutor::getExecutorIdFromName(vespalib::stringref componentId) c
return getExecutorId(hashfun(componentId));
}
+ISequencedTaskExecutor::ExecutorId
+ISequencedTaskExecutor::get_alternate_executor_id(ExecutorId id, uint32_t bias) const
+{
+ if ((bias % _numExecutors) == 0) {
+ bias = 1;
+ }
+ return ExecutorId((id.getId() + bias) % _numExecutors);
+}
+
}
diff --git a/staging_vespalib/src/vespa/vespalib/util/isequencedtaskexecutor.h b/staging_vespalib/src/vespa/vespalib/util/isequencedtaskexecutor.h
index 06cc37616c0..0e931838279 100644
--- a/staging_vespalib/src/vespa/vespalib/util/isequencedtaskexecutor.h
+++ b/staging_vespalib/src/vespa/vespalib/util/isequencedtaskexecutor.h
@@ -43,6 +43,15 @@ public:
ExecutorId getExecutorIdFromName(vespalib::stringref componentId) const;
/**
+ * Returns an executor id that is NOT equal to the given executor id,
+ * using the given bias to offset the new id.
+ *
+ * This is relevant for pipelining operations on the same component,
+ * by doing pipeline steps in different executors.
+ */
+ ExecutorId get_alternate_executor_id(ExecutorId id, uint32_t bias) const;
+
+ /**
* Schedule a task to run after all previously scheduled tasks with
* same id.
*