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

Function GetTabletName

src/admincli.cc:986–1004  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

984}
985
986std::string GetTabletName(const std::vector<std::string>& fail_tablet, uint32_t& index,
987 uint64_t& tablet_num) {
988 std::string tablet_name;
989 std::string tablet_str;
990 if (index < fail_tablet.size()) { // reuse abnormal tablet num
991 tablet_name = fail_tablet[index];
992 index++;
993 } else {
994 tablet_num++;
995 tablet_str = std::to_string(tablet_num);
996 // add 0 before num to TABLET_NUM_LEN
997 int i, gap = TABLET_NUM_LEN - tablet_str.size();
998 for (i = 0; i < gap; i++) {
999 tablet_str = "0" + tablet_str;
1000 }
1001 tablet_name = "tablet" + tablet_str;
1002 }
1003 return tablet_name;
1004}
1005
1006void FixTabletGap(std::map<std::string, std::pair<std::string, std::string>>& map_scan,
1007 const std::vector<std::string>& fail_tablet, const std::string& table_name,

Callers 1

FixTabletGapFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected