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

Method ScanMetaTableAsync

src/sdk/table_impl.cc:1587–1623  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1585}
1586
1587void TableImpl::ScanMetaTableAsync(const std::string& key_start, const std::string& key_end,
1588 const std::string& expand_key_end, bool zk_access) {
1589 meta_mutex_.AssertHeld();
1590 CHECK(expand_key_end == "" || expand_key_end >= key_end);
1591
1592 std::string meta_addr = cluster_->RootTableAddr(zk_access);
1593 if (meta_addr.empty() && !zk_access) {
1594 meta_addr = cluster_->RootTableAddr(true);
1595 }
1596
1597 if (meta_addr.empty()) {
1598 VLOG(6) << "root is empty";
1599
1600 ThreadPool::Task retry_task = std::bind(&TableImpl::ScanMetaTableAsyncInLock, this, key_start,
1601 key_end, expand_key_end, true);
1602 thread_pool_->DelayTask(FLAGS_tera_sdk_update_meta_internal, retry_task);
1603 return;
1604 }
1605
1606 VLOG(6) << "root: " << meta_addr;
1607 tabletnode::TabletNodeClient tabletnode_client_async(thread_pool_, meta_addr);
1608 ScanTabletRequest* request = new ScanTabletRequest;
1609 ScanTabletResponse* response = new ScanTabletResponse;
1610 request->set_sequence_id(last_sequence_id_++);
1611 request->set_table_name(FLAGS_tera_master_meta_table_name);
1612 MetaTableScanRange(name_, key_start, expand_key_end, request->mutable_start(),
1613 request->mutable_end());
1614 request->set_buffer_limit(FLAGS_tera_sdk_update_meta_buffer_limit);
1615 request->set_round_down(true);
1616
1617 access_builder_->BuildInternalGroupRequest(request);
1618
1619 std::function<void(ScanTabletRequest*, ScanTabletResponse*, bool, int)> done = std::bind(
1620 &TableImpl::ScanMetaTableCallBackWrapper, std::weak_ptr<TableImpl>(shared_from_this()),
1621 key_start, key_end, expand_key_end, get_micros(), _1, _2, _3, _4);
1622 tabletnode_client_async.ScanTablet(request, response, done);
1623}
1624
1625void TableImpl::ScanMetaTableCallBackWrapper(std::weak_ptr<TableImpl> weak_ptr_table,
1626 std::string key_start, std::string key_end,

Callers

nothing calls this directly

Calls 8

MetaTableScanRangeFunction · 0.85
RootTableAddrMethod · 0.80
DelayTaskMethod · 0.80
get_microsFunction · 0.50
AssertHeldMethod · 0.45
emptyMethod · 0.45
ScanTabletMethod · 0.45

Tested by

no test coverage detected