Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick Add gp_stat_progress_dtx_recovery for observability #872

Merged
merged 9 commits into from
Jan 16, 2025

Conversation

yjhjstz
Copy link
Member

@yjhjstz yjhjstz commented Jan 15, 2025

Fixes #ISSUE_Number

What does this PR do?

Type of Change

  • Bug fix (non-breaking change)
  • New feature (non-breaking change)
  • Breaking change (fix or feature with breaking changes)
  • Documentation update

Breaking Changes

Test Plan

  • Unit tests added/updated
  • Integration tests added/updated
  • Passed make installcheck
  • Passed make -C src/test installcheck-cbdb-parallel

Impact

Performance:

User-facing changes:

Dependencies:

Checklist

Additional Context

CI Skip Instructions


hyongtao-db and others added 9 commits January 15, 2025 08:51
The "version" argument to ArgumentParser is deprecated. 
Please refer to https://bugs.launchpad.net/yade/+bug/1134422

Take a short example:
```
import argparse
parser = argparse.ArgumentParser(version='1.0')
```
the error result is shown as below:
```
$ python3 main.py 
Traceback (most recent call last):
  File "main.py", line 2, in <module>
    parser = argparse.ArgumentParser(version='1.0')
TypeError: __init__() got an unexpected keyword argument 'version'
```

**Solution**: use `parser.add_argument()` to fix it.

Signed-off-by: Yongtao Huang <[email protected]>
When an error occurs in pg_basebackup(), its detail can not be
printed properly. Instead, the following error will be raised:

```
+ERROR:  TypeError: can only concatenate str (not "bytes") to str
+CONTEXT:  Traceback (most recent call last):
+  PL/Python function "pg_basebackup", line 26, in <module>
+    results = str(e) + "\ncommand output: " + e.output
+PL/Python function "pg_basebackup"
```
This problem is caused by that e.output is a bytes array and
cannot contact str.

The solution is to change e.output to e.output.decode().
…g_transform

Objects in these two catalogs do not have pg_depend nor pg_shdepend entries. We should
ignore the dependency check for them like a few others.

Fix https://github.com/greenplum-db/gpdb/issues/12016
Long log:

The `distutils `module was deprecated in Python 3.10 and is scheduled for removal in Python 3.12.
At the same time, it is also dead code.

Signed-off-by: Yongtao Huang <[email protected]>
We might be hitting a race condition where we are suspending
`after_orphaned_check` on before suspending on `before_orphaned_check`,
which may cause the `gp_inject_fault_infinite` of
`before_orphaned_check` to never get triggered.

Reorder the fault injection to fix the issue.

Co-authored-by: Huansong Fu <[email protected]>
Long log:

Module threading.Thread.getName() is deprecated since python 3.10.
Deprecated getter/setter API for 
[name](https://docs.python.org/3/library/threading.html#threading.Thread.name); 
use it directly as a property instead.

Take a simple example in python 3.10:
```
import threading
import time

def run(n):
    print("task", n)
    time.sleep(1)
    print('1s')
    time.sleep(1)
    print('0s')
    time.sleep(1)

if __name__ == '__main__':
    t1 = threading.Thread(target=run, args=("t1",))
    t1.start()
    print(t1.getName())
    print(t1.name)
```

The result is shown as below:
```
$ python main.py
task t1
/hoem/gpadmin/main.py:15: DeprecationWarning: getName() is deprecated, get the name attribute instead
  print(t1.getName())
Thread-1 (run)
Thread-1 (run)
1s
0s
```

Signed-off-by: Yongtao Huang <[email protected]>
dtx recovery may take time sometimes and will leave you in the dark with
how far the recovery has progressed.
`gp_stat_progress_dtx_recovery` is a view that shows progress
of the current dtx recovery.

There are 5 main phases (excluding initializing):
1. recovering commited distributed transactions
2. gathering in-doubt transactions
3. aborting in-doubt transactions
4. gathering in-doubt orphaned transactions
5. managing in-doubt orphaned transactions

`gp_stat_progress_dtx_recovery` will be shown with column:
phase
recover_commited_dtx_total
recover_commited_dtx_completed
in_doubt_tx_total
in_doubt_tx_in_progress
in_doubt_tx_aborted

The wording of "managing" is used instead of "aborting" for in-doubt
orphaned transactions to make it slightly ambigious. There is a chance
an in-doubt transaction is already an on going transaction and there
will be no need to dispatch a dtx abort command.
This reverts commit 85d943910c74b48e606515fc18a7d4a99e197dbc.

Bypass resgroup still will put proc into cgroup and use a small
value of query memory so it will not impact system too much. Revert
previous commit let other application like GPCC can work easily.
@yjhjstz yjhjstz marked this pull request as ready for review January 15, 2025 08:53
@yjhjstz yjhjstz added the cherry-pick cherry-pick upstream commts label Jan 15, 2025
reshke
reshke previously approved these changes Jan 16, 2025
@yjhjstz yjhjstz requested a review from my-ship-it January 16, 2025 07:37
my-ship-it
my-ship-it previously approved these changes Jan 16, 2025
@tuhaihe tuhaihe changed the base branch from main to 1X_STABLE January 16, 2025 10:51
@tuhaihe tuhaihe changed the base branch from 1X_STABLE to main January 16, 2025 10:51
@tuhaihe tuhaihe dismissed stale reviews from my-ship-it and reshke January 16, 2025 10:51

The base branch was changed.

@tuhaihe
Copy link
Member

tuhaihe commented Jan 16, 2025

Hi @my-ship-it @reshke, sorry for the review dismissal. Now our PRs are facing some unreasonable problems; we cannot rebase and merge the PR into the main branch.

I just found one workaround[1]: edit the target branch to another one, then change back to the main branch. I would like to see if it works. Sorry for bothering you guys again.

[1] https://github.com/orgs/community/discussions/51612

@yjhjstz yjhjstz merged commit 1cbba02 into apache:main Jan 16, 2025
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick cherry-pick upstream commts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants