summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@oath.com>2017-10-04 11:37:21 +0000
committerTor Egge <Tor.Egge@oath.com>2017-10-04 14:20:19 +0000
commit3f419f70b9ae6dffbb07c3f042a8482dc413c278 (patch)
tree0bfa00c37d2b0a00a3815536e3dc1f351e27d70b /searchcore
parent80d54b0d844c964b0ce1cf42cce3f0373ef327a4 (diff)
Use document::Bucket in storage::spi::Bucket to add bucket space.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp4
-rw-r--r--searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp4
-rw-r--r--searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp6
-rw-r--r--searchcore/src/tests/proton/server/documentretriever_test.cpp6
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/bucketfactory.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/bucketmovejob.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/clusterstatehandler.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp5
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/ibucketstatecalculator.h4
-rw-r--r--searchcore/src/vespa/searchcore/proton/test/bucketstatecalculator.h7
10 files changed, 27 insertions, 17 deletions
diff --git a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp
index 3c891ff4c11..bef65add869 100644
--- a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp
+++ b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp
@@ -6,6 +6,7 @@
#include <vespa/persistence/spi/bucket.h>
#include <vespa/persistence/spi/docentry.h>
#include <vespa/persistence/spi/result.h>
+#include <vespa/persistence/spi/test.h>
#include <vespa/searchcore/proton/common/attrupdate.h>
#include <vespa/searchcore/proton/persistenceengine/document_iterator.h>
#include <vespa/searchcore/proton/server/commit_and_wait_document_retriever.h>
@@ -43,6 +44,7 @@ using storage::spi::IterateResult;
using storage::spi::PartitionId;
using storage::spi::Selection;
using storage::spi::Timestamp;
+using storage::spi::test::makeBucket;
using namespace proton;
using namespace search::index;
@@ -50,7 +52,7 @@ using namespace search::index;
const uint64_t largeNum = 10000000;
Bucket bucket(size_t x) {
- return Bucket(BucketId(x), PartitionId(0));
+ return makeBucket(BucketId(x));
}
Selection selectAll() {
diff --git a/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp b/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp
index 6fda983e88c..950571df6a4 100644
--- a/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp
@@ -5,6 +5,7 @@ LOG_SETUP("buckethandler_test");
#include <vespa/searchcore/proton/server/ibucketstatechangedhandler.h>
#include <vespa/searchcore/proton/server/ibucketmodifiedhandler.h>
#include <vespa/searchcore/proton/test/test.h>
+#include <vespa/persistence/spi/test.h>
#include <vespa/vespalib/testkit/testapp.h>
using namespace proton;
@@ -14,6 +15,7 @@ using storage::spi::Bucket;
using storage::spi::BucketInfo;
using storage::spi::PartitionId;
using storage::spi::Timestamp;
+using storage::spi::test::makeBucket;
using vespalib::ThreadStackExecutor;
using proton::test::BucketStateCalculator;
@@ -144,7 +146,7 @@ struct Fixture
}
void sync() { _exec.sync(); }
void handleGetBucketInfo(const BucketId &bucket) {
- _handler.handleGetBucketInfo(Bucket(bucket, PART_ID), _bucketInfo);
+ _handler.handleGetBucketInfo(makeBucket(bucket, PART_ID), _bucketInfo);
}
void
setNodeUp(bool value)
diff --git a/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp b/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp
index a7c4b0e5774..2e7e50c3464 100644
--- a/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp
+++ b/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp
@@ -2,6 +2,7 @@
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/document/datatype/documenttype.h>
#include <vespa/persistence/spi/documentselection.h>
+#include <vespa/persistence/spi/test.h>
#include <vespa/searchcore/proton/persistenceengine/bucket_guard.h>
#include <vespa/searchcore/proton/persistenceengine/ipersistenceengineowner.h>
#include <vespa/searchcore/proton/persistenceengine/persistenceengine.h>
@@ -35,6 +36,7 @@ using storage::spi::Result;
using storage::spi::Selection;
using storage::spi::Timestamp;
using storage::spi::UpdateResult;
+using storage::spi::test::makeBucket;
using namespace proton;
using namespace vespalib;
@@ -378,8 +380,8 @@ BucketId bckId1(1);
BucketId bckId2(2);
BucketId bckId3(3);
Bucket bucket0;
-Bucket bucket1(bckId1, partId);
-Bucket bucket2(bckId2, partId);
+Bucket bucket1(makeBucket(bckId1, partId));
+Bucket bucket2(makeBucket(bckId2, partId));
BucketChecksum checksum1(1);
BucketChecksum checksum2(2);
BucketChecksum checksum3(1+2);
diff --git a/searchcore/src/tests/proton/server/documentretriever_test.cpp b/searchcore/src/tests/proton/server/documentretriever_test.cpp
index df444d26f8c..b949046e8b6 100644
--- a/searchcore/src/tests/proton/server/documentretriever_test.cpp
+++ b/searchcore/src/tests/proton/server/documentretriever_test.cpp
@@ -19,6 +19,7 @@
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/persistence/spi/bucket.h>
#include <vespa/persistence/spi/result.h>
+#include <vespa/persistence/spi/test.h>
#include <vespa/searchcommon/common/schema.h>
#include <vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h>
#include <vespa/searchcore/proton/server/documentretriever.h>
@@ -69,6 +70,7 @@ using storage::spi::Bucket;
using storage::spi::GetResult;
using storage::spi::PartitionId;
using storage::spi::Timestamp;
+using storage::spi::test::makeBucket;
using vespalib::make_string;
using vespalib::string;
using namespace document::config_builder;
@@ -324,12 +326,12 @@ TEST_F("require that document retriever can retrieve document meta data",
TEST_F("require that document retriever can retrieve bucket meta data",
Fixture) {
DocumentMetaData::Vector result;
- f._retriever->getBucketMetaData(Bucket(f.bucket_id, PartitionId(0)), result);
+ f._retriever->getBucketMetaData(makeBucket(f.bucket_id, PartitionId(0)), result);
ASSERT_EQUAL(1u, result.size());
EXPECT_EQUAL(f.lid, result[0].lid);
EXPECT_EQUAL(f.timestamp, result[0].timestamp);
result.clear();
- f._retriever->getBucketMetaData(Bucket(BucketId(f.bucket_id.getId() + 1),
+ f._retriever->getBucketMetaData(makeBucket(BucketId(f.bucket_id.getId() + 1),
PartitionId(0)), result);
EXPECT_EQUAL(0u, result.size());
}
diff --git a/searchcore/src/vespa/searchcore/proton/common/bucketfactory.cpp b/searchcore/src/vespa/searchcore/proton/common/bucketfactory.cpp
index b80332d97a9..e7048b74b10 100644
--- a/searchcore/src/vespa/searchcore/proton/common/bucketfactory.cpp
+++ b/searchcore/src/vespa/searchcore/proton/common/bucketfactory.cpp
@@ -21,7 +21,7 @@ BucketFactory::getBucketId(const DocumentId &docId)
Bucket
BucketFactory::getBucket(const DocumentId &docId)
{
- return Bucket(getBucketId(docId), PartitionId(0));
+ return Bucket(document::Bucket(document::BucketSpace::placeHolder(), getBucketId(docId)), PartitionId(0));
}
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/server/bucketmovejob.cpp b/searchcore/src/vespa/searchcore/proton/server/bucketmovejob.cpp
index f36c2add23a..7320b48140e 100644
--- a/searchcore/src/vespa/searchcore/proton/server/bucketmovejob.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/bucketmovejob.cpp
@@ -67,7 +67,7 @@ BucketMoveJob::checkBucket(const BucketId &bucket,
if (_calc->nodeRetired() && !isActive) {
return;
}
- const bool shouldBeReady = _calc->shouldBeReady(bucket);
+ const bool shouldBeReady = _calc->shouldBeReady(document::Bucket(document::BucketSpace::placeHolder(), bucket));
const bool wantReady = shouldBeReady || isActive;
LOG(spam, "checkBucket(): bucket(%s), shouldBeReady(%s), active(%s)",
bucket.toString().c_str(), bool2str(shouldBeReady), bool2str(isActive));
@@ -213,7 +213,7 @@ BucketMoveJob::maybeCancelMover(DocumentBucketMover &mover)
if (!mover.bucketDone()) {
bool ready = mover.getSource() == &_ready;
if (isBlocked() ||
- _calc->shouldBeReady(mover.getBucket()) == ready) {
+ _calc->shouldBeReady(document::Bucket(document::BucketSpace::placeHolder(), mover.getBucket())) == ready) {
mover.cancel();
}
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/clusterstatehandler.cpp b/searchcore/src/vespa/searchcore/proton/server/clusterstatehandler.cpp
index 3b3437b4346..fa0e0f33469 100644
--- a/searchcore/src/vespa/searchcore/proton/server/clusterstatehandler.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/clusterstatehandler.cpp
@@ -39,7 +39,7 @@ public:
_nodeRetired(_calc.nodeRetired())
{
}
- bool shouldBeReady(const document::BucketId &bucket) const override {
+ bool shouldBeReady(const document::Bucket &bucket) const override {
return _calc.shouldBeReady(Bucket(bucket, PartitionId(0)));
}
bool clusterUp() const override { return _clusterUp; }
diff --git a/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp b/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp
index 7439081f4e6..a9dfeb12ed7 100644
--- a/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp
@@ -273,17 +273,18 @@ CombiningFeedView::setCalculator(const IBucketStateCalculator::SP &newCalc)
bool
CombiningFeedView::shouldBeReady(const document::BucketId &bucket) const
{
+ document::Bucket dbucket(document::BucketSpace::placeHolder(), bucket);
LOG(debug,
"shouldBeReady(%s): forceReady(%s), clusterUp(%s), calcReady(%s)",
bucket.toString().c_str(),
(_forceReady ? "true" : "false"),
(_clusterUp ? "true" : "false"),
(_calc.get() != NULL ?
- (_calc->shouldBeReady(bucket) ? "true" : "false") : "null"));
+ (_calc->shouldBeReady(dbucket) ? "true" : "false") : "null"));
const documentmetastore::IBucketHandler *readyMetaStore =
_metaStores[getReadyFeedViewId()];
bool isActive = readyMetaStore->getBucketDB().takeGuard()->isActiveBucket(bucket);
- return _forceReady || isActive || _calc->shouldBeReady(bucket);
+ return _forceReady || isActive || _calc->shouldBeReady(dbucket);
}
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/server/ibucketstatecalculator.h b/searchcore/src/vespa/searchcore/proton/server/ibucketstatecalculator.h
index 70e352b4d41..10c0b194aac 100644
--- a/searchcore/src/vespa/searchcore/proton/server/ibucketstatecalculator.h
+++ b/searchcore/src/vespa/searchcore/proton/server/ibucketstatecalculator.h
@@ -4,14 +4,14 @@
#include <memory>
-namespace document { class BucketId; }
+namespace document { class Bucket; }
namespace proton {
struct IBucketStateCalculator
{
typedef std::shared_ptr<IBucketStateCalculator> SP;
- virtual bool shouldBeReady(const document::BucketId &bucket) const = 0;
+ virtual bool shouldBeReady(const document::Bucket &bucket) const = 0;
virtual bool clusterUp() const = 0;
virtual bool nodeUp() const = 0;
virtual bool nodeInitializing() const = 0;
diff --git a/searchcore/src/vespa/searchcore/proton/test/bucketstatecalculator.h b/searchcore/src/vespa/searchcore/proton/test/bucketstatecalculator.h
index 314c375ec2c..8a5a46946d8 100644
--- a/searchcore/src/vespa/searchcore/proton/test/bucketstatecalculator.h
+++ b/searchcore/src/vespa/searchcore/proton/test/bucketstatecalculator.h
@@ -3,6 +3,7 @@
#include <vespa/searchcore/proton/server/ibucketstatecalculator.h>
#include <vespa/document/bucket/bucketidlist.h>
+#include <vespa/document/bucket/bucket.h>
namespace proton::test {
@@ -56,9 +57,9 @@ public:
void resetAsked() { _asked.clear(); }
// Implements IBucketStateCalculator
- bool shouldBeReady(const document::BucketId &bucket) const override {
- _asked.push_back(bucket);
- return _ready.count(bucket) == 1;
+ bool shouldBeReady(const document::Bucket &bucket) const override {
+ _asked.push_back(bucket.getBucketId());
+ return _ready.count(bucket.getBucketId()) == 1;
}
bool clusterUp() const override { return _clusterUp; }