@@ -16,8 +16,8 @@ struct ConflictStackElt {
16
16
17
17
fn output_conflict < T : ChannelTxnT , B : VertexBuffer , P : ChangeStore > (
18
18
changes : & P ,
19
- txn : & T ,
20
- channel : & T :: Channel ,
19
+ txn : & ArcTxn < T > ,
20
+ channel : & ChannelRef < T > ,
21
21
line_buf : & mut B ,
22
22
graph : & Graph ,
23
23
sccs : & Vector2 < VertexId > ,
@@ -34,17 +34,25 @@ fn output_conflict<T: ChannelTxnT, B: VertexBuffer, P: ChangeStore>(
34
34
while let Some ( mut elt) = stack. pop ( ) {
35
35
let n_sides = elt. conflict . len ( ) ;
36
36
if n_sides > 1 && elt. side == 0 && elt. idx == 0 {
37
+ let txn = txn. read ( ) ;
38
+ let channel = channel. read ( ) ;
37
39
elt. conflict . sort_by ( |a, b| {
38
40
let a_ = a
39
41
. path
40
42
. iter ( )
41
- . map ( |a| a. oldest_vertex ( changes, txn, channel, graph, sccs) . unwrap ( ) )
43
+ . map ( |a| {
44
+ a. oldest_vertex ( changes, & * txn, & * channel, graph, sccs)
45
+ . unwrap ( )
46
+ } )
42
47
. min ( )
43
48
. unwrap ( ) ;
44
49
let b_ = b
45
50
. path
46
51
. iter ( )
47
- . map ( |b| b. oldest_vertex ( changes, txn, channel, graph, sccs) . unwrap ( ) )
52
+ . map ( |b| {
53
+ b. oldest_vertex ( changes, & * txn, & * channel, graph, sccs)
54
+ . unwrap ( )
55
+ } )
48
56
. min ( )
49
57
. unwrap ( ) ;
50
58
a_. cmp ( & b_)
@@ -70,6 +78,7 @@ fn output_conflict<T: ChannelTxnT, B: VertexBuffer, P: ChangeStore>(
70
78
match elt. conflict [ elt. side ] . path [ elt. idx ] {
71
79
PathElement :: Scc { scc } => {
72
80
let vid = sccs[ scc] [ 0 ] ;
81
+ let txn = txn. read ( ) ;
73
82
let ext = txn. get_external ( & graph[ vid] . vertex . change ) ?. unwrap ( ) ;
74
83
line_buf. conflict_next ( elt. id , & [ & ext. into ( ) ] ) ?;
75
84
}
@@ -184,7 +193,7 @@ impl PathElement {
184
193
185
194
fn output_scc < T : GraphTxnT , B : VertexBuffer , P : ChangeStore > (
186
195
changes : & P ,
187
- txn : & T ,
196
+ txn : & ArcTxn < T > ,
188
197
graph : & Graph ,
189
198
scc : & [ VertexId ] ,
190
199
is_zombie : & mut Option < usize > ,
@@ -201,6 +210,7 @@ fn output_scc<T: GraphTxnT, B: VertexBuffer, P: ChangeStore>(
201
210
if graph[ v] . flags . contains ( Flags :: ZOMBIE ) {
202
211
if is_zombie. is_none ( ) {
203
212
* is_zombie = Some ( * id) ;
213
+ let txn = txn. read ( ) ;
204
214
let hash = txn. get_external ( & graph[ v] . vertex . change ) ?. unwrap ( ) ;
205
215
vbuf. begin_zombie_conflict ( * id, & [ & hash. into ( ) ] ) ?;
206
216
* id += 1
@@ -216,7 +226,7 @@ fn output_scc<T: GraphTxnT, B: VertexBuffer, P: ChangeStore>(
216
226
let now = std:: time:: Instant :: now ( ) ;
217
227
let result = changes
218
228
. get_contents (
219
- |p| txn. get_external ( & p) . unwrap ( ) . map ( |x| x. into ( ) ) ,
229
+ |p| txn. read ( ) . get_external ( & p) . unwrap ( ) . map ( |x| x. into ( ) ) ,
220
230
vertex,
221
231
buf,
222
232
)
@@ -241,8 +251,8 @@ fn output_scc<T: GraphTxnT, B: VertexBuffer, P: ChangeStore>(
241
251
242
252
pub fn output_graph < T : ChannelTxnT , B : VertexBuffer , P : ChangeStore > (
243
253
changes : & P ,
244
- txn : & T ,
245
- channel : & T :: Channel ,
254
+ txn : & ArcTxn < T > ,
255
+ channel : & ChannelRef < T > ,
246
256
line_buf : & mut B ,
247
257
graph : & mut Graph ,
248
258
forward : & mut Vec < super :: Redundant > ,
@@ -253,8 +263,11 @@ pub fn output_graph<T: ChannelTxnT, B: VertexBuffer, P: ChangeStore>(
253
263
let now0 = std:: time:: Instant :: now ( ) ;
254
264
let scc = graph. tarjan ( ) ; // SCCs are given here in reverse order.
255
265
let ( conflict_tree, forward_scc) = graph. dfs ( & scc) ;
256
- graph. collect_forward_edges ( txn, txn. graph ( channel) , & scc, & forward_scc, forward) ?;
257
-
266
+ {
267
+ let txn = txn. read ( ) ;
268
+ let channel = channel. read ( ) ;
269
+ graph. collect_forward_edges ( & * txn, txn. graph ( & * channel) , & scc, & forward_scc, forward) ?;
270
+ }
258
271
crate :: TIMERS . lock ( ) . unwrap ( ) . alive_graph += now0. elapsed ( ) ;
259
272
let now1 = std:: time:: Instant :: now ( ) ;
260
273
debug ! ( "conflict_tree = {:?}" , conflict_tree) ;
0 commit comments