php / php/php-src

mysqlnd (+ mysqli etc.) - expose the gtid to PHP in the OkPacket

Open
#19,782 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Extension: mysqlnd Feature Status: Needs Triage
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

Looks like the gtid is already being parsed, but not exposed in PHP. It would be great to just be able to access it from the OkPacket with something like packet->gtid or packet->state_changes->gtid.

why

I can use it to track what user did what gtid change to with a gtid aware cdc on mysql. This is already working on a nodejs server (using mysql2). From my PHP server, I can only track from my ORM with timestamp + table + primary-key-id instead of gtid.

The other state changes would also be helpful from PHP-land, e.g. database for limiting the number of pools I need to run in a multi-db environment, which i cant implement in PHP at all.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how mysqlnd parses and exposes the MySQL OkPacket through mysqli, focusing on the existing packet and state-change handling. Done means PHP code can access the packet GTID and, if exposed, the other requested state changes; verify behavior with a MySQL setup that produces GTID-aware responses.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, mysql
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.