Skip to content

Conversation

@ribaraka
Copy link
Contributor

@ribaraka ribaraka commented Apr 18, 2025

Closes #357

The previous design allowed modifying Session properties through setters. This added unnecessary overhead, as a mutex had to be acquired for every query execution. Additionally, as demonstrated in #1473 this mutability could lead to race conditions. By making Session immutable, we:

  1. Eliminate race condition.
  2. Eliminate the performance overhead of mutex acquisition
  3. Simplify the concurrency model
  4. Making cleaner configuration

This PR removing those setters and eliminating the need for the mutex. Configuration of refactored properties (i.e. consistency, trace etc.) is now handled at session creation through ClusterConfig and/or at execution time through per-query methods.

Copy link
Contributor

@joao-r-reis joao-r-reis left a comment

Choose a reason for hiding this comment

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

Nice and simple 👍

@joao-r-reis
Copy link
Contributor

Hi can you fix the conflict on CHANGELOG.md and fix the commit message? I'll merge this afterwards

Patch by Stanislav Bychkov; reviewed by João Reis for CASSGO-23
@ribaraka
Copy link
Contributor Author

ribaraka commented May 6, 2025

@joao-r-reis, done

@joao-r-reis joao-r-reis merged commit b251492 into apache:trunk May 8, 2025
72 checks passed
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.

CASSGO-23 Make Session immutable

2 participants