Feature Request: Support session state tracking
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 2.5k
- Fork
- 443
- Merge medio
- 18h 21m
- PR unite (30g)
- 4
Descrizione
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.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- mysql, python
- Ambito
- database
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 42/100