@@ -9,7 +9,6 @@ pub struct CommitGroup {
99 intents : Vec < NamespaceCommitIntent > ,
1010 client : Option < Arc < MultiVersionClient > > ,
1111 dp : Option < Url > ,
12- pub current_version : Option < String > ,
1312}
1413
1514impl Default for CommitGroup {
@@ -18,14 +17,12 @@ impl Default for CommitGroup {
1817 intents : Vec :: new ( ) ,
1918 client : None ,
2019 dp : None ,
21- current_version : None ,
2220 }
2321 }
2422}
2523
2624pub enum TransactionStart {
2725 Normal ,
28- UseVersion ( String ) ,
2926 Reject ,
3027}
3128
@@ -59,24 +56,12 @@ pub fn transaction_start() -> TransactionStart {
5956 let cg = cg. borrow ( ) ;
6057 match & * cg {
6158 Some ( cg) if !cg. intents . is_empty ( ) => TransactionStart :: Reject ,
62- Some ( cg) => match & cg. current_version {
63- Some ( version) => TransactionStart :: UseVersion ( version. clone ( ) ) ,
64- None => TransactionStart :: Normal ,
65- } ,
59+ Some ( _) => TransactionStart :: Normal ,
6660 None => TransactionStart :: Normal ,
6761 }
6862 } )
6963}
7064
71- pub fn set_current_version ( version : & str ) {
72- CURRENT_COMMIT_GROUP . with ( |cg| {
73- if let Some ( cg) = & mut * cg. borrow_mut ( ) {
74- cg. current_version
75- . get_or_insert_with ( || version. to_string ( ) ) ;
76- }
77- } ) ;
78- }
79-
8065pub fn append_intent (
8166 client : & Arc < MultiVersionClient > ,
8267 dp : Option < & Url > ,
@@ -184,4 +169,15 @@ mod tests {
184169 rollback ( ) . unwrap ( ) ;
185170 assert ! ( !is_active( ) ) ;
186171 }
172+
173+ #[ test]
174+ fn transaction_start_stays_normal_until_first_intent ( ) {
175+ begin ( ) . unwrap ( ) ;
176+ assert ! ( matches!( transaction_start( ) , TransactionStart :: Normal ) ) ;
177+
178+ append_intent ( & test_client ( ) , None , test_intent ( ) ) . unwrap ( ) ;
179+ assert ! ( matches!( transaction_start( ) , TransactionStart :: Reject ) ) ;
180+
181+ rollback ( ) . unwrap ( ) ;
182+ }
187183}
0 commit comments