Skip to content

Remove protocol versions >5 from MAX_SUPPORTED #492

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
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mykaul
Copy link

@mykaul mykaul commented Jun 19, 2025

Without removing associated code yet, this patch just ensure we begin negotiating protocol version 5, then fallback to 4, reducing the amount of protocol errors that the Scylla server sends when it sees the unsupported versions.

Refs: #244

Perhaps we should add documentation to this?

Pre-review checklist

  • I have split my patch into logically separate commits.
  • All commit messages clearly explain what they change and why.
  • I added relevant tests for new features and bug fixes.
  • All commits compile, pass static checks and pass test.
  • PR description sums up the changes and reasons why they should be introduced.
  • I have provided docstrings for the public items that I want to introduce.
  • I have adjusted the documentation in ./docs/source/.
  • I added appropriate Fixes: annotations to PR description.

@mykaul mykaul requested a review from Copilot June 19, 2025 12:56
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the set of protocol versions used during negotiation to start at version 5 and fall back to 4, removing DSE-specific and Cassandra v6 protocols.

  • Trimmed SUPPORTED_VERSIONS to exclude versions above V5
  • Left associated negotiation logic and fallbacks intact for now
Comments suppressed due to low confidence (2)

cassandra/init.py:183

  • The docstring above SUPPORTED_VERSIONS still generically says "A tuple of all supported protocol versions"—consider updating it to note that versions > V5 have been removed.
    SUPPORTED_VERSIONS = (V5, V4, V3, V2, V1)

cassandra/init.py:183

  • Add or update unit tests to verify the negotiation logic begins at V5 and correctly falls back to V4, ensuring no unsupported versions are attempted.
    SUPPORTED_VERSIONS = (V5, V4, V3, V2, V1)

@mykaul mykaul force-pushed the max_supported_v5 branch 2 times, most recently from 11a07bc to 7042125 Compare June 19, 2025 14:29
@mykaul
Copy link
Author

mykaul commented Jun 19, 2025

Need to handle this failure:

=================================== FAILURES ===================================
  ________________ ConnectionTest.test_use_requested_compression _________________
  
  self = <tests.unit.test_connection.ConnectionTest testMethod=test_use_requested_compression>
  args = (), c = <Connection(139701745826928) 1.2.3.4:9042>
  options_buf = <_io.BytesIO object at 0x7f0ed8eb3c70>
  options = b'\x00\x02\x00\x0bCQL_VERSION\x00\x01\x00\x053.0.3\x00\x0bCOMPRESSION\x00\x02\x00\x06snappy\x00\x03lz4'
  
      def test_use_requested_compression(self, *args):
          c = self.make_connection()
          c._requests = {0: (c._handle_options_response, ProtocolHandler.decode_message, [])}
          c.defunct = Mock()
          # request snappy compression
          c.compression = "snappy"
      
          locally_supported_compressions.pop('lz4', None)
          locally_supported_compressions.pop('snappy', None)
          locally_supported_compressions['lz4'] = ('lz4compress', 'lz4decompress')
          locally_supported_compressions['snappy'] = ('snappycompress', 'snappydecompress')
      
          # the server only supports snappy
          options_buf = BytesIO()
          write_stringmultimap(options_buf, {
              'CQL_VERSION': ['3.0.3'],
              'COMPRESSION': ['snappy', 'lz4']
          })
          options = options_buf.getvalue()
      
          c.process_msg(_Frame(version=4, flags=0, stream=0, opcode=SupportedMessage.opcode, body_offset=9, end_pos=9 + len(options)), options)
      
  >       self.assertEqual(c.decompressor, locally_supported_compressions['snappy'][1])
  E       AssertionError: None != 'snappydecompress'
  
  /project/tests/unit/test_connection.py:216: AssertionError
  ------------------------------ Captured log call -------------------------------
  2025-06-19 14:32:29.361 DEBUG [protocol_features:62]: Parsing sharding info from message options {'COMPRESSION': ['snappy', 'lz4']}
  2025-06-19 14:32:29.361 DEBUG [connection:1352]: Received options response on new connection (139701745826928) from 1.2.3.4:9042
  2025-06-19 14:32:29.362 DEBUG [connection:1403]: Snappy compression is not supported with protocol version 5 and checksumming. Consider installing lz4. Disabling compression.
  2025-06-19 14:32:29.362 DEBUG [connection:1417]: Sending StartupMessage on <Connection(139701745826928) 1.2.3.4:9042>

Without removing associated code yet, this patch just ensure we begin
negotiating protocol version 5, then fallback to 4, reducing the amount of protocol errors
that the Scylla server sends when it sees the unsupported versions.

Refs: scylladb#244

Signed-off-by: Yaniv Kaul <[email protected]>
@mykaul mykaul force-pushed the max_supported_v5 branch from 7042125 to 087a93f Compare June 23, 2025 12:12
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.

1 participant