aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp14
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/buckethandler.cpp19
-rw-r--r--searchcore/src/vespa/searchcore/proton/test/document.h2
3 files changed, 9 insertions, 26 deletions
diff --git a/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp b/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp
index 03690ead45a..3cbbc192cb1 100644
--- a/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp
@@ -83,12 +83,12 @@ struct MyModifiedHandler : public IBucketModifiedHandler
bool
-expectEqual(uint32_t docCount, uint32_t metaCount, const BucketInfo &info)
+expectEqual(uint32_t docCount, uint32_t metaCount, size_t docSizes, size_t entrySizes, const BucketInfo &info)
{
if (!EXPECT_EQUAL(docCount, info.getDocumentCount())) return false;
if (!EXPECT_EQUAL(metaCount, info.getEntryCount())) return false;
- if (!EXPECT_EQUAL(docCount, info.getDocumentSize())) return false;
- if (!EXPECT_EQUAL(metaCount, info.getUsedSize())) return false;
+ if (!EXPECT_EQUAL(docSizes, info.getDocumentSize())) return false;
+ if (!EXPECT_EQUAL(entrySizes, info.getUsedSize())) return false;
return true;
}
@@ -172,10 +172,10 @@ TEST_F("require that handleListBuckets() returns buckets from all sub dbs", Fixt
TEST_F("require that bucket is reported in handleGetBucketInfo() and size faked", Fixture)
{
f.handleGetBucketInfo(f._ready.bucket(3));
- EXPECT_TRUE(expectEqual(3, 3, f._bucketInfo.getInfo()));
+ EXPECT_TRUE(expectEqual(3, 3, 3000, 3000, f._bucketInfo.getInfo()));
f.handleGetBucketInfo(f._ready.bucket(2)); // bucket 2 also in removed sub db
- EXPECT_TRUE(expectEqual(2, 6, f._bucketInfo.getInfo()));
+ EXPECT_TRUE(expectEqual(2, 6, 2000, 6000, f._bucketInfo.getInfo()));
}
@@ -188,12 +188,12 @@ TEST_F("require that handleGetBucketInfo() can get cached bucket", Fixture)
db->add(GID_1, BUCKET_1, TIME_1, DOCSIZE_1, SubDbType::NOTREADY);
}
f.handleGetBucketInfo(BUCKET_1);
- EXPECT_TRUE(expectEqual(1, 1, f._bucketInfo.getInfo()));
+ EXPECT_TRUE(expectEqual(1, 1, DOCSIZE_1, DOCSIZE_1, f._bucketInfo.getInfo()));
f._bucketDB->takeGuard()->uncacheBucket();
f.handleGetBucketInfo(BUCKET_1);
- EXPECT_TRUE(expectEqual(2, 2, f._bucketInfo.getInfo()));
+ EXPECT_TRUE(expectEqual(2, 2, 2 * DOCSIZE_1, 2 * DOCSIZE_1, f._bucketInfo.getInfo()));
{
// Must ensure empty bucket db before destruction.
BucketDBOwner::Guard db = f._bucketDB->takeGuard();
diff --git a/searchcore/src/vespa/searchcore/proton/server/buckethandler.cpp b/searchcore/src/vespa/searchcore/proton/server/buckethandler.cpp
index 9382c9aa0df..d98912ffec1 100644
--- a/searchcore/src/vespa/searchcore/proton/server/buckethandler.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/buckethandler.cpp
@@ -20,23 +20,6 @@ using vespalib::makeClosure;
namespace proton {
-namespace {
-
-BucketInfo
-fakeSizeData(const BucketInfo &info)
-{
- // TODO(geirst): consider if we should store document size and used size in bucket db.
- return BucketInfo(info.getChecksum(),
- info.getDocumentCount(),
- info.getDocumentCount(),
- info.getEntryCount(),
- info.getEntryCount(),
- info.getReady(),
- info.getActive());
-}
-
-}
-
void
BucketHandler::performSetCurrentState(BucketId bucketId,
storage::spi::BucketInfo::ActiveState newState,
@@ -133,7 +116,7 @@ BucketHandler::handleGetBucketInfo(const Bucket &bucket,
// Called by SPI thread.
// BucketDBOwner ensures synchronization between SPI thread and
// master write thread in document database.
- BucketInfo bucketInfo = fakeSizeData(_ready->getBucketDB().takeGuard()->cachedGet(bucket));
+ BucketInfo bucketInfo = _ready->getBucketDB().takeGuard()->cachedGet(bucket);
LOG(spam, "handleGetBucketInfo(%s): %s",
bucket.toString().c_str(), bucketInfo.toString().c_str());
resultHandler.handle(BucketInfoResult(bucketInfo));
diff --git a/searchcore/src/vespa/searchcore/proton/test/document.h b/searchcore/src/vespa/searchcore/proton/test/document.h
index 1f58ca686b5..c591ed74b43 100644
--- a/searchcore/src/vespa/searchcore/proton/test/document.h
+++ b/searchcore/src/vespa/searchcore/proton/test/document.h
@@ -40,7 +40,7 @@ public:
}
search::DocumentIdT getLid() const { return _lid; }
storage::spi::Timestamp getTimestamp() const { return _tstamp; }
- uint32_t getDocSize() const { return 1; }
+ uint32_t getDocSize() const { return 1000; }
};
typedef std::vector<Document> DocumentVector;