From 15f652a5751c4ec07f769c9e1348b2765544cf25 Mon Sep 17 00:00:00 2001 From: Yingjian Wu Date: Sat, 1 Jun 2024 23:33:58 -0700 Subject: [PATCH] fixTest --- .../MySqlParentChildRelMetaDataService.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/metacat-metadata-mysql/src/main/java/com/netflix/metacat/metadata/mysql/MySqlParentChildRelMetaDataService.java b/metacat-metadata-mysql/src/main/java/com/netflix/metacat/metadata/mysql/MySqlParentChildRelMetaDataService.java index 951cdb313..7a8667eab 100644 --- a/metacat-metadata-mysql/src/main/java/com/netflix/metacat/metadata/mysql/MySqlParentChildRelMetaDataService.java +++ b/metacat-metadata-mysql/src/main/java/com/netflix/metacat/metadata/mysql/MySqlParentChildRelMetaDataService.java @@ -100,22 +100,26 @@ public void createParentChildRelation(final QualifiedName parentName, @Override public void rename(final QualifiedName oldName, final QualifiedName newName) { try { - retryTemplate.execute((RetryCallback) context -> { - jdbcTemplate.update(connection -> { + // Retry for renaming the Parent Entity + retryTemplate.execute((RetryCallback) context -> { + return jdbcTemplate.update(connection -> { // Rename Parent Entity final PreparedStatement renameParentPS = connection.prepareStatement(SQL_RENAME_PARENT_ENTITY); renameParentPS.setString(1, newName.toString()); renameParentPS.setString(2, oldName.toString()); - renameParentPS.executeUpdate(); + return renameParentPS; + }); + }); + // Retry for renaming the Child Entity + retryTemplate.execute((RetryCallback) context -> { + return jdbcTemplate.update(connection -> { // Rename Child Entity final PreparedStatement renameChildPS = connection.prepareStatement(SQL_RENAME_CHILD_ENTITY); renameChildPS.setString(1, newName.toString()); renameChildPS.setString(2, oldName.toString()); - renameChildPS.executeUpdate(); - return null; + return renameChildPS; }); - return null; }); } catch (RuntimeException e) { log.error("Failed to rename entity", e);