-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
d585659
to
a6183c6
Compare
@@ -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")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw new AwsWrapperError(Messages.get("ConnectionProvider.unsupportedHostSpecSelectorStrategy", strategy, "DriverConnectionProvider")); | |
throw new AwsWrapperError(Messages.get("ConnectionProvider.unsupportedHostInfoSelectorStrategy", strategy, "DriverConnectionProvider")); |
common/lib/plugin_service.ts
Outdated
const changes = new Set<HostChangeOptions>([HostChangeOptions.INITIAL_CONNECTION]); | ||
|
||
if (this.pluginServiceManagerContainer.pluginManager) { | ||
// this.pluginServiceManagerContainer.pluginManager.notifyConnectionChanged(changes, null); |
There was a problem hiding this comment.
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.
common/lib/utils/locales/en.json
Outdated
@@ -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.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"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
common/lib/utils/locales/en.json
Outdated
"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." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"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?
There was a problem hiding this 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
a6183c6
to
c12c2cd
Compare
this.sessionState.autoCommit.pristineValue = this.pluginService.getCurrentClient().getAutoCommit(); | ||
} | ||
|
||
this.logCurrentState(); |
There was a problem hiding this comment.
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")) { |
There was a problem hiding this comment.
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)
f09095c
to
079d581
Compare
common/lib/utils/locales/en.json
Outdated
"Client.MethodNotSupported": "Method not supported.", | ||
"Client.InvalidTransactionIsolationLevel": "An invalid transaction isolation level was provided: '%s'." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"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'." |
There was a problem hiding this comment.
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
079d581
to
a6e648e
Compare
a6e648e
to
30e2816
Compare
Summary
Description
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.