Skip to content

Conversation

@Mohamed-Elfardy
Copy link

Allow sink-only config upgrades when sources or metrics storage do not support upgrades.

Unsupported upgrades now emit a warning instead of failing, and the sink schema upgrade proceeds as expected.
The "--version" output was also updated to include the sink schema version.
the error message turned into warning.

Fixes #1114

@0xgouda
Copy link
Collaborator

0xgouda commented Jan 19, 2026

please fix the failing linter test.

@Mohamed-Elfardy
Copy link
Author

please fix the failing linter test.

Hi,
No code changes here — this is just an empty commit to re-run CI after the previous workflow failure.

The workflow is waiting for your approval.
Thanks!

@pashagolub pashagolub added refactoring Something done as it should've been done from the start config Configuration store related labels Jan 21, 2026
@coveralls
Copy link

coveralls commented Jan 21, 2026

Pull Request Test Coverage Report for Build 21323290725

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 25 of 71 (35.21%) changed or added relevant lines in 5 files are covered.
  • 16 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.4%) to 74.87%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/cmdopts/errors.go 0 3 0.0%
cmd/pgwatch/main.go 1 13 7.69%
internal/cmdopts/cmdconfig.go 16 47 34.04%
Files with Coverage Reduction New Missed Lines %
internal/cmdopts/cmdconfig.go 5 60.36%
internal/sinks/postgres.go 11 76.82%
Totals Coverage Status
Change from base Build 21218655232: -0.4%
Covered Lines: 4019
Relevant Lines: 5368

💛 - Coveralls

@pashagolub pashagolub force-pushed the fix-sink-upgrade-warn branch from 1cf76b0 to 978bb27 Compare January 22, 2026 09:47
Comment on lines 10 to 11
ConfigSchema = "00824"
SinkSchema = "01110"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
ConfigSchema = "00824"
SinkSchema = "01110"
configSchema = "00824"
sinkSchema = "01110"

I think lower-cased var names are better to keep the whole style of the definition

} else {
opts.CompleteCommand(ExitCodeConfigError)
return errors.New("configuration storage does not support upgrade")
log.GetLogger(ctx).Warn("configuration storage does not support upgrade, skipping")
Copy link
Collaborator

Choose a reason for hiding this comment

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

No, we shouldn't log here. We should return error. But let user ability to remove config option completely and re-run the command.

}
} else {
opts.CompleteCommand(ExitCodeConfigError)
return errors.New("sink storage does not support upgrade")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Because here we return error. We must behave the same in all situations.

The problem was not in how we handle, but that it's impossible to run upgrade command without specifying --sources and --metrics flags. This is the main issue! We must allow upgrade specifying only minimal --sink or --metrics options

@Mohamed-Elfardy
Copy link
Author

Mohamed-Elfardy commented Jan 22, 2026

Thanks for the detailed feedback, that makes sense
I understand now that the core issue is not just changing error → warning, but allowing upgrade to run with minimal flags
(only --sink or --metrics) without requiring both --sources and --metrics.

I’ll rework the logic to make the behavior consistent across all cases and update the implementation accordingly.
Please let me know if there’s any preferred approach or specific place you’d like me to focus on first.

@Mohamed-Elfardy
Copy link
Author

All checks are passing now.

If there are any remaining adjustments you’d like me to make, please let me know and I’ll address them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config Configuration store related refactoring Something done as it should've been done from the start

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't upgrade sink schema if using yaml source and metric configs

4 participants