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

Function DeleteMetaTablet

src/admincli.cc:395–433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

393}
394
395CliStatus DeleteMetaTablet(const std::string& meta_server, common::ThreadPool* thread_pool,
396 const std::string& table_name, const std::string& start_key) {
397 TabletMeta tablet_meta;
398 TableMeta table_meta;
399 if (GetMetaValue(meta_server, thread_pool, table_name, start_key, &table_meta, &tablet_meta) !=
400 CliStatus::kOk) {
401 std::cout << "wrong tablet input" << std::endl;
402 return CliStatus::kError;
403 }
404 tabletnode::TabletNodeClient write_meta_client(thread_pool, meta_server);
405 WriteTabletRequest write_request;
406 WriteTabletResponse write_response;
407 write_request.set_sequence_id(g_sequence_id++);
408 write_request.set_tablet_name(FLAGS_tera_master_meta_table_name);
409 RowMutationSequence* mu_seq = write_request.add_row_list();
410
411 std::cout << "Are you sure delete the tablet meta info?" << std::endl;
412 PrintMetaInfo(&tablet_meta);
413 if (FLAGS_make_sure_manual && !Confirm()) {
414 return CliStatus::kError;
415 }
416
417 std::string row_key;
418 MakeMetaTableKey(table_name, start_key, &row_key);
419 mu_seq->set_row_key(row_key);
420 tera::Mutation* mutation = mu_seq->add_mutation_sequence();
421 mutation->set_type(tera::kDeleteRow);
422 mutation->set_timestamp(kLatestTimestamp);
423 if (!write_meta_client.WriteTablet(&write_request, &write_response)) {
424 std::cout << "write tablet failed" << std::endl;
425 return CliStatus::kError;
426 }
427 StatusCode err = write_response.status();
428 if (err != tera::kTabletNodeOk) {
429 std::cerr << "Write meta table response not kTabletNodeOk!";
430 return CliStatus::kError;
431 }
432 return CliStatus::kOk;
433}
434
435CliStatus ModifyMetaValue(const std::string& meta_server, common::ThreadPool* thread_pool,
436 const std::string& table_name, const std::string& start_key,

Callers 1

MetaDeleteOpFunction · 0.85

Calls 6

GetMetaValueFunction · 0.85
PrintMetaInfoFunction · 0.85
MakeMetaTableKeyFunction · 0.85
ConfirmFunction · 0.70
WriteTabletMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected