实现会话变量的能力
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 4.4k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
当我们在使用一个数据库时,需要一些手段来调整当前会话或整个系统的行为。比如事务隔离级别、超时时间、show trace等。
Describe the solution you'd like
A clear and concise description of what you want to happen.
使用会话变量来做这个控制。
会话变量,session variables,是MySQL中一个非常基础的功能,当前MiniOB中有非常简单的实现,但是没有到能够正常使用的程度。
由于MiniOB是一个学习使用的数据库,对各个功能要求尽量简介、够用,保持代码结构清晰,所以不用实现与MySQL完全相同的功能。
在初步阶段,需要实现一个会话变量的框架,后续能够在此基础上做扩展。
功能列表:
- 全局变量(当前可以不要求支持持久化)。重连才会生效
- 会话变量(仅当前会话/连接生效)
- 变量的读取和设置
- 支持 sql_debug 变量(参考 session.h:sql_debug_)
- 支持变量的类型:整数、字符串、浮点数和boolean(参考 value.h中的定义)
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
OceanBase 数据库的实现可以参考 https://github.com/oceanbase/oceanbase/tree/develop/src/share/system_variable
由于OceanBase 是一个生产级数据库,实现较复杂,可以浏览代码做参考。
如果对这个feature感兴趣,可以联系我,随时交流。
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with session.h, especially the existing sql_debug_ member, and value.h for the supported value types. Trace how session state and SQL variable reads or writes are currently handled. Done means a clear extensible framework supports global and session variables, reading and setting integer, string, floating-point, and boolean values, including sql_debug.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100