cambyzju commented on code in PR #66812:
URL: https://github.com/apache/doris/pull/66812#discussion_r3829675191
##########
be/src/exprs/function/dictionary_factory.h:
##########
@@ -37,11 +41,29 @@ class DictionaryFactory : private boost::noncopyable {
// Returns nullptr if failed
std::shared_ptr<const IDictionary> get(int64_t dict_id, int64_t
version_id) {
- std::unique_lock lc(_mutex);
- // dict_id and version_id must match
- if (_dict_id_to_dict_map.contains(dict_id) &&
- _dict_id_to_version_id_map[dict_id] == version_id) {
- return _dict_id_to_dict_map[dict_id];
+ // simulate slow query holding old version_id
+ DBUG_EXECUTE_IF("dict_get_delay", {
+ int sleep_sec = dp->param<int>("sleep_sec", 10);
+ LOG(INFO) << "debug point dict_get_delay: sleeping " << sleep_sec
+ << "s before get dict_id=" << dict_id << " version_id="
<< version_id;
+ sleep(sleep_sec);
+ });
+ std::shared_lock lc(_mutex);
+ auto it = _dict_id_to_versioned_map.find(dict_id);
+ if (it != _dict_id_to_versioned_map.end()) {
+ auto vit = it->second.find(version_id);
+ if (vit != it->second.end()) {
+ return vit->second;
+ }
+ }
+ // fallback to staging: version may have been increased by FE but not
yet committed
+ auto rit = _refreshing_dict_map.find(dict_id);
Review Comment:
这些是之前设计的固有缺陷,本次 fallback to staging 是尽量去缓解。重启导致的问题,远不止这一个,不是本次 PR 解决的范畴。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]