Feature Request: Support session state tracking
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 2.5k
- 派生
- 443
- 平均合并
- 18 小时 21 分钟
- 30 天内合并 PR
- 4
描述
Note: I may be able to work on putting together a pull request for this feature request, but I wanted to make sure you were okay with this feature request and the approach I'm taking before doing all that work, hence I am filing this feature request for discussion and approval.
MySQL has a feature enabling server tracking of client session state changes. When this is enabled on the server and client, the server can actually notify the connected client about changes to its session state. This enables the client to, for example (our use case), determine which Global Transaction ID (GTID) or GTIDs were created when the client commits a transaction.
You can read more about this here:
- https://dev.mysql.com/doc/refman/5.7/en/session-state-tracking.html
- https://dev.mysql.com/doc/refman/5.7/en/mysql-session-track-get-first.html
- https://dev.mysql.com/doc/refman/5.7/en/mysql-session-track-get-next.html
Here's what is needed to support this:
- A new constant in
MySQLdb.constants.CLIENT:SESSION_TRACK = 1 << 23 - A new method on
_mysql.connectionnamedget_session_track_gtidswhich returns a list of GTIDs using C functionsmysql_session_track_get_first/mysql_session_track_get_nextand the enum valueSESSION_TRACK_GTIDS. - A new method on
_mysql.connectionnamedget_session_track_variableswhich returns a list of namedtuples containing the session variable names and values for changed variables using the same C functions and the enum valueSESSION_TRACK_SYSTEM_VARIABLES. - A new method on
_mysql.connectionnamedget_session_track_tx_characteristicswhich returns a list of strings of the characteristics that changed using the same C functions and the enum valueSESSION_TRACK_TRANSACTION_CHARACTERISTICS. - A new method on
_mysql.connectionnamedget_session_track_tx_statewhich returns a list of namedtuples containing information parsed from the data as described in the documentation forSESSION_TRACK_TRANSACTION_STATEusing the same C functions and the enum valueSESSION_TRACK_TRANSACTION_STATE.
The bare minimum that we need is items 1 and 2, but implementing also 3 through 5 would be more complete.
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
Start with MySQLdb.constants.CLIENT and the _mysql.connection API, then review the MySQL session-tracking documentation linked in the issue. Implementing the minimum means supporting SESSION_TRACK and get_session_track_gtids; completion for the broader request also includes the three variable, transaction-characteristic, and transaction-state methods with their documented return data.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- mysql, python
- 领域
- database
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100