Skip to content

Comments

SSL enablement for Cassandra Connector#23507

Merged
tdcmeehan merged 1 commit intoprestodb:masterfrom
lithinwxd:master
Sep 5, 2024
Merged

SSL enablement for Cassandra Connector#23507
tdcmeehan merged 1 commit intoprestodb:masterfrom
lithinwxd:master

Conversation

@lithinwxd
Copy link
Contributor

@lithinwxd lithinwxd commented Aug 23, 2024

Description

Cassandra Version Upgrade for enabling SSL

Motivation and Context

Presto uses presto cassandra driver (shaded version of datastax driver ) for connections . While non ssl operations work fine , the same does not hold good for SSL functionalities.

While we try to connect to an SSL instance , we get the below error

com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /52.116.130.195:9042 (com.datastax.driver.core.exceptions.OperationTimedOutException: [/52.116.130.195:9042] Operation timed out))

Presto uses 3.6.0 version of DataStax driver which does not support SSL. Version 3.11.2 or higher version of DataStax driver supports SSL.

#23506

Impact

SSL will be enabled and connections can be secured.

Test Plan

Tested Locally end to end

Contributor checklist

  • Please make sure your submission complies with our development, formatting, commit message, and attribution guidelines.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== RELEASE NOTES ==

Cassandra Connector Changes

  • Upgrade cassandra-driver-core to 3.11.5 for SSL support :pr:23493

@lithinwxd lithinwxd marked this pull request as ready for review August 23, 2024 12:09
@lithinwxd lithinwxd requested a review from a team as a code owner August 23, 2024 12:09
@lithinwxd lithinwxd requested a review from presto-oss August 23, 2024 12:09
session.execute("CREATE TABLE keyspace_4.\"TaBlE_4\" (column_4 bigint PRIMARY KEY)");
session.execute("CREATE TABLE keyspace_4.\"tAbLe_4\" (column_4 bigint PRIMARY KEY)");

Thread.sleep(5000);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need the sleep?

Copy link
Contributor Author

@lithinwxd lithinwxd Aug 29, 2024

Choose a reason for hiding this comment

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

The sleep is needed for cassandra to refresh its metadata . i have reduced it to 1000ms in the recent commit

Copy link
Contributor

Choose a reason for hiding this comment

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

What metadata is being refreshed asynchronously? Can you help me explain why the changes in this PR require this new sleep?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without this delay, the test might run into race conditions where it tries to access or query the newly created schema elements before they are fully registered in the system, leading to test failures.The driver now performs more rigorous checks to ensure schema agreement across nodes before refreshing the metadata. This could introduce a delay, especially if schema changes are not immediately visible across the cluster, potentially causing issues like the one we are facing where the test fails if you don't include a Thread.sleep. The driver waits for all nodes to agree on the schema before completing the operation, which wasn't as strictly enforced in earlier versions.

Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't the assertContainsEventually call immediately after this sleep handle this race condition?

Copy link
Contributor Author

@lithinwxd lithinwxd Aug 30, 2024

Choose a reason for hiding this comment

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

No , without the Thread.sleep its failing and after adding the sleep it passes . The sleep was added for the testcase to pass and I checked by printing the values and after adding sleep I was able to retrieve values before which it was empty.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK. Please add a comment explaining why we need the sleep.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tdcmeehan I have added the comment . Thanks


@Test
public void testTableNameAmbiguity()
throws InterruptedException
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
throws InterruptedException
throws Exception

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

.row("table_4")
.row("table_4")
.build(), new Duration(1, MINUTES));
.build(), new Duration(2, MINUTES));
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this being bumped up?

Copy link
Contributor Author

@lithinwxd lithinwxd Aug 29, 2024

Choose a reason for hiding this comment

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

okay this is not required , I shall revert back as 1000ms would do the refreshing

<dependency>
<groupId>com.facebook.presto.cassandra</groupId>
<artifactId>cassandra-driver</artifactId>
<groupId>com.datastax.cassandra</groupId>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you put this in the dependency management section of the parent pom?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

</dependency>
</dependencies>

<dependencyManagement>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment explaining why this is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is to fix the upper bound issues arising out of different components

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you leave a comment in the code to that effect?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah sure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added the comment

@tdcmeehan tdcmeehan self-assigned this Aug 26, 2024
@steveburnett
Copy link
Contributor

Nit formatting suggestion for the release note entry

== RELEASE NOTES ==

Cassandra Connector Changes
* Upgrade cassandra-driver-core to 3.11.5 for SSL support :pr:`23493`

@lithinwxd
Copy link
Contributor Author

Nit formatting suggestion for the release note entry

== RELEASE NOTES ==

Cassandra Connector Changes
* Upgrade cassandra-driver-core to 3.11.5 for SSL support :pr:`23493`

done

@tdcmeehan
Copy link
Contributor

Please squash commits

@lithinwxd
Copy link
Contributor Author

Please squash commits

done

@tdcmeehan tdcmeehan merged commit eb7ef88 into prestodb:master Sep 5, 2024
@jaystarshot jaystarshot mentioned this pull request Nov 1, 2024
25 tasks
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