-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add query cache #1520
base: master
Are you sure you want to change the base?
feat: add query cache #1520
Conversation
@@ -1390,6 +1413,13 @@ class ObSQLSessionInfo: public common::ObVersionProvider, public ObBasicSessionI | |||
bool is_send_control_info_ = false; // whether send control info to client | |||
bool auto_flush_trace_ = false; | |||
bool coninfo_set_by_sess_ = false; | |||
// use for query cache | |||
bool use_query_cache_ = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这些信息可以创建一个QueryCacheCtx结构, 然后放入放到ExecContext中, 不要放在session中
src/sql/query_cache/ob_query_cache.h
Outdated
int64_t row_cnt_; | ||
common::ObArenaAllocator inner_alloc_; | ||
common::ObSafeArenaAllocator alloc_; | ||
DRWLock lock_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
没用, 可以删除
@@ -1338,6 +1338,13 @@ int ObSelectResolver::resolve_query_options(const ParseNode *node) | |||
LOG_USER_ERROR(OB_ERR_CANT_USE_OPTION_HERE, "SQL_CALC_FOUND_ROWS"); | |||
} | |||
} | |||
LOG_INFO("ObSelectResolver resolve_query_options"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
无效日志去掉
private: | ||
ObQueryCache() : instance_(nullptr), row_mem_size_(0), row_cnt_(0), alloc_(inner_alloc_) {} | ||
|
||
private: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
构造函数初始化这些成员信息;
TO_STRING_KV(KP(query_cache_value_), K(handle_)); | ||
}; | ||
|
||
class ObQueryCache : public common::ObKVCache<ObQueryCacheKey, ObQueryCacheValue> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以使用MTL, 为每个租户构建一个QueryCache实例
int ObQueryCache::flush() | ||
{ | ||
int ret = OB_SUCCESS; | ||
destroy(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个flush 实现太粗爆, 直接将query cache对象destroy然后init一个新的, 存在与实际请求并发问题, 可以看下kv cache使用下, flush相关实现;
Task Description
Solution Description
Add query cache to cache SQL and corresponding result sets, which can get better performance in a large number of repeated query scenarios,
Passed Regressions
Upgrade Compatibility
Other Information
Release Note