blob: 83d79ab4d77cda816df782a980ef79d69ba36fdd (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/log/log.h>
#include <vespa/vdstestlib/cppunit/macros.h>
#include <vespa/storageapi/message/bucket.h>
#include <vespa/storageapi/message/bucketsplitting.h>
#include <tests/persistence/common/persistenceproviderwrapper.h>
#include <vespa/persistence/dummyimpl/dummypersistence.h>
#include <tests/persistence/common/filestortestfixture.h>
#include <tests/common/make_document_bucket.h>
LOG_SETUP(".singlebucketjointest");
using storage::test::makeDocumentBucket;
namespace storage {
class SingleBucketJoinTest : public FileStorTestFixture
{
public:
void testPersistenceCanHandleSingleBucketJoin();
CPPUNIT_TEST_SUITE(SingleBucketJoinTest);
CPPUNIT_TEST(testPersistenceCanHandleSingleBucketJoin);
CPPUNIT_TEST_SUITE_END();
};
CPPUNIT_TEST_SUITE_REGISTRATION(SingleBucketJoinTest);
void
SingleBucketJoinTest::testPersistenceCanHandleSingleBucketJoin()
{
TestFileStorComponents c(*this, "testPersistenceCanHandleSingleBucketJoin");
document::BucketId targetBucket(16, 1);
document::BucketId sourceBucket(17, 1);
createBucket(sourceBucket);
// Make sure it's not empty
c.sendPut(sourceBucket, DocumentIndex(0), PutTimestamp(1000));
expectOkReply<api::PutReply>(c.top);
c.top.getRepliesOnce();
auto cmd = std::make_shared<api::JoinBucketsCommand>(makeDocumentBucket(targetBucket));
cmd->getSourceBuckets().push_back(sourceBucket);
cmd->getSourceBuckets().push_back(sourceBucket);
c.top.sendDown(cmd);
// If single bucket join locking is not working properly, this
// will hang forever.
expectOkReply<api::JoinBucketsReply>(c.top);
}
} // namespace storage
|