MCPcopy Create free account
hub / github.com/apache/impala / CatalogUpdateCallback

Method CatalogUpdateCallback

be/src/service/impala-server.cc:2441–2493  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2439}
2440
2441void ImpalaServer::CatalogUpdateCallback(
2442 const StatestoreSubscriber::TopicDeltaMap& incoming_topic_deltas,
2443 vector<TTopicDelta>* subscriber_topic_updates) {
2444 DCHECK(FLAGS_catalogd_deployed);
2445 StatestoreSubscriber::TopicDeltaMap::const_iterator topic =
2446 incoming_topic_deltas.find(CatalogServer::IMPALA_CATALOG_TOPIC);
2447 if (topic == incoming_topic_deltas.end()) return;
2448 const TTopicDelta& delta = topic->second;
2449 TopicItemSpanIterator callback_ctx (delta.topic_entries, FLAGS_compact_catalog_topic);
2450
2451 TUpdateCatalogCacheRequest req;
2452 req.__set_is_delta(delta.is_delta);
2453 req.__set_native_iterator_ptr(reinterpret_cast<int64_t>(&callback_ctx));
2454 TUpdateCatalogCacheResponse resp;
2455 Status s = exec_env_->frontend()->UpdateCatalogCache(req, &resp);
2456 if (!s.ok()) {
2457 LOG(ERROR) << "There was an error processing the impalad catalog update. Requesting"
2458 << " a full topic update to recover: " << s.GetDetail();
2459 subscriber_topic_updates->emplace_back();
2460 TTopicDelta& update = subscriber_topic_updates->back();
2461 update.topic_name = CatalogServer::IMPALA_CATALOG_TOPIC;
2462 update.__set_from_version(0L);
2463 ImpaladMetrics::CATALOG_READY->SetValue(false);
2464 // Dropped all cached lib files (this behaves as if all functions and data
2465 // sources are dropped).
2466 LibCache::instance()->DropCache();
2467 } else {
2468 {
2469 unique_lock<mutex> unique_lock(catalog_version_lock_);
2470 if (catalog_update_info_.catalog_version != resp.new_catalog_version) {
2471 LOG(INFO) << "Catalog topic update applied with version: " <<
2472 resp.new_catalog_version << " new min catalog object version: " <<
2473 resp.catalog_object_version_lower_bound;
2474 }
2475 catalog_update_info_.catalog_version = resp.new_catalog_version;
2476 catalog_update_info_.catalog_topic_version = delta.to_version;
2477 catalog_update_info_.catalog_service_id = resp.catalog_service_id;
2478 catalog_update_info_.catalog_object_version_lower_bound =
2479 resp.catalog_object_version_lower_bound;
2480 catalog_update_info_.UpdateCatalogVersionMetrics();
2481 }
2482 ImpaladMetrics::CATALOG_READY->SetValue(resp.new_catalog_version > 0);
2483 // TODO: deal with an error status
2484 discard_result(UpdateCatalogMetrics());
2485 }
2486 // Always update the minimum subscriber version for the catalog topic.
2487 {
2488 unique_lock<mutex> unique_lock(catalog_version_lock_);
2489 DCHECK(delta.__isset.min_subscriber_topic_version);
2490 min_subscriber_catalog_topic_version_ = delta.min_subscriber_topic_version;
2491 }
2492 catalog_version_update_cv_.NotifyAll();
2493}
2494
2495static inline void MarkTimelineEvent(RuntimeProfile::EventSequence* timeline,
2496 const string& str) {

Callers

nothing calls this directly

Calls 11

discard_resultFunction · 0.85
UpdateCatalogCacheMethod · 0.80
GetDetailMethod · 0.80
DropCacheMethod · 0.80
NotifyAllMethod · 0.80
findMethod · 0.45
endMethod · 0.45
frontendMethod · 0.45
okMethod · 0.45
SetValueMethod · 0.45

Tested by

no test coverage detected