Skip to content
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

feat: session state transfer #51

Merged
merged 1 commit into from
May 24, 2024
Merged

feat: session state transfer #51

merged 1 commit into from
May 24, 2024

Conversation

crystall-bitquill
Copy link
Contributor

Summary

Description

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@@ -106,7 +106,7 @@ export class DriverConnectionProvider implements ConnectionProvider {
getHostInfoByStrategy(hosts: HostInfo[], role: HostRole, strategy: string, props?: Map<string, any>): HostInfo {
const acceptedStrategy = DriverConnectionProvider.acceptedStrategies.get(strategy);
if (!acceptedStrategy) {
throw new AwsWrapperError(Messages.get("ConnectionProvider.unsupportedHostSpecSelectorStrategy", strategy, "DriverConnectionProvider")); // TODO
throw new AwsWrapperError(Messages.get("ConnectionProvider.unsupportedHostSpecSelectorStrategy", strategy, "DriverConnectionProvider"));
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
throw new AwsWrapperError(Messages.get("ConnectionProvider.unsupportedHostSpecSelectorStrategy", strategy, "DriverConnectionProvider"));
throw new AwsWrapperError(Messages.get("ConnectionProvider.unsupportedHostInfoSelectorStrategy", strategy, "DriverConnectionProvider"));

const changes = new Set<HostChangeOptions>([HostChangeOptions.INITIAL_CONNECTION]);

if (this.pluginServiceManagerContainer.pluginManager) {
// this.pluginServiceManagerContainer.pluginManager.notifyConnectionChanged(changes, null);
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe add comment:
// TODO: uncomment once notifyConnectionChanged is implemented.

@@ -61,5 +61,7 @@
"AuroraStaleDnsHelper.clusterEndpointDns": "Cluster endpoint resolves to '%s'.",
"AuroraStaleDnsHelper.writerHostSpec": "Writer host: '%s'.",
"AuroraStaleDnsHelper.writerInetAddress": "Writer host address: '%s'",
"AuroraStaleDnsHelper.staleDnsDetected": "Stale DNS data detected. Opening a connection to '%s'."
"AuroraStaleDnsHelper.staleDnsDetected": "Stale DNS data detected. Opening a connection to '%s'.",
"MethodNotSupported": "Method not supported.",
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
"MethodNotSupported": "Method not supported.",
"Client.MethodNotSupported": "Method not supported.",

should we also specify which method is not supported since this is used for a few different methods

"AuroraStaleDnsHelper.staleDnsDetected": "Stale DNS data detected. Opening a connection to '%s'."
"AuroraStaleDnsHelper.staleDnsDetected": "Stale DNS data detected. Opening a connection to '%s'.",
"MethodNotSupported": "Method not supported.",
"InvalidTransactionIsolationLevel": "An invalid transaction isolation level was provided."
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
"InvalidTransactionIsolationLevel": "An invalid transaction isolation level was provided."
"Client.InvalidTransactionIsolationLevel": "An invalid transaction isolation level was provided."

nit: should we specify the isolation level provided in the error message?

Copy link
Contributor

@joyc-bq joyc-bq left a comment

Choose a reason for hiding this comment

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

approved with a couple comments

this.sessionState.autoCommit.pristineValue = this.pluginService.getCurrentClient().getAutoCommit();
}

this.logCurrentState();
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to log the current states when updating pristine values? The log message doesn't actually output any information about the pristine states.

try {
await newClient.setReadOnly(this.sessionState.readOnly.value);
} catch (error: any) {
if (error instanceof Error && error.message.includes("Method not supported")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this condition checking a custom error that we implemented? If so can we catch for a more specific class instead of the generic Error?

export class UnsupportedMethod extends AwsWrapperError {

Then

if (error instanceof UnsupportedMethod)

@crystall-bitquill crystall-bitquill force-pushed the session-state branch 4 times, most recently from f09095c to 079d581 Compare May 23, 2024 02:16
Comment on lines 69 to 70
"Client.MethodNotSupported": "Method not supported.",
"Client.InvalidTransactionIsolationLevel": "An invalid transaction isolation level was provided: '%s'."
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
"Client.MethodNotSupported": "Method not supported.",
"Client.InvalidTransactionIsolationLevel": "An invalid transaction isolation level was provided: '%s'."
"Client.methodNotSupported": "Method not supported.",
"Client.invalidTransactionIsolationLevel": "An invalid transaction isolation level was provided: '%s'."

Copy link
Contributor

Choose a reason for hiding this comment

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

will also need to update where these messages are used

@crystall-bitquill crystall-bitquill merged commit e22b5dd into main May 24, 2024
2 checks passed
@crystall-bitquill crystall-bitquill deleted the session-state branch May 24, 2024 03:53
jasonlamz pushed a commit that referenced this pull request May 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