)
switch err.(type) {
case *p.ConditionFailedError:
return true
return false
}
}
Frontier kind: Code frontier
unlabeled · c_6d847bb38e32
7 tests · 5032 LOC · 183 files · introduces 0 tests · 212 LOC · 3 files
The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.
Introduced files, introduced tests, and structurally relevant concept specialization
In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.
Graph controls are ready.
Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.
Every exact file and test below is linked only from the concept that introduces it.
go.temporal.io/server/common/persistence/client/TestQuotasSuite/TestAPITypeCallOriginPriorityOverrideMappinggo.temporal.io/server/common/persistence/client/TestQuotasSuite/TestBackgroundTypeAPIPriorityOverrideMappinggo.temporal.io/server/common/persistence/client/TestQuotasSuite/TestCallerTypeDefaultPriorityMappinggo.temporal.io/server/common/persistence/client/TestQuotasSuite/TestRequestPrioritiesOrderedgo.temporal.io/server/common/rpc/interceptor/TestMethodToPatternMappinggo.temporal.io/server/common/rpc/interceptor/TestNamespaceSuite/TestFrontendAPIMetricsgo.temporal.io/server/common/rpc/interceptor/TestNamespaceSuite/TestHistoryAPIMetricsgo.temporal.io/server/common/rpc/interceptor/TestNamespaceSuite/TestMatchingAPIMetricsgo.temporal.io/server/common/circuitbreaker/TestTSCBWithDynamicSettingsgo.temporal.io/server/common/dynamicconfig/TestDeepCopy_OtherReferenceTypes_Nilgo.temporal.io/server/service/matching/configs/TestQuotasSuite/TestAPIPrioritiesOrderedgo.temporal.io/server/service/matching/configs/TestQuotasSuite/TestAPIToPriorityMappingEvery collected test enters the hierarchy at exactly one concept.
No tests are introduced at this concept. Its intent tests are introduced by other concepts.
Every collected source range enters the hierarchy at exactly one concept.
3 files ranked by introduced lines: 212 introduced LOC across 16 ranges. Expand a file to inspect source; the > gutter marks introduced lines.
)
switch err.(type) {
case *p.ConditionFailedError:
return true
return false
}
}
// TestConcurrentlyForkAndAppendBranches test
func (s *HistoryV2PersistenceSuite) TestConcurrentlyForkAndAppendBranches() {
history_v2_persistence.go
treeID := uuid.NewString()
wg := sync.WaitGroup{}
concurrency := 10
masterBr, err := s.newHistoryBranch(treeID)
s.Nil(err)
branches := s.descTree(treeID)
s.Equal(0, len(branches))
// append first batch to master branch
eids := []int64{}
for i := int64(1); i <= int64(concurrency)+1; i++ {
eids = append(eids, i)
}
events := s.genRandomEvents(eids, 1)
err = s.appendNewBranchAndFirstNode(masterBr, events[0:1], 1, "masterbr")
s.Nil(err)
readEvents := s.read(masterBr, 1, int64(concurrency)+2)
s.Nil(err)
s.Equal(1, len(readEvents))
branches = s.descTree(treeID)
s.Equal(1, len(branches))
mbrID := branches[0].BranchId
txn := int64(1)
getTxnLock := sync.Mutex{}
reserveTxn := func(count int) int64 {
getTxnLock.Lock()
defer getTxnLock.Unlock()
ret := txn
txn += int64(count)
return ret
}
err = s.appendOneByOne(masterBr, events[1:], reserveTxn(len(events[1:])))
history_v2_persistence.go
s.Nil(err)
events = s.read(masterBr, 1, int64(concurrency)+2)
s.Nil(err)
s.Equal((concurrency)+1, len(events))
level1ID := new(sync.Map)
level1Br := new(sync.Map)
// test forking from master branch and append nodes
for i := range concurrency {
wg.Add(1)
go func(idx int) {
defer wg.Done()
forkNodeID := rand.Int63n(int64(concurrency)) + 2
level1ID.Store(idx, forkNodeID)
bi, err := s.fork(masterBr, forkNodeID)
s.Nil(err)
level1Br.Store(idx, bi)
// cannot append to ancestors
events := s.genRandomEvents([]int64{forkNodeID - 1}, 1)
err = s.appendNewNode(bi, events, reserveTxn(1))
_, ok := err.(*p.InvalidPersistenceRequestError)
s.Equal(true, ok)
// append second batch to first level
eids := make([]int64, 0)
for i := forkNodeID; i <= int64(concurrency)*2+1; i++ {
eids = append(eids, i)
}
events = s.genRandomEvents(eids, 1)
err = s.appendNewNode(bi, events[0:1], reserveTxn(1))
s.Nil(err)
err = s.appendOneByOne(bi, events[1:], reserveTxn(len(events[1:])))
s.Nil(err)
events = s.read(bi, 1, int64(concurrency)*2+2)
s.Nil(err)
s.Equal((concurrency)*2+1, len(events))
if idx == 0 {
err = s.deleteHistoryBranch(bi)
s.Nil(err)
}
}(i)
}
branches = s.descTree(treeID)
s.Equal(concurrency, len(branches))
forkOnLevel1 := int32(0)
level2Br := new(sync.Map)
wg = sync.WaitGroup{}
// test forking for second level of branch
for i := 1; i < concurrency; i++ {
wg.Add(1)
go func(idx int) {
defer wg.Done()
// Event we fork from level1 branch, it is possible that the new branch will fork from master branch
forkNodeID := rand.Int63n(int64(concurrency)*2) + 2
forkBr := s.getBranchByKey(level1Br, idx)
lastForkNodeID := s.getIDByKey(level1ID, idx)
if forkNodeID > lastForkNodeID {
atomic.AddInt32(&forkOnLevel1, int32(1))
}
s.Nil(err)
level2Br.Store(idx, bi)
// append second batch to second level
eids := make([]int64, 0)
for i := forkNodeID; i <= int64(concurrency)*3+1; i++ {
eids = append(eids, i)
}
events := s.genRandomEvents(eids, 1)
err = s.appendNewNode(bi, events[0:1], reserveTxn(1))
s.Nil(err)
err = s.appendOneByOne(bi, events[1:], reserveTxn(len(events[1:])))
s.Nil(err)
events = s.read(bi, 1, int64(concurrency)*3+2)
s.Nil(err)
s.Equal((concurrency)*3+1, len(events))
// try override last event
events = s.genRandomEvents([]int64{int64(concurrency)*3 + 1}, 1)
err = s.appendNewNode(bi, events, reserveTxn(1))
s.Nil(err)
events = s.read(bi, 1, int64(concurrency)*3+2)
s.Nil(err)
s.Equal((concurrency)*3+1, len(events))
// test fork and newBranch concurrently
bi, err = s.newHistoryBranch(treeID)
s.Nil(err)
level2Br.Store(concurrency+idx, bi)
events = s.genRandomEvents([]int64{1}, 1)
err = s.appendNewBranchAndFirstNode(bi, events, reserveTxn(1), "newbr")
s.Nil(err)
}(i)
}
branches = s.descTree(treeID)
s.Equal(concurrency*3-2, len(branches))
actualForkOnLevel1 := int32(0)
masterCnt := 0
for _, b := range branches {
if len(b.Ancestors) == 2 {
actualForkOnLevel1++
} else if len(b.Ancestors) == 0 {
masterCnt++
} else {
s.Equal(1, len(b.Ancestors))
s.Equal(mbrID, b.Ancestors[0].GetBranchId())
}
}
s.Equal(concurrency, masterCnt)
// Finally lets clean up all branches
level1Br.Range(func(k, v any) bool {
br := v.([]byte)
// delete old branches along with create new branches
err := s.deleteHistoryBranch(br)
s.Nil(err)
return true
})
level2Br.Range(func(k, v any) bool {
br := v.([]byte)
// delete old branches along with create new branches
err := s.deleteHistoryBranch(br)
s.Nil(err)
return true
})
err = s.deleteHistoryBranch(masterBr)
s.Nil(err)
branches = s.descTree(treeID)
s.Equal(0, len(branches))
}
}
func (s *HistoryV2PersistenceSuite) getIDByKey(m *sync.Map, k int) int64 {
history_v2_persistence.go
v, ok := m.Load(k)
s.Equal(true, ok)
id := v.(int64)
return id
}
func (s *HistoryV2PersistenceSuite) genRandomEvents(eventIDs []int64, version int64) []*historypb.HistoryEvent {
}
func (s *HistoryV2PersistenceSuite) appendOneByOne(branch []byte, events []*historypb.HistoryEvent, txnID int64) error {
history_v2_persistence.go
for index, e := range events {
err := s.append(branch, []*historypb.HistoryEvent{e}, txnID+int64(index), false, "")
if err != nil {
return err
}
}
}
err := backoff.ThrottleRetry(op, historyTestRetryPolicy, isConditionFail)
if err != nil {
}
s.True(resp.Size > 0)
beginNodeID := GetBeginNodeID(forkBranch)
if beginNodeID >= request.ForkNodeID {
// this is the case that new branch's ancestors doesn't include the forking branch
history_manager.go
for _, br := range forkBranch.Ancestors {
if br.GetEndNodeId() >= request.ForkNodeID {
newAncestors = append(newAncestors, &persistencespb.HistoryBranchRange{
BranchId: br.GetBranchId(),
BeginNodeId: br.GetBeginNodeId(),
EndNodeId: request.ForkNodeID,
})
break
} else {
newAncestors = append(newAncestors, br)
if nodeID < GetBeginNodeID(branch) {
Msg: "cannot append to ancestors' nodes",
}
}
return req, nil
if err != nil {
}
err = m.persistence.AppendHistoryNodes(ctx, req)
(ans)[0].BeginNodeId = int64(1)
for i := 1; i < len(ans); i++ {
}
}
}