arenadata / gpdb

Arenadata DB
https://docs.arenadata.io/en/ADB/current/introduction/intro.html
Apache License 2.0
40 stars 22 forks source link

DRAFT: Implement MVP to handle command count with exact query (GPDB 6X) #1042

Closed whitehawk closed 2 weeks ago

whitehawk commented 1 month ago

+++DRAFT (for CI only as of yet)+++

Implement MVP to handle command count with exact query (GPDB 6X)

Problem description: Monitoring extension altered 'gp_command_count' value that was dispatched to the segments. It was done to keep tracking of query execution (as 'gp_command_count' was used as 'ccnt' to identify command and track the progress of its execution). It resulted in several issues with IC proxy, shared input scans (and who knows what else...) because of not sync value of 'gp_command_count' between the QD and the QEs.

Solution: Use 'queryCommandId' of 'PGPROC' for command identification.

  1. queryCommandId is set to gp_command_count every time gp_command_count is incremented on the dispatcher (that’s old behavior, it is not changed).

  2. QueryDesc now contains 1 new field (filled in CreateQueryDesc()) command_id - the updated value of MyProc->queryCommandId after its increment.

  3. At the Dispatcher side:

That allows to handle cursors and utility commands with plannable parts (like CTAS) without touching the guts of each individual command function (like ExecCreateTableAs()).

  1. MyProc->queryCommandId is added to the query message dispatched to the executors (instead of gp_command_count). gp_command_count is not sent to the QEs.

  2. At the Executor side backend acquires proper queryCommandId from the message dispatched from the query dispatcher. On the QE the gp_command_count is set to be equal to the queryCommandId.

  3. Most parts of the code, that used gp_command_count, now use queryCommandId (some places, that work solely on QD or QE, still use gp_command_count to reduce delta).

BenderArenadata commented 1 month ago

Allure report https://allure.adsw.io/launch/79535

BenderArenadata commented 1 month ago

Allure report https://allure.adsw.io/launch/79536

BenderArenadata commented 1 month ago

Allure report https://allure.adsw.io/launch/79592

BenderArenadata commented 1 month ago

Failed job Regression tests with ORCA on x86_64: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1874052

BenderArenadata commented 1 month ago

Failed job Regression tests with Postgres on x86_64: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1874051

whitehawk commented 1 month ago

bender build

BenderArenadata commented 1 month ago

Allure report https://allure.adsw.io/launch/79653

BenderArenadata commented 1 month ago

Allure report https://allure.adsw.io/launch/79717

BenderArenadata commented 1 month ago

Allure report https://allure.adsw.io/launch/79718