history_node.go ×5

Frontier kind: Code frontier

unlabeled · c_738294c1b634

6 tests · 3103 LOC · 152 files · introduces 0 tests · 69 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
5 ranges69 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
461 ranges3103 lines · 152 files · Browse complete extent
All tests (intent)
6 testsBrowse complete intent

Neighbourhood graph

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.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 69 introduced LOC across 5 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/common/persistence/sql/sqlplugin/tests/history_node.go 69 introduced LOC · 5 ranges

Open complete file

132 }
133
134 > func (s *historyNodeSuite) TestInsertSelect_Multiple() { history_node.go
135 > numNodeIDs := 100
136 > nodePerNodeID := 2 + rand.Intn(8)
137 > pageSize := 10 + rand.Intn(10)
138 >
139 > shardID := rand.Int31()
140 > treeID := primitives.NewUUID()
141 > branchID := primitives.NewUUID()
142 >
143 > nodeID := int64(1)
144 > minNodeID := nodeID
145 > maxNodeID := minNodeID + int64(numNodeIDs)
146 >
147 > var nodes []sqlplugin.HistoryNodeRow
148 > for range numNodeIDs {
149 > for range nodePerNodeID {
150 > node := s.newRandomNodeRow(shardID, treeID, branchID, nodeID, rand.Int63(), rand.Int63())
151 > result, err := s.store.InsertIntoHistoryNode(newExecutionContext(), &node)
152 > s.NoError(err)
153 > rowsAffected, err := result.RowsAffected()
154 > s.NoError(err)
155 > s.Equal(1, int(rowsAffected))
156 > nodes = append(nodes, node)
157 > }
158 > nodeID++
159 }
160
161 > selectFilter := sqlplugin.HistoryNodeSelectFilter{ history_node.go
162 > ShardID: shardID,
163 > TreeID: treeID,
164 > BranchID: branchID,
165 > MinNodeID: minNodeID,
166 > MinTxnID: sql.MinTxnID,
167 > MaxNodeID: maxNodeID,
168 > PageSize: pageSize,
169 > }
170 > var rows []sqlplugin.HistoryNodeRow
171 > for {
172 > rowsPerPage, err := s.store.RangeSelectFromHistoryNode(newExecutionContext(), selectFilter)
173 > s.NoError(err)
174 > rows = append(rows, rowsPerPage...)
175 >
176 > if len(rowsPerPage) > 0 {
177 > lastNode := rowsPerPage[len(rowsPerPage)-1]
178 > selectFilter.MinNodeID = lastNode.NodeID
179 > selectFilter.MinTxnID = lastNode.TxnID
180 > } else {
181 > break
182 }
183 }
184
185 // NOTE: TxnID is *= -1 within InsertIntoHistoryNode
186 > for index := range nodes { history_node.go
187 > nodes[index].TxnID = -nodes[index].TxnID
188 > }
189 > sort.Slice(nodes, func(i, j int) bool {
190 > this := nodes[i]
191 > that := nodes[j]
192 >
193 > if this.NodeID < that.NodeID {
194 > return true
195 > } else if this.NodeID > that.NodeID {
196 > return false
197 > }
198
199 // larger transaction ID means newer
200 > if this.TxnID < that.TxnID { history_node.go
201 > return false
202 > } else if this.TxnID > that.TxnID {
203 > return true
204 > }
205
206 // same
207 return true
208 })
209 > for index := range rows { history_node.go
210 > rows[index].ShardID = shardID
211 > rows[index].TreeID = treeID
212 > rows[index].BranchID = branchID
213 > }
214 > s.Equal(nodes, rows)
215 }
216