Skip to content

Commit

Permalink
proxy: Delay SASL complete message until auth is done (#10189)
Browse files Browse the repository at this point in the history
The final SASL complete message can be bundled with the remainder of the
auth flow messages until ReadyForQuery.

neondatabase/cloud#19184
  • Loading branch information
cloneable authored Dec 19, 2024
1 parent 43dc034 commit b135194
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions proxy/src/auth/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,9 @@ mod tests {
.await
.unwrap();

// flush the final server message
stream.flush().await.unwrap();

handle.await.unwrap();
}

Expand Down
8 changes: 7 additions & 1 deletion proxy/src/sasl/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ impl<S: AsyncWrite + Unpin> SaslStream<'_, S> {
self.stream.write_message(&msg.to_reply()).await?;
Ok(())
}

// Queue a SASL message for the client.
fn send_noflush(&mut self, msg: &ServerMessage<&str>) -> io::Result<()> {
self.stream.write_message_noflush(&msg.to_reply())?;
Ok(())
}
}

/// SASL authentication outcome.
Expand Down Expand Up @@ -85,7 +91,7 @@ impl<S: AsyncRead + AsyncWrite + Unpin> SaslStream<'_, S> {
continue;
}
Step::Success(result, reply) => {
self.send(&ServerMessage::Final(&reply)).await?;
self.send_noflush(&ServerMessage::Final(&reply))?;
Outcome::Success(result)
}
Step::Failure(reason) => Outcome::Failure(reason),
Expand Down

1 comment on commit b135194

@github-actions
Copy link

@github-actions github-actions bot commented on b135194 Dec 19, 2024

Choose a reason for hiding this comment

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

7251 tests run: 6941 passed, 1 failed, 309 skipped (full report)


Failures on Postgres 16

  • test_storage_controller_many_tenants[github-actions-selfhosted]: release-x86-64
# Run all failed tests locally:
scripts/pytest -vv -n $(nproc) -k "test_storage_controller_many_tenants[release-pg16-github-actions-selfhosted]"
Flaky tests (2)

Postgres 16

  • test_pgdata_import_smoke[None-1024-RelBlockSize.MULTIPLE_RELATION_SEGMENTS]: release-arm64

Postgres 15

  • test_pgdata_import_smoke[None-1024-RelBlockSize.MULTIPLE_RELATION_SEGMENTS]: release-arm64

Code coverage* (full report)

  • functions: 31.3% (8397 of 26870 functions)
  • lines: 48.0% (66642 of 138946 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
b135194 at 2024-12-19T16:00:05.264Z :recycle:

Please sign in to comment.