Skip to content

Commit b2275f5

Browse files
author
Yingjian Wu
committed
improve rename logic to use 2 phase commit idea
1 parent e9fce8d commit b2275f5

File tree

6 files changed

+605
-112
lines changed

6 files changed

+605
-112
lines changed

metacat-common-server/src/main/java/com/netflix/metacat/common/server/usermetadata/ParentChildRelMetadataService.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import com.netflix.metacat.common.dto.notifications.ChildInfoDto;
44
import com.netflix.metacat.common.server.model.ChildInfo;
55
import com.netflix.metacat.common.server.model.ParentInfo;
6+
import org.apache.commons.lang3.tuple.Pair;
7+
import java.util.Optional;
68

79
import java.util.Set;
810

@@ -60,8 +62,11 @@ void deleteParentChildRelation(
6062
*
6163
* @param oldName the current name to be renamed
6264
* @param newName the new name to rename to
65+
* @return return a pair of set,
66+
* where the first set represents the affected parent_uuid with name = oldName
67+
* and the second set represents the affected child_uuid with name = oldName
6368
*/
64-
void rename(
69+
Pair<Set<String>, Set<String>> rename(
6570
QualifiedName oldName,
6671
QualifiedName newName
6772
);
@@ -71,10 +76,13 @@ void rename(
7176
* This involves two steps:
7277
* 1. drop all records where the child column = `name`
7378
* 2. drop all records where the parent column = `name`
79+
* * Note if uuids are specified, it is going to drop the table with that name with the corresponding uuids
7480
* @param name the name of the entity to drop
81+
* @param uuids the uuids to drop, where the first pair is the parent uuid and second pair is the child uuid
7582
*/
7683
void drop(
77-
QualifiedName name
84+
QualifiedName name,
85+
Optional<Pair<Set<String>, Set<String>>> uuids
7886
);
7987

8088
/**

0 commit comments

Comments
 (0)