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

Management protocol incompatibilites due to version numbers #447

Open
fluca1978 opened this issue May 15, 2024 · 4 comments
Open

Management protocol incompatibilites due to version numbers #447

fluca1978 opened this issue May 15, 2024 · 4 comments
Assignees
Labels
feature New feature

Comments

@fluca1978
Copy link
Collaborator

Now that the pgagroal-cli and friends send the application version and pgagroal answer with its version number (see work in #392 ), it is possible to make the management protocol to raise an error if the version numbers between sides are incompatible.
Surely incompatibilities must be raised between major versions, while it can also be added for minor versions as well.

@fluca1978 fluca1978 added the feature New feature label May 15, 2024
@fluca1978 fluca1978 self-assigned this May 15, 2024
@fluca1978
Copy link
Collaborator Author

Self assigning to myself, if someone else wants to work on this, please advice.

@fluca1978
Copy link
Collaborator Author

I'm slowly working on this, here are some thought.

If a message comes from an incompatible protocol version, the reply is assumed to be an error.
Compatibility means that at max 2 units differ in the minor version, assuming the major one is the same. So for instance 1.5.1 and 1.7.12 are compatible, 2.0.0 and 1.9.99 are not, 1.5.0 and 1.8.0 are not.

In order to distinguish if the error comes from a low level problem (e.g., a network error) or a protocol version mismatch, a new exit code must be introduced. In other words, $? from a command will indicate the case of failure.
The JSON output for a command must also specify the cause of the error, i.e., the protocol mismatch, but I'm thinking to add a dedicated field like protocol_mismatch to quickly allow for parsing of a JSON output and get a glance at the main root problem (JSON already has an error boolean field).

When pgagroal receive an incompatible message, it will reply with a special message with an header that spells the incompatibility and will drop the request, so no action is going to be taken on the daemon side.
On the other hand, if pgagroal-cli (and friends) receive a message from an incompatible server, an error has to be reported so that the content of the message is not "parsed".

@jesperpedersen
Copy link
Collaborator

I don't think we should spend too much time on this, as we know that the next version will be 2.0 which will break everything in I/O layer and management layer as well.

2.0 will use a JSON based message format, where the header will have the client side version, and the response will have the server side version. Then we can look at what we can do for each message type.

Having a simple JSON format as the core of the management layer will allow us to make changes quicker even though there is a larger overhead compared to the existing binary protocol

@fluca1978
Copy link
Collaborator Author

Ok, I'll postpone this work to the new JSON infrastructure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

No branches or pull requests

2 participants