-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
sql: COPY FROM tests are broken #18352
Comments
These problems are due to race conditions in lib/pq. I'm becoming increasingly convinced that we should move off of lib/pq completely, so I'm inclined to not fix these bugs, but instead use our time to migrating to pgx. If anyone cares I've put some of the work at https://github.com/mjibson/pq/tree/copy-race |
Should we disable COPY FROM for now then? |
No COPY works fine in cockroach if you use psql. And it's fine with lib/pq as long as you don't try and do the weird things the tests are testing for. But these tests should have been added to lib/pq years ago when they first added COPY support, but they weren't. Cockroach is fine. |
So what do we do here? We should either open another issue in |
We can't pass in the SQL string directly because COPY is a specific mode. |
So are these tests even testing Cockroach or are they just testing |
They would be testing cockroach if lib/pq weren't broken. That is, they attempt to test cockroach's connection state machine to verify it can't do the things the tests test. But lib/pq's state machine is broken instead, so we can't even get there. Yes, we should open up a lib/pq bug. I'll do that sometime. I agree we should circumvent lib/pq so we can actually test cockroach. I think we should switch to pgx to do this. |
Couldn't we hit similar problems with the protocol implementation in pgx? Perhaps we should fork/extend either pq or pgx for the purpose of allowing flexible testing of our COPY protocol implementation. |
Yes, that is possible. I've already done an initial implementation of our own driver and a pgx fork. Still prototyping both before I can figure out which one makes more sense. |
As it stands, using pgx for |
We can also fix these tests by using the pgproto package from pgx to manually send packets in the order that we want. This will allow us to remove the racey lib/pq code and correctly test our COPY implementation for adversarial input. |
53368: docgen: update template for http docs r=mjibson a=mjibson 53511: sql: unskip and move some COPY tests to pgtest r=mjibson a=mjibson Now that we have pgtest we can much more easily test weird message ordering without dealing with lib/pq problems. Fixes #18352 Release note: None Release justification: Non-production code changes 53581: opt: push limit into unconstrained partial index scan r=RaduBerinde a=mgartner This commit updates the PushLimitIntoConstrainedScan rule to push limits into unconstrained partial index scans. The rule has been renamed to PushLimitIntoFilteredScan to better reflect this new logic. Release justification: This is a low-risk update to new functionality, partial indexes. Fixes #50828 Release note: None Co-authored-by: Matt Jibson <matt.jibson@gmail.com> Co-authored-by: Marcus Gartner <marcus@cockroachlabs.com>
Both
TestCopyOne
andTestCopyInProgress
were previously skipped because of lib/pq#558, but this issue has since been fixed. With thet.Skip
calls removed, though, the tests both fail with timeout errors. I'm not sure if this is a test error or a real error (in cockroach or in lib/pq), but we should investigate.The text was updated successfully, but these errors were encountered: