Skip to content

Commit 93f8d40

Browse files
committed
MB-63679: STAT fusion active_guest_volumes returns simple array
Eg we want ["vol1", "vol2"] rather than [["vol1", "vol2"]]. Note: active_guest_volumes with values isn't covered in unit tests yet, that's work-in-progress. Still, pushing this fix immediately as that's for milestone-2. Change-Id: Iac682ab3131c41c4835473a5a5420a920937ecb0 Reviewed-on: https://review.couchbase.org/c/kv_engine/+/225685 Reviewed-by: Pavlos Georgiou <pavlos.georgiou@couchbase.com> Tested-by: Build Bot <build@couchbase.com> Tested-by: Paolo Cocchi <paolo.cocchi@couchbase.com>
1 parent ec680f5 commit 93f8d40

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

engines/ep/src/kvstore/magma-kvstore/magma-kvstore.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4641,7 +4641,7 @@ nlohmann::json MagmaKVStore::getFusionStats(FusionStat stat, Vbid vbid) {
46414641
const auto res = magma->GetActiveFusionGuestVolumes(
46424642
Magma::KVStoreID(vbid.get()));
46434643
checkError(std::get<Status>(res));
4644-
return {std::get<std::vector<std::string>>(res)};
4644+
return std::get<std::vector<std::string>>(res);
46454645
}
46464646
case FusionStat::UploaderState: {
46474647
const auto id = Magma::KVStoreID(vbid.get());

tests/testapp/testapp_fusion.cc

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ class FusionTest : public TestappClientTest {
4343
}
4444
}
4545

46-
BinprotResponse mountVbucket(const nlohmann::json& volumes) {
46+
BinprotResponse mountVbucket(Vbid vbid, const nlohmann::json& volumes) {
4747
BinprotResponse resp;
4848
adminConnection->executeInBucket(
49-
bucketName, [&resp, &volumes](auto& conn) {
49+
bucketName, [&resp, vbid, &volumes](auto& conn) {
5050
auto cmd = BinprotGenericCommand{
5151
cb::mcbp::ClientOpcode::MountFusionVbucket};
52-
cmd.setVBucket(Vbid(1));
52+
cmd.setVBucket(vbid);
5353
nlohmann::json json;
5454
json["mountPaths"] = volumes;
5555
cmd.setValue(json.dump());
@@ -204,11 +204,13 @@ TEST_P(FusionTest, GetReleaseStorageSnapshot) {
204204
EXPECT_TRUE(resp.isSuccess()) << "status:" << resp.getStatus();
205205
}
206206

207-
TEST_P(FusionTest, MountFusionVbucket) {
208-
auto resp = mountVbucket({1, 2});
207+
TEST_P(FusionTest, MountFusionVbucket_InvalidArgs) {
208+
auto resp = mountVbucket(Vbid(1), {1, 2});
209209
EXPECT_EQ(cb::mcbp::Status::Einval, resp.getStatus());
210+
}
210211

211-
resp = mountVbucket({"path1", "path2"});
212+
TEST_P(FusionTest, MountFusionVbucket) {
213+
const auto resp = mountVbucket(Vbid(1), {"path1", "path2"});
212214
ASSERT_TRUE(resp.isSuccess()) << "status:" << resp.getStatus();
213215
const auto& res = resp.getDataJson();
214216
ASSERT_FALSE(res.empty());
@@ -217,7 +219,7 @@ TEST_P(FusionTest, MountFusionVbucket) {
217219
}
218220

219221
TEST_P(FusionTest, MountFusionVbucket_NoVolumes) {
220-
const auto resp = mountVbucket(nlohmann::json::array());
222+
const auto resp = mountVbucket(Vbid(1), nlohmann::json::array());
221223
ASSERT_TRUE(resp.isSuccess()) << "status:" << resp.getStatus();
222224
const auto& res = resp.getDataJson();
223225
ASSERT_FALSE(res.empty());

0 commit comments

Comments
 (0)