Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
joyc-bq committed Dec 20, 2024
1 parent a9aa784 commit 7890f8f
Show file tree
Hide file tree
Showing 9 changed files with 205 additions and 215 deletions.
3 changes: 1 addition & 2 deletions common/lib/host_list_provider/rds_host_list_provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ export class RdsHostListProvider implements DynamicHostListProvider {
}

if (client) {
const val = await dialect.getHostRole(client);
return val;
return await dialect.getHostRole(client);
} else {
throw new AwsWrapperError(Messages.get("AwsClient targetClient not defined."));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export class AuroraConnectionTrackerPlugin extends AbstractConnectionPlugin impl
isInitialConnection: boolean,
connectFunc: () => Promise<ClientWrapper>
): Promise<ClientWrapper> {

return this.connectInternal(hostInfo, connectFunc);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ export class OpenedConnectionTracker {
}
}
console.log(`Opened Connections Tracked: \n\t${str}`);
console.log(logTopology(this.pluginService.getHosts(), "logging connections topology : "));
}

private logConnectionQueue(host: string, queue: Array<WeakRef<ClientWrapper>>): void {
Expand Down
6 changes: 2 additions & 4 deletions common/lib/plugins/failover/failover_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export class FailoverPlugin extends AbstractConnectionPlugin {
}

// Log changes
if (logger.level === "silly") {
if (logger.level === "debug") {
let str = "Changes:";
for (const [key, values] of changes.entries()) {
str = str.concat("\n");
Expand All @@ -189,7 +189,6 @@ export class FailoverPlugin extends AbstractConnectionPlugin {
if (currentHost) {
const url = currentHost.url;
if (this.isHostStillValid(url, changes)) {
console.log("url still valid: " + url);
return Promise.resolve();
}

Expand Down Expand Up @@ -440,7 +439,7 @@ export class FailoverPlugin extends AbstractConnectionPlugin {

await this.pluginService.abortCurrentClient();
await this.pluginService.setCurrentClient(result.client, writerHostInfo);
console.log(Messages.get("Failover.establishedConnection", this.pluginService.getCurrentHostInfo()?.host ?? ""));
logger.debug(Messages.get("Failover.establishedConnection", this.pluginService.getCurrentHostInfo()?.host ?? ""));
await this.pluginService.refreshHostList();
this.failoverWriterSuccessCounter.inc();
} catch (error: any) {
Expand Down Expand Up @@ -547,7 +546,6 @@ export class FailoverPlugin extends AbstractConnectionPlugin {
}

private canDirectExecute(methodName: string): boolean {
console.log("methodNamedirect " + methodName);
return methodName === FailoverPlugin.METHOD_END;
}

Expand Down
5 changes: 1 addition & 4 deletions common/lib/plugins/failover/writer_failover_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ import { ClusterAwareReaderFailoverHandler } from "./reader_failover_handler";
import { PluginService } from "../../plugin_service";
import { HostAvailability } from "../../host_availability/host_availability";
import { AwsWrapperError } from "../../utils/errors";
import { getWriter, logTopology, maskProperties, sleep } from "../../utils/utils";
import { getWriter, logTopology, maskProperties } from "../../utils/utils";
import { ReaderFailoverResult } from "./reader_failover_result";
import { Messages } from "../../utils/messages";
import { logger } from "../../../logutils";
import { WrapperProperties } from "../../wrapper_property";
import { ClientWrapper } from "../../client_wrapper";
import { FailoverRestriction } from "./failover_restriction";
import { HostRole } from "../../host_role";

export interface WriterFailoverHandler {
failover(currentTopology: HostInfo[]): Promise<WriterFailoverResult>;
Expand Down Expand Up @@ -269,7 +268,6 @@ class ReconnectToWriterHandlerTask {
} finally {
if (this.currentClient && (this.failoverCompletedDueToError || !success)) {
await this.pluginService.abortTargetClient(this.currentClient);

}
logger.info(Messages.get("ClusterAwareWriterFailoverHandler.taskAFinished"));
}
Expand All @@ -283,7 +281,6 @@ class ReconnectToWriterHandlerTask {
// Task B was returned.
if (selectedTask && selectedTask === ClusterAwareWriterFailoverHandler.WAIT_NEW_WRITER_TASK) {
await this.pluginService.abortTargetClient(this.currentClient);

}
}
}
Expand Down
396 changes: 198 additions & 198 deletions common/lib/utils/locales/en.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion pg/lib/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ export class AwsPGClient extends AwsClient {
}

async end() {
console.log(logTopology(this.pluginService.getHosts(), "calling end topology : "));
if (!this.isConnected || !this.targetClient) {
// No connections have been initialized.
// This might happen if end is called in a finally block when an error occurred while initializing the first connection.
Expand Down
3 changes: 1 addition & 2 deletions pg/lib/dialect/aurora_pg_database_dialect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ export class AuroraPgDatabaseDialect extends PgDatabaseDialect implements Topolo
async getHostRole(targetClient: ClientWrapper): Promise<HostRole> {
const res = await targetClient.query(AuroraPgDatabaseDialect.IS_READER_QUERY);
console.log("gethostrole: " + res.rows[0]["is_reader"]);
const val = res.rows[0]["is_reader"] === true ? HostRole.READER : HostRole.WRITER;
return Promise.resolve(val)
return Promise.resolve(res.rows[0]["is_reader"] === true ? HostRole.READER : HostRole.WRITER);
}

async isDialect(targetClient: ClientWrapper): Promise<boolean> {
Expand Down
4 changes: 2 additions & 2 deletions tests/plugin_manager_benchmarks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ suite(
}),

add("initHostProviderWith10Plugins", async () => {
const pluginManagerWithPlugins = await initPluginManagerWithPlugins(10, instance(mockPluginService), propsWithPlugins);;
const pluginManagerWithPlugins = await initPluginManagerWithPlugins(10, instance(mockPluginService), propsWithPlugins);
return async () =>
await pluginManagerWithPlugins.initHostProvider(
new HostInfoBuilder({ hostAvailabilityStrategy: new SimpleHostAvailabilityStrategy() }).withHost("host").build(),
Expand Down Expand Up @@ -325,7 +325,7 @@ suite(
}),

add("notifyConnectionChangedWith10Plugins", async () => {
const pluginManagerWithPlugins = await initPluginManagerWithPlugins(10, instance(mockPluginService), propsWithPlugins);;
const pluginManagerWithPlugins = await initPluginManagerWithPlugins(10, instance(mockPluginService), propsWithPlugins);
return async () =>
await pluginManagerWithPlugins.notifyConnectionChanged(new Set<HostChangeOptions>([HostChangeOptions.INITIAL_CONNECTION]), null);
}),
Expand Down

0 comments on commit 7890f8f

Please sign in to comment.