Skip to content

PT-2368 - full refactor of a config library#1064

Merged
svetasmirnova merged 12 commits into3.xfrom
PT-2368-config-lib-refactor
Mar 6, 2026
Merged

PT-2368 - full refactor of a config library#1064
svetasmirnova merged 12 commits into3.xfrom
PT-2368-config-lib-refactor

Conversation

@BON4
Copy link
Copy Markdown
Contributor

@BON4 BON4 commented Jan 28, 2026

Rewrite config library to comply with Percona Toolkit specification

Summary

Complete rewrite of the config library to fully comply with the Percona Toolkit configuration file specification. The previous implementation was a simple key-value parser that didn't support many required features.

New Implementation

  • Full Percona Toolkit specification compliance

  • Integration with kong CLI parser - configs and command-line args work together

  • --config flag support - must be first argument, space-separated

  • Passthrough arguments - everything after -- passed to mysql/mysqladmin

  • no- prefix handling - no-optimize sets optimize=false

  • Proper config file precedence - system - user - tool-specific

  • Custom types - BoolYN (yes/no/1/0/on/off), StdinRequestString (password prompting)

  • Error handling

  • Full test coverage

  • The contributed code is licensed under GPL v2.0

  • Contributor Licence Agreement (CLA) is signed

  • util/update-modules has been ran

  • Documentation updated

  • Test suite update

This refactor includes new config lib based on kong module.
This lib is now follows an official percona specs, for parsing
default and specified configs.
This change introduces support for a new config lib.
Comment thread src/go/lib/config/old_config.go
Comment thread src/go/lib/config/old_config.go
Comment thread src/go/lib/config/old_config.go
Comment thread src/go/lib/config/old_config.go
Comment thread src/go/lib/config/config.go
@svetasmirnova
Copy link
Copy Markdown
Collaborator

Options in the only modified tool do not work as expected:

sveta@s76:~/src/percona/percona-toolkit$ ./bin/pt-k8s-debug-collector --version
pt-k8s-debug-collector: error: couldn't find binding of type []interface {} for parameter 0 of func(...interface {}) error(), use kong.Bind([]interface {})
sveta@s76:~/src/percona/percona-toolkit$ ./bin/pt-k8s-debug-collector version
pt-k8s-debug-collector: error: unexpected argument version

Expected behavior:

$ ./bin/pt-mongodb-summary --version
pt-mongodb-summary
Version 3.7.1
Build: 2026-01-30T15:30:33+0300 using go1.25.5
Commit: 14324ff374b078089e3bbae2bdcf6e09f7c4cc35

And we should not change this format, because it is aligned with other tools.

Copy link
Copy Markdown
Collaborator

@svetasmirnova svetasmirnova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above.

@BON4
Copy link
Copy Markdown
Contributor Author

BON4 commented Jan 30, 2026

@svetasmirnova Yep, forget to push some fixes.

@BON4 BON4 requested a review from svetasmirnova January 30, 2026 20:57
@BON4
Copy link
Copy Markdown
Contributor Author

BON4 commented Jan 30, 2026

@JiriCtvrtka Not sure if we should change old_config.go because this is old implementation and eventually it will be replaced with the new one. I left it just to support compatibility with not yet migrated tools.

@BON4 BON4 requested a review from JiriCtvrtka January 30, 2026 21:51
Copy link
Copy Markdown
Collaborator

@svetasmirnova svetasmirnova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also merge changes from 3.x, so library files have a copyright header, and add a copyright header to the new config.go

Comment thread src/go/lib/config/old_config.go
Comment thread src/go/lib/config/config.go
Comment thread src/go/pt-galera-log-explainer/main.go
Copy link
Copy Markdown
Collaborator

@svetasmirnova svetasmirnova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please answer questions and process suggested changes.

Comment thread src/go/pt-galera-log-explainer/README.rst Outdated
Comment thread src/go/pt-k8s-debug-collector/README.rst Outdated
Comment thread src/go/pt-galera-log-explainer/main.go
Co-authored-by: Sveta Smirnova <svetasmirnova@users.noreply.github.com>
@it-percona it-percona temporarily deployed to PT-2368-config-lib-refactor - percona-toolkit PR #1064 March 4, 2026 17:41 — with Render Destroyed
Comment thread src/go/pt-k8s-debug-collector/README.rst Outdated
Co-authored-by: Sveta Smirnova <svetasmirnova@users.noreply.github.com>
@BON4 BON4 requested a review from svetasmirnova March 6, 2026 16:35
@svetasmirnova svetasmirnova merged commit 9323bc4 into 3.x Mar 6, 2026
3 of 4 checks passed
@svetasmirnova svetasmirnova deleted the PT-2368-config-lib-refactor branch March 6, 2026 18:31
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.

5 participants