Open
Conversation
This fix ensures `pt-k8s-debug-collector` collects postgreSql databse logs which is stored in `/pgdata/<cluster_name>/pg_log`. A test `TestIndividualFiles` was refactored, and modified for a new case with new feature.
| }() | ||
|
|
||
| time.Sleep(3 * time.Second) // wait for port-forward command | ||
| time.Sleep(10 * time.Second) // wait for port-forward command |
Collaborator
There was a problem hiding this comment.
Why sleep time increase?
Author
There was a problem hiding this comment.
It was too little on my machine. Maybe we should implement some tcp checker to confirm that port-forward is working?
Collaborator
There was a problem hiding this comment.
This would be the best.
svetasmirnova
requested changes
Jan 6, 2026
| // runCmd run command (Dumper.cmd) with given args, return it output | ||
| func (d *Dumper) runCmd(args ...string) ([]byte, error) { | ||
| baseArgs := []string{"--kubeconfig", d.kubeconfig} | ||
| baseArgs = append(baseArgs, args...) |
Collaborator
There was a problem hiding this comment.
If you prefix arguments with --kubeconfig and d.kubeconfig is empty, the following argument will be treated as a path to --kubeconfig. This is wrong.
Author
There was a problem hiding this comment.
Added an if condition for that. We need this to be prefixed because exec command will be wrong.
This refactor includes replacing all of the `kubectl` cli calls with golang sdk for k8s. Additionaly dumper now has new structure, new logger, tar file path controll, and multithreaded approach for downloading and exporting files form multiple pods.
…7_fix_pg_log_collector
…7_fix_pg_log_collector
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fix ensures
pt-k8s-debug-collectorcollects PostgreSQL database logs.DO NOT MERGE BEFORE #1054 IS MERGED
What was added:
To keep changes minimal, the existing test
TestIndividualFileswas modified to cover the new case.The test was refactored because the previous implementation couldn't handle files with variable names.
In
/pgdata/<cluster_name>/pg_log, logs are named according to the day/week, so filenames are not known at runtime.A new function
getAllFilesFromDirectorywas added todumper.go.Its purpose is the same as the existing
getIndividualFiles, but it supports extracting multiple files from a directory. It is useful because pg log filenames can vary, and there can be multiple log files.A new function
parseEnvswas added todumper.go.Its purpose is to load environment variables present in the pod into a string.
It is used inside
getAllFilesFromDirectoryto load$PGBACKREST_DB_PATH, because there is no simpler way to determine the path/pgdata/<cluster_name>/pg_log, which can vary.(
/libhas not been changed)