diff --git a/common/persistence/cassandra/history_store.go b/common/persistence/cassandra/history_store.go index 695f0e0bee43..a7ec87aa3294 100644 --- a/common/persistence/cassandra/history_store.go +++ b/common/persistence/cassandra/history_store.go @@ -285,20 +285,16 @@ func (h *HistoryStore) DeleteHistoryBranch( ctx context.Context, request *p.InternalDeleteHistoryBranchRequest, ) error { - branch, err := h.GetHistoryBranchUtil().ParseHistoryBranchInfo(request.BranchToken) - if err != nil { - return err - } batch := h.Session.NewBatch(gocql.LoggedBatch).WithContext(ctx) - batch.Query(v2templateDeleteBranch, branch.TreeId, branch.BranchId) + batch.Query(v2templateDeleteBranch, request.BranchInfo.TreeId, request.BranchInfo.BranchId) // delete each branch range for _, br := range request.BranchRanges { - h.deleteBranchRangeNodes(batch, branch.TreeId, br.BranchId, br.BeginNodeId) + h.deleteBranchRangeNodes(batch, request.BranchInfo.TreeId, br.BranchId, br.BeginNodeId) } - err = h.Session.ExecuteBatch(batch) + err := h.Session.ExecuteBatch(batch) if err != nil { return gocql.ConvertError("DeleteHistoryBranch", err) } diff --git a/common/persistence/history_manager.go b/common/persistence/history_manager.go index 9c17fd6389ba..f02a241318bd 100644 --- a/common/persistence/history_manager.go +++ b/common/persistence/history_manager.go @@ -122,7 +122,6 @@ func (m *executionManagerImpl) ForkHistoryBranch( } req := &InternalForkHistoryBranchRequest{ - BranchToken: request.ForkBranchToken, ForkBranchInfo: forkBranch, TreeInfo: treeInfoBlob, ForkNodeID: request.ForkNodeID, @@ -214,7 +213,7 @@ findDeleteRanges: } req := &InternalDeleteHistoryBranchRequest{ - BranchToken: request.BranchToken, + BranchInfo: branch, ShardID: request.ShardID, BranchRanges: deleteRanges, } diff --git a/common/persistence/persistenceInterface.go b/common/persistence/persistenceInterface.go index b915e16b0b50..d9f10259e7a1 100644 --- a/common/persistence/persistenceInterface.go +++ b/common/persistence/persistenceInterface.go @@ -507,8 +507,6 @@ type ( // InternalForkHistoryBranchRequest is used to fork a history branch InternalForkHistoryBranchRequest struct { - // The raw branch token - BranchToken []byte // The base branch to fork from ForkBranchInfo *persistencespb.HistoryBranch // Serialized TreeInfo @@ -539,8 +537,8 @@ type ( // InternalDeleteHistoryBranchRequest is used to remove a history branch InternalDeleteHistoryBranchRequest struct { - // The raw branch token - BranchToken []byte + // The branch + BranchInfo *persistencespb.HistoryBranch // Used in sharded data stores to identify which shard to use ShardID int32 // branch ranges is used to delete range of history nodes from target branch and it ancestors. diff --git a/common/persistence/sql/history_store.go b/common/persistence/sql/history_store.go index db8836051d7f..35e9ae78f3b6 100644 --- a/common/persistence/sql/history_store.go +++ b/common/persistence/sql/history_store.go @@ -350,16 +350,11 @@ func (m *sqlExecutionStore) DeleteHistoryBranch( ctx context.Context, request *p.InternalDeleteHistoryBranchRequest, ) error { - branch, err := m.GetHistoryBranchUtil().ParseHistoryBranchInfo(request.BranchToken) - if err != nil { - return err - } - - branchIDBytes, err := primitives.ParseUUID(branch.BranchId) + branchIDBytes, err := primitives.ParseUUID(request.BranchInfo.BranchId) if err != nil { return err } - treeIDBytes, err := primitives.ParseUUID(branch.TreeId) + treeIDBytes, err := primitives.ParseUUID(request.BranchInfo.TreeId) if err != nil { return err }