Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@vbwagner
Copy link

@vbwagner vbwagner commented Sep 16, 2025

Use correct way to detect SPI inner query.

Port fix for detection of SPI inner nodes from adb 6.x Previously we used
already_under_executor_run() to detect if the current node belongs to inner
query. This function does not work for SPI exclusively, so some other nodes,
like function called from the extension, were incorrectly marked as
SPI_INNER_QUERY instead of being TOP_LEVEL_QUERY, which resulted in wrong
metrics collection.

This patch uses _SPI_connected counter to check the level of SPI, but marks all
queries using SPI from interactive session as SPI_INNER_QUERY (f.e. queries
using SPI from functions).

This is a port of commit dadbffb for adb-6.

Co-Authored-By: Denis Kovalev [email protected]

@silent-observer
Copy link

Usually when porting existing commits we use git cherry-pick -x to preserve the authorship of the commit. Also in these cases we use "rebase and merge" when merging, and add a note to the description to not forget this (see other porting tasks as an example)

@vbwagner
Copy link
Author

I think that in this case difference between 6-th and 7-th version prevent this approach.
Some code, which was part of commit dadbffb is already in adb-7.2.0 branch. On other side PR 1648 changes just one condition, and there are two in spi.c (and in commit dadbffb)

@silent-observer
Copy link

Okay, fair. Then at least mention the original author in the description as a co-author (example). Also, the patch description should be line-wrapped to 80 characters, see the wiki article on patch formatting.

@vbwagner
Copy link
Author

Updated description.

RekGRpth

This comment was marked as resolved.

@vbwagner
Copy link
Author

You should have repeated the steps from 6X: the patch should consist of TWO commits

1. revert [e69ca96](https://github.com/arenadata/gpdb/commit/e69ca96b7d91dc03bebcb35e439ff7639afb5a31) of the incorrect commit [f8c4d53](https://github.com/arenadata/gpdb/commit/f8c4d5334e4f5227a000e5a8d46606b83d13c315)

2. cherry-pick of the corrected commit [dadbffb](https://github.com/arenadata/gpdb/commit/dadbffbfeaa142884da8b9eb0daf3cc950ecbc67)

Unfortunately, this doesn't work. Cherry-picking of this commit ito 7-th branch produces conflict. Resolving this conflict in favor of cherry-picking code makes autovaccuum tests hang.

@RekGRpth

This comment was marked as resolved.

@vbwagner
Copy link
Author

Cherry-picking of this commit ito 7-th branch produces conflict

after revert?

Yes. After revert of commit 9730a35 which is cherry-pick of ADBDEV-7415. There would be more than one conflicts without revert.

@RekGRpth

This comment was marked as resolved.

@RekGRpth

This comment was marked as resolved.

Victor Wagner and others added 2 commits September 17, 2025 16:08
Commit f8c4d53 changed detection of node to be SPI inter node, for use in
metrics collection.

However that commit used already_under_executor_run() to detect if the current
node belongs to inner query. This function does not work for SPI exclusively, so
some other nodes, like function called from the extension, were incorrectly
marked as SPI_INNER_QUERY instead of being TOP_LEVEL_QUERY, which resulted in
wrong metrics collection.

This patch uses _SPI_connected counter to check the level of SPI, but marks all
queries using SPI from interactive session as SPI_INNER_QUERY (f.e. queries
using SPI from functions).

Cherry-pick from dadbffb
@Stolb27 Stolb27 requested a review from RekGRpth September 17, 2025 14:04
@Stolb27 Stolb27 enabled auto-merge (rebase) September 17, 2025 14:04
@Stolb27 Stolb27 merged commit 13cb495 into adb-7.2.0 Sep 17, 2025
5 checks passed
@Stolb27 Stolb27 deleted the ADBDEV-7718 branch September 17, 2025 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants