-
Notifications
You must be signed in to change notification settings - Fork 1.5k
pgsql: add initial support to CopyIn mode/ subprotocol - v5 #13326
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
Open
jufajardini
wants to merge
13
commits into
OISF:master
Choose a base branch
from
jufajardini:7645-pgsql/v5
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+367
−180
Conversation
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
We have a data structure that can be used both for backend and frontend messages, but was named as backend only. Related to Task OISF#7645
Important for CopyIn mode/ subprotocol, where the frontend is the one sending 0 or more messages to the backend as part of a transaction. Related to Task OISF#7645
Related to Task OISF#7644
This sub-protocol inspects messages sent mainly from the frontend to the backend after a statement like 'COPY FROM STDIN' has been processed by the backend. Parses new messages: - CopyInResponse -- initiates copy-in mode/sub-protocol - CopyData (In) -- data transfer message, from frontend to backend - CopyDone -- signals that no more CopyData messages will be seen from the frontend, for the current transaction - CopyFail -- used by the frontend to signal some failure to proceed with sending CopyData messages Task OISF#7645
While this could be considered minor, they were not just bad, but misleading names, as the variables weren't really `dummy` responses, but consolidating several messages.
To set apart states that are both for frontend and backend.
Review pub visibility to: Make it pub crate-only wherever possible. Remove pub altogether where not-needed.
Since some of state types could indicate a request completion, don't process them in if/else statements. Related to Task OISF#7645
There shouldn't be duplicated messages in the requests Vec. And thus the parser shouldn't log duplicated keys nor messages. Add debug validations to ensure this. With PGSQL's current state machine, most frontend/ client messages will lead to the creation of a new transaction - which would prevent duplicated messages being pushed to the requests array and reaching the logger. The current exceptions for that are: - CopyDataIn - CopyDone - CopyFail Thus, debug statements were added for those cases. CopyDone and CopyFail, per the documentation, shouldn't be seen duplicated on the wire for the same transaction. CopyDataIn -- yes, but we consolidate those, so the expectation is that they won't be duplicated in the requests array or when reaching the logger either. Related to Task OISF#7645
2 tasks
WARNING:
Pipeline 26245 |
victorjulien
approved these changes
Jun 3, 2025
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.
Changes (if applicable):
Link to ticket: https://redmine.openinfosecfoundation.org/issues/
https://redmine.openinfosecfoundation.org/issues/7645
Previous PR: #13298
Describe changes:
SCLogNotice statement
debug_validation
statements in the related commit message to address Jason's concern here: pgsql: add initial support to CopyIn mode/ subprotocol - v4 #13298 (comment)Provide values to any of the below to override the defaults.
SV_BRANCH=OISF/suricata-verify#2520