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

Function MetaHealthCheckOp

src/admincli.cc:1566–1610  ·  view source on GitHub ↗

healthcheck [inmem] [start_key] [end_key]

Source from the content-addressed store, hash-verified

1564
1565// healthcheck [inmem] [start_key] [end_key]
1566CliStatus MetaHealthCheckOp(Client* client, int32_t argc, std::string* argv, ErrorCode* err) {
1567 if (0 != InitDfsClient()) {
1568 LOG(ERROR) << "Init Dfs Client fail";
1569 return CliStatus::kError;
1570 }
1571 g_env = new leveldb::DfsEnv(g_dfs);
1572
1573 scoped_ptr<tera::sdk::ClusterFinder> finder(tera::sdk::NewClusterFinder());
1574 const std::string meta_server = finder->RootTableAddr();
1575 std::string start_key;
1576 std::string end_key;
1577
1578 if (argc == 4 || argc == 2) {
1579 if (argc == 4) {
1580 start_key = argv[2];
1581 end_key = argv[3];
1582 } else {
1583 start_key = "";
1584 end_key = "";
1585 }
1586 common::ThreadPool thread_pool(1);
1587 return MetaInternalOp(meta_server, &thread_pool, "healtchcheck", start_key, end_key, "");
1588 } else if ((argc == 5 || argc == 3) && argv[2] == "inmem") {
1589 if (argc == 5) {
1590 start_key = argv[3];
1591 end_key = argv[4];
1592 } else {
1593 start_key = "";
1594 end_key = "";
1595 }
1596
1597 TableMetaList table_list;
1598 TabletMetaList tablet_list;
1599 std::shared_ptr<tera::ClientImpl> client_impl(
1600 (static_cast<ClientWrapper*>(client))->GetClientImpl());
1601 if (!client_impl->ShowTablesInfo(&table_list, &tablet_list, false, err)) {
1602 LOG(ERROR) << "fail to get meta data from tera.";
1603 return CliStatus::kError;
1604 }
1605 return ProcessMeta("healthcheck", table_list, tablet_list, start_key, end_key, "");
1606 } else {
1607 PrintCmdHelpInfo(argv[1]);
1608 }
1609 return CliStatus::kOk;
1610}
1611
1612// conv <readable_key>
1613CliStatus MetaConvOp(Client* client, int32_t argc, std::string* argv, ErrorCode* err) {

Callers

nothing calls this directly

Calls 8

NewClusterFinderFunction · 0.85
MetaInternalOpFunction · 0.85
ProcessMetaFunction · 0.85
RootTableAddrMethod · 0.80
GetClientImplMethod · 0.80
ShowTablesInfoMethod · 0.80
InitDfsClientFunction · 0.70
PrintCmdHelpInfoFunction · 0.70

Tested by

no test coverage detected