Skip to content

[curve/toos-v2]: add chunk-location #2350

Closed
@Cyber-SiKu

Description

@Cyber-SiKu

Is your feature request related to a problem? (你需要的功能是否与某个问题有关?)

we'd like to support bs query chunk command in curve tool

  • The implementation of the old tool is here:
    int NameSpaceTool::PrintChunkLocation(const std::string& fileName,
    uint64_t offset) {
    uint64_t chunkId;
    std::pair<uint32_t, uint32_t> copyset;
    if (core_->QueryChunkCopyset(fileName, offset, &chunkId, &copyset) != 0) {
    std::cout << "QueryChunkCopyset fail!" << std::endl;
    return -1;
    }
    uint32_t logicPoolId = copyset.first;
    uint32_t copysetId = copyset.second;
    uint64_t groupId = (static_cast<uint64_t>(logicPoolId) << 32) | copysetId;
    std::cout << "chunkId: " << chunkId
    << ", logicalPoolId: " << logicPoolId
    << ", copysetId: " << copysetId
    << ", groupId: " << groupId << std::endl;
    std::vector<ChunkServerLocation> csLocs;
    int res = core_->GetChunkServerListInCopySet(logicPoolId,
    copysetId, &csLocs);
    if (res != 0) {
    std::cout << "GetChunkServerListInCopySet fail!" << std::endl;
    return -1;
    }
    std::cout << "location: {";
    for (uint64_t i = 0; i < csLocs.size(); ++i) {
    if (i != 0) {
    std::cout << ", ";
    }
    auto location = csLocs[i];
    std::cout << location.hostip() << ":"
    << std::to_string(location.port());
    }
    std::cout << "}" << std::endl;
    return 0;
    }
  • The old command input and out put:
curve_ops_tool chunk-location -fileName=/test

-------
output:
chunkId: ***, logicalPoolId: ***, copysetId: ***, groupId: ***
location: {***, ***, ***}

Refer to tool develop guide to get start, and paste the result of the command in pr.

Build compilation environment:https://github.com/opencurve/curve/blob/master/docs/cn/build_and_run.md

Describe the solution you'd like (描述你期望的解决方法)

Add subcommand clinet to curve bs list.

Describe alternatives you've considered (描述你想到的折衷方案)

Additional context/screenshots (更多上下文/截图)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions