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

Method UnloadTablet

src/tabletnode/tabletnode_impl.cc:482–518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

480}
481
482bool TabletNodeImpl::UnloadTablet(const std::string& tablet_name, const std::string& start,
483 const std::string& end, StatusCode* status) {
484 io::TabletIO* tablet_io = tablet_manager_->GetTablet(tablet_name, start, end, status);
485 if (tablet_io == NULL) {
486 LOG(WARNING) << "unload fail to get tablet: " << tablet_name << " [" << DebugString(start)
487 << ", " << DebugString(end) << "], status: " << StatusCodeToString(*status);
488 *status = kKeyNotInRange;
489 return false;
490 }
491
492 if (!tablet_io->Unload(status)) {
493 io::TabletIO::TabletStatus tablet_status = tablet_io->GetStatus();
494 if (tablet_status == io::TabletIO::TabletStatus::kUnloading ||
495 tablet_status == io::TabletIO::TabletStatus::kUnloading2) {
496 VLOG(6) << "ignore this unload tablet request: " << tablet_io->GetTablePath() << "["
497 << DebugString(start) << "," << DebugString(end)
498 << "], status: " << StatusCodeToString((StatusCode)tablet_status);
499 } else {
500 LOG(ERROR) << "fail to unload tablet: " << tablet_io->GetTablePath() << " ["
501 << DebugString(start) << ", " << DebugString(end)
502 << "], status: " << StatusCodeToString(*status);
503 }
504 *status = (StatusCode)tablet_status;
505 tablet_io->DecRef();
506 return false;
507 }
508 LOG(INFO) << "unload tablet: " << tablet_io->GetTablePath() << " [" << DebugString(start) << ", "
509 << DebugString(end) << "]";
510 tablet_io->DecRef();
511
512 if (!tablet_manager_->RemoveTablet(tablet_name, start, end, status)) {
513 LOG(ERROR) << "fail to remove tablet: " << tablet_name << " [" << DebugString(start) << ", "
514 << DebugString(end) << "], status: " << StatusCodeToString(*status);
515 }
516 *status = kTabletNodeOk;
517 return true;
518}
519
520void TabletNodeImpl::UnloadTablet(const UnloadTabletRequest* request,
521 UnloadTabletResponse* response) {

Callers 2

TEST_FFunction · 0.45
TEST_FFunction · 0.45

Calls 10

DebugStringFunction · 0.85
StatusCodeToStringFunction · 0.85
UnloadMethod · 0.80
GetTablePathMethod · 0.80
compareMethod · 0.80
GetTabletMethod · 0.45
GetStatusMethod · 0.45
DecRefMethod · 0.45
RemoveTabletMethod · 0.45
sizeMethod · 0.45

Tested by 2

TEST_FFunction · 0.36
TEST_FFunction · 0.36