MCPcopy Create free account
hub / github.com/baidu/tera / GetTabletKeyRange

Function GetTabletKeyRange

src/admincli.cc:1073–1102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1071}
1072
1073int GetTabletKeyRange(const std::string& prefix_path, const std::string& table_name,
1074 const std::string& tablet_name, std::string& startkey, std::string& endkey) {
1075 char full_path[4096] = {0};
1076 std::string manifest_name;
1077
1078 // read current, eg: prefix/table/tablet/0/CURRENT
1079 snprintf(full_path, sizeof(full_path), "%s/%s/%s/0/CURRENT", prefix_path.c_str(),
1080 table_name.c_str(), tablet_name.c_str());
1081 int ret = DfsGetCurrent(full_path, &manifest_name);
1082 if (0 != ret) {
1083 LOG(INFO) << "get current(" << full_path << ") fail";
1084 return ret;
1085 }
1086
1087 // read manifest, prefix/table/tablet/0/MANIFEST-*
1088 snprintf(full_path, sizeof(full_path), "%s/%s/%s/0/%s", prefix_path.c_str(), table_name.c_str(),
1089 tablet_name.c_str(), manifest_name.c_str());
1090 ret = DfsGetManifest(full_path, &startkey, &endkey);
1091 if (0 != ret) {
1092 LOG(INFO) << "get manifest(" << full_path << ") fail";
1093 return ret;
1094 }
1095
1096 LOG(INFO) << "get manifest(" << full_path << ") succ"
1097 << "table(" << table_name << ")"
1098 << "tablet(" << tablet_name << ")"
1099 << "startkey(" << startkey << ")"
1100 << "endkey(" << endkey << ")";
1101 return 0;
1102}
1103
1104// get tablet key range
1105int ScanTabletMeta(const std::string& table_name, const std::string& prefix_path,

Callers 2

ScanTabletMetaFunction · 0.85
TabletDiffFunction · 0.85

Calls 2

DfsGetCurrentFunction · 0.85
DfsGetManifestFunction · 0.85

Tested by

no test coverage detected