Skip to content

CXXCBC-576: Ensure all HTTP sessions are stopped when closing the core cluster#648

Merged
avsej merged 1 commit intocouchbase:mainfrom
DemetrisChr:CXXCBC-568-col-close-2
Aug 27, 2024
Merged

CXXCBC-576: Ensure all HTTP sessions are stopped when closing the core cluster#648
avsej merged 1 commit intocouchbase:mainfrom
DemetrisChr:CXXCBC-568-col-close-2

Conversation

@DemetrisChr
Copy link
Copy Markdown
Contributor

Motivation

When cluster.close() is called, all in-progress HTTP operations should be cancelled.

Changes

  • Add pending_sessions_ in the HTTP session manager to ensure that it has a reference to sessions created by it at all stages of their lifetime. Pending operations are the sessions that are currently connecting (i.e. after they have been removed from idle_sessions_ or created and before being added to busy_sessions_)
  • Fix issue where the callback was not called in the case of a timeout (dispatch timeout or overall timeout) while a session is connecting.
  • In an HTTP session that is connecting, call the connect callback if it is stopped before it has connected.
  • Add the couchbase::core::columnar::client_errc error codes to represent errors that are not the result of a client-server interaction. These are the errors that should be exposed in a platform-idiomatic way in the wrappers, not as
    ColumnarErrors - one example is cancellation which happens on the client-side.
  • In pending_query_operation replace the use of columnar::errc::generic for cancellations with the new columnar::client_errc::canceled
  • When http_session_manager.close() is called, force all the sessions owned by the manager to stop, not just discarding the pointers.
  • Fix seg fault when accessing retry_info_ for a pending_query_operation where the session wrapped by it is nullptr (e.g. in the case of a dispatch timeout)
  • Add tests for closing the cluster before columnar execute_query has returned & for closing the cluster while rows are being iterated
  • Add test for the dispatch timeout with a columnar query

Results

All tests pass

Copy link
Copy Markdown
Contributor

@thejcfactor thejcfactor left a comment

Choose a reason for hiding this comment

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

I intend to play w/ this change a bit more in the Python Columnar client, but I think all looks well. I just had a couple of comments.

Comment thread core/columnar/error_codes.cxx Outdated
Comment thread core/columnar/query_component.cxx
Comment thread test/test_integration_columnar_query.cxx Outdated
@DemetrisChr DemetrisChr force-pushed the CXXCBC-568-col-close-2 branch from a7aa79a to 19267fd Compare August 27, 2024 13:03
@DemetrisChr DemetrisChr force-pushed the CXXCBC-568-col-close-2 branch from 19267fd to b250f97 Compare August 27, 2024 13:06
Copy link
Copy Markdown
Contributor

@thejcfactor thejcfactor left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Did further testing w/ the Python Columnar client. Thanks for making these changes!

@avsej avsej merged commit 9c445ae into couchbase:main Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants