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

Function ParseTopicKey

be/src/scheduling/admission-controller.cc:325–340  ·  view source on GitHub ↗

Parses the topic key to separate the prefix that helps recognize the kind of update received.

Source from the content-addressed store, hash-verified

323// Parses the topic key to separate the prefix that helps recognize the kind of update
324// received.
325static inline bool ParseTopicKey(
326 const string& topic_key, string* prefix, string* suffix) {
327 // The prefix should always be present and the network address must be at least 3
328 // characters (including ':' and if the hostname and port are each only 1 character).
329 // Then the topic_key must be at least 8 characters (5 + 3).
330 const int MIN_TOPIC_KEY_SIZE = 8;
331 if (topic_key.length() < MIN_TOPIC_KEY_SIZE) {
332 VLOG_QUERY << "Invalid topic key for pool: " << topic_key;
333 return false;
334 }
335 DCHECK_EQ(TOPIC_KEY_POOL_PREFIX.size(), TOPIC_KEY_STAT_PREFIX.size())
336 << "All admission topic key prefixes should be of the same size";
337 *prefix = topic_key.substr(0, TOPIC_KEY_POOL_PREFIX.size());
338 *suffix = topic_key.substr(TOPIC_KEY_POOL_PREFIX.size());
339 return true;
340}
341
342// Parses the pool name and backend_id from the topic key if it is valid.
343// Returns true if the topic key is valid and pool_name and backend_id are set.

Callers 1

HandleTopicUpdatesMethod · 0.85

Calls 3

substrMethod · 0.80
lengthMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected