Skip to content

Commit

Permalink
improve rename logic to use 2 phase commit idea
Browse files Browse the repository at this point in the history
  • Loading branch information
Yingjian Wu committed Jul 4, 2024
1 parent e9fce8d commit b2275f5
Show file tree
Hide file tree
Showing 6 changed files with 605 additions and 112 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import com.netflix.metacat.common.dto.notifications.ChildInfoDto;
import com.netflix.metacat.common.server.model.ChildInfo;
import com.netflix.metacat.common.server.model.ParentInfo;
import org.apache.commons.lang3.tuple.Pair;
import java.util.Optional;

import java.util.Set;

Expand Down Expand Up @@ -60,8 +62,11 @@ void deleteParentChildRelation(
*
* @param oldName the current name to be renamed
* @param newName the new name to rename to
* @return return a pair of set,
* where the first set represents the affected parent_uuid with name = oldName
* and the second set represents the affected child_uuid with name = oldName
*/
void rename(
Pair<Set<String>, Set<String>> rename(
QualifiedName oldName,
QualifiedName newName
);
Expand All @@ -71,10 +76,13 @@ void rename(
* This involves two steps:
* 1. drop all records where the child column = `name`
* 2. drop all records where the parent column = `name`
* * Note if uuids are specified, it is going to drop the table with that name with the corresponding uuids
* @param name the name of the entity to drop
* @param uuids the uuids to drop, where the first pair is the parent uuid and second pair is the child uuid
*/
void drop(
QualifiedName name
QualifiedName name,
Optional<Pair<Set<String>, Set<String>>> uuids
);

/**
Expand Down
Loading

0 comments on commit b2275f5

Please sign in to comment.