Skip to content

Commit a15b1f4

Browse files
committed
chore: move log messages and fix iam integration tests for multi-az environments
1 parent 34e7930 commit a15b1f4

3 files changed

Lines changed: 8 additions & 13 deletions

File tree

common/lib/utils/messages.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,9 @@ const MESSAGES: Record<string, string> = {
374374
"Blue/Green Deployment switchover is still in progress and a corresponding host for '%s' is not found after %s ms. Try to connect again later.",
375375
"Bgd.correspondingHostFoundContinueWithConnect":
376376
"A corresponding host for '%s' is found. Continue with connect call. The call was suspended for %s ms.",
377-
"Bgd.completedContinueWithConnect": "Blue/Green Deployment status is completed. Continue with 'connect' call. The call was suspended for %s ms."
377+
"Bgd.completedContinueWithConnect": "Blue/Green Deployment status is completed. Continue with 'connect' call. The call was suspended for %s ms.",
378+
"StorageService.itemClassNotRegistered": "StorageServiceImpl: Item class not registered: %s",
379+
"StorageService.unexpectedValueMismatch": "StorageServiceImpl: Unexpected value mismatch for %s: %s"
378380
};
379381

380382
export class Messages {

common/lib/utils/storage/storage_service.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
*/
1616

1717
import { Constructor, ItemDisposalFunc, ShouldDisposeFunc } from "../../types";
18-
import { logger } from "../../../logutils";
1918
import { ExpirationCache } from "./expiration_cache";
2019
import { Topology } from "../../host_list_provider/topology";
20+
import { AwsWrapperError } from "../errors";
21+
import { Messages } from "../messages";
2122

2223
const DEFAULT_CLEANUP_INTERVAL_NANOS = 5 * 60 * 1_000_000_000; // 5 minutes
2324

@@ -165,7 +166,7 @@ export class StorageServiceImpl implements StorageService {
165166
if (!cache) {
166167
const supplier = StorageServiceImpl.defaultCacheSuppliers.get(itemClass);
167168
if (!supplier) {
168-
throw new Error(`StorageServiceImpl: Item class not registered: ${itemClass.name}`);
169+
throw new AwsWrapperError(Messages.get("StorageService.itemClassNotRegistered", itemClass.name));
169170
}
170171
cache = supplier();
171172
this.caches.set(itemClass, cache);
@@ -174,18 +175,10 @@ export class StorageServiceImpl implements StorageService {
174175
try {
175176
cache.put(key, item);
176177
} catch (error) {
177-
throw new Error(`StorageServiceImpl: Unexpected value mismatch for ${itemClass.name}: ${error}`);
178+
throw new AwsWrapperError(Messages.get("StorageService.unexpectedValueMismatch", itemClass.name, String(error)));
178179
}
179180
}
180181

181-
getAll<V>(itemClass: Constructor<V>): ExpirationCache<unknown, unknown> | null {
182-
const cache = this.caches.get(itemClass);
183-
if (!cache) {
184-
return null;
185-
}
186-
return cache;
187-
}
188-
189182
get<V>(itemClass: Constructor<V>, key?: unknown): V | null {
190183
const cache = this.caches.get(itemClass);
191184
if (!cache) {
@@ -201,7 +194,6 @@ export class StorageServiceImpl implements StorageService {
201194
return value as V;
202195
}
203196

204-
logger.debug(`StorageServiceImpl: Item class mismatch for key ${String(key)}: ` + `expected ${itemClass.name}, got ${value.constructor.name}`);
205197
return null;
206198
}
207199

tests/integration/host/src/test/java/integration/host/util/AuroraTestUtility.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,6 +1117,7 @@ public void addAuroraAwsIamUser(
11171117
} else {
11181118
stmt.execute("GRANT ALL PRIVILEGES ON `%`.* TO '" + dbUser + "'@'%';");
11191119
}
1120+
stmt.execute("GRANT REPLICATION CLIENT ON *.* TO '" + dbUser + "'@'%';");
11201121

11211122
// BG switchover status needs it.
11221123
stmt.execute("GRANT SELECT ON mysql.* TO '" + dbUser + "'@'%';");

0 commit comments

Comments
 (0)