@@ -49,6 +49,12 @@ fn test_task2_memtable_mvcc() {
4949 ( Bytes :: from( "b" ) , Bytes :: from( "1" ) ) ,
5050 ] ,
5151 ) ;
52+ check_lsm_iter_result_by_key (
53+ & mut snapshot1
54+ . scan ( Bound :: Excluded ( b"a" ) , Bound :: Excluded ( b"b" ) )
55+ . unwrap ( ) ,
56+ vec ! [ ] ,
57+ ) ;
5258 assert_eq ! ( snapshot2. get( b"a" ) . unwrap( ) , Some ( Bytes :: from_static( b"2" ) ) ) ;
5359 assert_eq ! ( snapshot2. get( b"b" ) . unwrap( ) , Some ( Bytes :: from_static( b"1" ) ) ) ;
5460 assert_eq ! ( snapshot2. get( b"c" ) . unwrap( ) , None ) ;
@@ -59,6 +65,12 @@ fn test_task2_memtable_mvcc() {
5965 ( Bytes :: from( "b" ) , Bytes :: from( "1" ) ) ,
6066 ] ,
6167 ) ;
68+ check_lsm_iter_result_by_key (
69+ & mut snapshot2
70+ . scan ( Bound :: Excluded ( b"a" ) , Bound :: Excluded ( b"b" ) )
71+ . unwrap ( ) ,
72+ vec ! [ ] ,
73+ ) ;
6274 assert_eq ! ( snapshot3. get( b"a" ) . unwrap( ) , Some ( Bytes :: from_static( b"2" ) ) ) ;
6375 assert_eq ! ( snapshot3. get( b"b" ) . unwrap( ) , None ) ;
6476 assert_eq ! ( snapshot3. get( b"c" ) . unwrap( ) , Some ( Bytes :: from_static( b"1" ) ) ) ;
@@ -69,6 +81,12 @@ fn test_task2_memtable_mvcc() {
6981 ( Bytes :: from( "c" ) , Bytes :: from( "1" ) ) ,
7082 ] ,
7183 ) ;
84+ check_lsm_iter_result_by_key (
85+ & mut snapshot3
86+ . scan ( Bound :: Excluded ( b"a" ) , Bound :: Excluded ( b"c" ) )
87+ . unwrap ( ) ,
88+ vec ! [ ] ,
89+ ) ;
7290 storage
7391 . inner
7492 . force_freeze_memtable ( & storage. inner . state_lock . lock ( ) )
@@ -91,6 +109,12 @@ fn test_task2_memtable_mvcc() {
91109 ( Bytes :: from( "b" ) , Bytes :: from( "1" ) ) ,
92110 ] ,
93111 ) ;
112+ check_lsm_iter_result_by_key (
113+ & mut snapshot1
114+ . scan ( Bound :: Excluded ( b"a" ) , Bound :: Excluded ( b"b" ) )
115+ . unwrap ( ) ,
116+ vec ! [ ] ,
117+ ) ;
94118 assert_eq ! ( snapshot2. get( b"a" ) . unwrap( ) , Some ( Bytes :: from_static( b"2" ) ) ) ;
95119 assert_eq ! ( snapshot2. get( b"b" ) . unwrap( ) , Some ( Bytes :: from_static( b"1" ) ) ) ;
96120 assert_eq ! ( snapshot2. get( b"c" ) . unwrap( ) , None ) ;
@@ -101,6 +125,12 @@ fn test_task2_memtable_mvcc() {
101125 ( Bytes :: from( "b" ) , Bytes :: from( "1" ) ) ,
102126 ] ,
103127 ) ;
128+ check_lsm_iter_result_by_key (
129+ & mut snapshot2
130+ . scan ( Bound :: Excluded ( b"a" ) , Bound :: Excluded ( b"b" ) )
131+ . unwrap ( ) ,
132+ vec ! [ ] ,
133+ ) ;
104134 assert_eq ! ( snapshot3. get( b"a" ) . unwrap( ) , Some ( Bytes :: from_static( b"2" ) ) ) ;
105135 assert_eq ! ( snapshot3. get( b"b" ) . unwrap( ) , None ) ;
106136 assert_eq ! ( snapshot3. get( b"c" ) . unwrap( ) , Some ( Bytes :: from_static( b"1" ) ) ) ;
@@ -111,6 +141,12 @@ fn test_task2_memtable_mvcc() {
111141 ( Bytes :: from( "c" ) , Bytes :: from( "1" ) ) ,
112142 ] ,
113143 ) ;
144+ check_lsm_iter_result_by_key (
145+ & mut snapshot3
146+ . scan ( Bound :: Excluded ( b"a" ) , Bound :: Excluded ( b"c" ) )
147+ . unwrap ( ) ,
148+ vec ! [ ] ,
149+ ) ;
114150 assert_eq ! ( snapshot4. get( b"a" ) . unwrap( ) , Some ( Bytes :: from_static( b"3" ) ) ) ;
115151 assert_eq ! ( snapshot4. get( b"b" ) . unwrap( ) , Some ( Bytes :: from_static( b"3" ) ) ) ;
116152 assert_eq ! ( snapshot4. get( b"c" ) . unwrap( ) , Some ( Bytes :: from_static( b"1" ) ) ) ;
@@ -122,6 +158,12 @@ fn test_task2_memtable_mvcc() {
122158 ( Bytes :: from( "c" ) , Bytes :: from( "1" ) ) ,
123159 ] ,
124160 ) ;
161+ check_lsm_iter_result_by_key (
162+ & mut snapshot4
163+ . scan ( Bound :: Excluded ( b"a" ) , Bound :: Excluded ( b"c" ) )
164+ . unwrap ( ) ,
165+ vec ! [ ( Bytes :: from( "b" ) , Bytes :: from( "3" ) ) ] ,
166+ ) ;
125167 assert_eq ! ( snapshot5. get( b"a" ) . unwrap( ) , Some ( Bytes :: from_static( b"4" ) ) ) ;
126168 assert_eq ! ( snapshot5. get( b"b" ) . unwrap( ) , Some ( Bytes :: from_static( b"3" ) ) ) ;
127169 assert_eq ! ( snapshot5. get( b"c" ) . unwrap( ) , Some ( Bytes :: from_static( b"1" ) ) ) ;
@@ -133,6 +175,12 @@ fn test_task2_memtable_mvcc() {
133175 ( Bytes :: from( "c" ) , Bytes :: from( "1" ) ) ,
134176 ] ,
135177 ) ;
178+ check_lsm_iter_result_by_key (
179+ & mut snapshot5
180+ . scan ( Bound :: Excluded ( b"a" ) , Bound :: Excluded ( b"c" ) )
181+ . unwrap ( ) ,
182+ vec ! [ ( Bytes :: from( "b" ) , Bytes :: from( "3" ) ) ] ,
183+ ) ;
136184 assert_eq ! ( snapshot6. get( b"a" ) . unwrap( ) , Some ( Bytes :: from_static( b"4" ) ) ) ;
137185 assert_eq ! ( snapshot6. get( b"b" ) . unwrap( ) , None ) ;
138186 assert_eq ! ( snapshot6. get( b"c" ) . unwrap( ) , Some ( Bytes :: from_static( b"5" ) ) ) ;
@@ -143,6 +191,12 @@ fn test_task2_memtable_mvcc() {
143191 ( Bytes :: from( "c" ) , Bytes :: from( "5" ) ) ,
144192 ] ,
145193 ) ;
194+ check_lsm_iter_result_by_key (
195+ & mut snapshot6
196+ . scan ( Bound :: Excluded ( b"a" ) , Bound :: Excluded ( b"c" ) )
197+ . unwrap ( ) ,
198+ vec ! [ ] ,
199+ ) ;
146200}
147201
148202#[ test]
0 commit comments