Skip to content

Commit 81930fe

Browse files
committed
chore: monitor service
1 parent f935aba commit 81930fe

42 files changed

Lines changed: 1676 additions & 604 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/integration_tests.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
push:
66
branches:
77
- main
8+
- refactor/monitor-service
89
paths-ignore:
910
- "**/*.md"
1011
- "**/*.jpg"
@@ -29,7 +30,7 @@ jobs:
2930
strategy:
3031
fail-fast: false
3132
matrix:
32-
dbEngine: ["aurora-mysql", "aurora-postgres", "multi-az-mysql"]
33+
dbEngine: ["aurora-mysql", "aurora-postgres"]
3334

3435
steps:
3536
- name: Clone repository
@@ -64,7 +65,7 @@ jobs:
6465
AWS_ACCESS_KEY_ID: ${{ steps.creds.outputs.aws-access-key-id }}
6566
AWS_SECRET_ACCESS_KEY: ${{ steps.creds.outputs.aws-secret-access-key }}
6667
AWS_SESSION_TOKEN: ${{ steps.creds.outputs.aws-session-token }}
67-
AURORA_MYSQL_DB_ENGINE_VERSION: ${{ matrix.dbEngine }}
68+
AURORA_MYSQL_DB_ENGINE_VERSION: default
6869
AURORA_PG_DB_ENGINE_VERSION: default
6970

7071
- name: "Get Github Action IP"
@@ -131,7 +132,7 @@ jobs:
131132
AWS_ACCESS_KEY_ID: ${{ steps.creds.outputs.aws-access-key-id }}
132133
AWS_SECRET_ACCESS_KEY: ${{ steps.creds.outputs.aws-secret-access-key }}
133134
AWS_SESSION_TOKEN: ${{ steps.creds.outputs.aws-session-token }}
134-
AURORA_MYSQL_DB_ENGINE_VERSION: ${{ matrix.dbEngine }}
135+
AURORA_MYSQL_DB_ENGINE_VERSION: latest
135136
AURORA_PG_DB_ENGINE_VERSION: latest
136137

137138
- name: "Get Github Action IP"

common/lib/aws_client.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,12 @@ export abstract class AwsClient extends EventEmitter implements SessionStateClie
139139
await this.setup();
140140
const hostListProvider: HostListProvider = this.pluginService
141141
.getDialect()
142-
.getHostListProvider(this.properties, this.properties.get("host"), <HostListProviderService>(<unknown>this.pluginService));
142+
.getHostListProvider(this.properties, this.properties.get("host"), this.fullServiceContainer);
143143
this.pluginService.setHostListProvider(hostListProvider);
144144
await this.pluginService.refreshHostList();
145145
const initialHostInfo = this.pluginService.getInitialConnectionHostInfo();
146146
if (initialHostInfo != null) {
147-
await this.pluginManager.initHostProvider(initialHostInfo, this.properties, <HostListProviderService>(<unknown>this.pluginService));
147+
await this.pluginManager.initHostProvider(initialHostInfo, this.properties, this.fullServiceContainer.getHostListProviderService());
148148
await this.pluginService.refreshHostList();
149149
}
150150
}
@@ -176,15 +176,15 @@ export abstract class AwsClient extends EventEmitter implements SessionStateClie
176176

177177
abstract setTransactionIsolation(level: TransactionIsolationLevel): Promise<any | void>;
178178

179-
abstract getTransactionIsolation(): TransactionIsolationLevel;
179+
abstract getTransactionIsolation(): TransactionIsolationLevel | undefined;
180180

181181
abstract setSchema(schema: any): Promise<any | void>;
182182

183-
abstract getSchema(): string;
183+
abstract getSchema(): string | undefined;
184184

185185
abstract setCatalog(catalog: string): Promise<any | void>;
186186

187-
abstract getCatalog(): string;
187+
abstract getCatalog(): string | undefined;
188188

189189
abstract end(): Promise<any>;
190190

common/lib/database_dialect/database_dialect.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { FailoverRestriction } from "../plugins/failover/failover_restriction";
2121
import { ErrorHandler } from "../error_handler";
2222
import { TransactionIsolationLevel } from "../utils/transaction_isolation_level";
2323
import { HostRole } from "../host_role";
24+
import { FullServicesContainer } from "../utils/full_services_container";
2425

2526
export enum DatabaseType {
2627
MYSQL,
@@ -41,7 +42,7 @@ export interface DatabaseDialect {
4142
getErrorHandler(): ErrorHandler;
4243
getHostRole(targetClient: ClientWrapper): Promise<HostRole>;
4344
isDialect(targetClient: ClientWrapper): Promise<boolean>;
44-
getHostListProvider(props: Map<string, any>, originalUrl: string, hostListProviderService: HostListProviderService): HostListProvider;
45+
getHostListProvider(props: Map<string, any>, originalUrl: string, servicesContainer: FullServicesContainer): HostListProvider;
4546
isClientValid(targetClient: ClientWrapper): Promise<boolean>;
4647
getDatabaseType(): DatabaseType;
4748
getDialectName(): string;

common/lib/host_list_provider/connection_string_host_list_provider.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,12 @@ export class ConnectionStringHostListProvider implements StaticHostListProvider
6565
this.isInitialized = true;
6666
}
6767

68-
refresh(): Promise<HostInfo[]>;
69-
refresh(client: ClientWrapper): Promise<HostInfo[]>;
70-
refresh(client?: ClientWrapper): Promise<HostInfo[]>;
71-
refresh(client?: ClientWrapper | undefined): Promise<HostInfo[]> {
68+
refresh(): Promise<HostInfo[]> {
7269
this.init();
7370
return Promise.resolve(this.hostList);
7471
}
7572

76-
forceRefresh(): Promise<HostInfo[]>;
77-
forceRefresh(client: ClientWrapper): Promise<HostInfo[]>;
78-
forceRefresh(client?: ClientWrapper): Promise<HostInfo[]> {
73+
forceRefresh(): Promise<HostInfo[]> {
7974
this.init();
8075
return Promise.resolve(this.hostList);
8176
}
@@ -89,7 +84,7 @@ export class ConnectionStringHostListProvider implements StaticHostListProvider
8984
return null;
9085
}
9186
const instance = await this.hostListProviderService.getDialect().getHostAliasAndParseResults(client.client);
92-
const topology = await this.refresh(client.client);
87+
const topology = await this.refresh();
9388
if (!topology || topology.length == 0) {
9489
return null;
9590
}

common/lib/host_list_provider/host_list_provider.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,12 @@ export type DynamicHostListProvider = HostListProvider;
2323

2424
export type StaticHostListProvider = HostListProvider;
2525

26-
export interface BlockingHostListProvider extends HostListProvider {
27-
forceMonitoringRefresh(shouldVerifyWriter: boolean, timeoutMs: number): Promise<HostInfo[]>;
28-
29-
clearAll(): Promise<void>;
30-
}
31-
3226
export interface HostListProvider {
3327
refresh(): Promise<HostInfo[]>;
3428

35-
refresh(client: ClientWrapper): Promise<HostInfo[]>;
36-
3729
forceRefresh(): Promise<HostInfo[]>;
3830

39-
forceRefresh(client: ClientWrapper): Promise<HostInfo[]>;
31+
forceMonitoringRefresh(shouldVerifyWriter: boolean, timeoutMs: number): Promise<HostInfo[]>;
4032

4133
getHostRole(client: ClientWrapper, dialect: DatabaseDialect): Promise<HostRole>;
4234

0 commit comments

Comments
 (0)