aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp2
-rw-r--r--searchlib/src/tests/common/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp11
-rw-r--r--searchlib/src/vespa/searchlib/common/isequencedtaskexecutor.h7
3 files changed, 17 insertions, 3 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp
index 54942b4ba11..f5213101721 100644
--- a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp
@@ -464,7 +464,7 @@ StoreOnlyFeedView::internalUpdate(FeedToken token, const UpdateOperation &updOp)
[upd = updOp.getUpdate(), serialNum, lid, onWriteDone, promisedDoc = std::move(promisedDoc),
promisedStream = std::move(promisedStream), this]() mutable
{
- makeUpdatedDocument(serialNum, lid, upd, onWriteDone,
+ makeUpdatedDocument(serialNum, lid, std::move(upd), onWriteDone,
std::move(promisedDoc), std::move(promisedStream));
});
#pragma GCC diagnostic pop
diff --git a/searchlib/src/tests/common/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp b/searchlib/src/tests/common/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp
index 558d24551a8..fcc7fd7300d 100644
--- a/searchlib/src/tests/common/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp
+++ b/searchlib/src/tests/common/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp
@@ -234,6 +234,17 @@ TEST("require that you get correct number of executors") {
EXPECT_EQUAL(7u, seven.getNumExecutors());
}
+TEST("require that you distribute well") {
+ SequencedTaskExecutor seven(7);
+ EXPECT_EQUAL(7u, seven.getNumExecutors());
+ EXPECT_EQUAL(97u, seven.getComponentHashSize());
+ EXPECT_EQUAL(0u, seven.getComponentEffectiveHashSize());
+ for (uint32_t id=0; id < 1000; id++) {
+ EXPECT_EQUAL((id%97)%7, seven.getExecutorId(id).getId());
+ }
+ EXPECT_EQUAL(97u, seven.getComponentHashSize());
+ EXPECT_EQUAL(97u, seven.getComponentEffectiveHashSize());
+}
}
diff --git a/searchlib/src/vespa/searchlib/common/isequencedtaskexecutor.h b/searchlib/src/vespa/searchlib/common/isequencedtaskexecutor.h
index d1318a2b71c..109e8319148 100644
--- a/searchlib/src/vespa/searchlib/common/isequencedtaskexecutor.h
+++ b/searchlib/src/vespa/searchlib/common/isequencedtaskexecutor.h
@@ -71,7 +71,6 @@ public:
* Wrap lambda function into a task and schedule it to be run.
* Caller must ensure that pointers and references are valid and
* call sync before tearing down pointed to/referenced data.
- * All tasks must be scheduled from same thread.
*
* @param componentId component id
* @param function function to be wrapped in a task and later executed
@@ -86,7 +85,6 @@ public:
* Wrap lambda function into a task and schedule it to be run.
* Caller must ensure that pointers and references are valid and
* call sync before tearing down pointed to/referenced data.
- * All tasks must be scheduled from same thread.
*
* @param id executor id
* @param function function to be wrapped in a task and later executed
@@ -95,6 +93,11 @@ public:
void execute(ExecutorId id, FunctionType &&function) {
executeTask(id, vespalib::makeLambdaTask(std::forward<FunctionType>(function)));
}
+ /**
+ * For testing only
+ */
+ uint32_t getComponentHashSize() const { return _component2Id.size(); }
+ uint32_t getComponentEffectiveHashSize() const { return _nextId; }
private:
mutable std::vector<uint8_t> _component2Id;
mutable std::mutex _mutex;