| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package KiokuDB::Test::Fixture::TXN::Scan; |
|
2
|
2
|
|
|
2
|
|
1941
|
use Moose; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
19
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
10926
|
use Test::More; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
20
|
|
|
5
|
2
|
|
|
2
|
|
645
|
use Test::Exception; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
18
|
|
|
6
|
2
|
|
|
2
|
|
381
|
use Test::Moose; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
826
|
use KiokuDB::Test::Person; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
46
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
8
|
use namespace::clean -except => 'meta'; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
19
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
extends qw(KiokuDB::Test::Fixture::Scan); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
override required_backend_roles => sub { |
|
15
|
|
|
|
|
|
|
return (qw(TXN), super()); |
|
16
|
|
|
|
|
|
|
}; |
|
17
|
|
|
|
|
|
|
|
|
18
|
4
|
|
|
4
|
0
|
9
|
sub sort { 151 } |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
around populate => sub { |
|
21
|
|
|
|
|
|
|
my ( $next, $self, @args ) = @_; |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
$self->txn_do(sub { $self->$next(@args) }); |
|
24
|
|
|
|
|
|
|
}; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub verify { |
|
27
|
33
|
|
|
33
|
0
|
81
|
my $self = shift; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
$self->txn_lives(sub { |
|
30
|
33
|
|
|
33
|
|
282
|
my $root = $self->root_set; |
|
31
|
|
|
|
|
|
|
|
|
32
|
33
|
|
|
|
|
267
|
does_ok( $root, "Data::Stream::Bulk" ); |
|
33
|
|
|
|
|
|
|
|
|
34
|
33
|
|
|
|
|
17477
|
my @objs = $root->all; |
|
35
|
|
|
|
|
|
|
|
|
36
|
33
|
|
|
|
|
1809
|
my @ids = $self->objects_to_ids(@objs); |
|
37
|
|
|
|
|
|
|
|
|
38
|
99
|
|
|
|
|
2419
|
is_deeply( |
|
39
|
33
|
|
|
|
|
113
|
[ sort map { $_->name } @objs ], |
|
40
|
|
|
|
|
|
|
[ sort qw(foo bar gorch) ], |
|
41
|
|
|
|
|
|
|
"root set", |
|
42
|
|
|
|
|
|
|
); |
|
43
|
|
|
|
|
|
|
|
|
44
|
33
|
|
|
|
|
23126
|
is_deeply( |
|
45
|
|
|
|
|
|
|
[ sort $self->backend->root_entry_ids->all ], |
|
46
|
|
|
|
|
|
|
[ sort @ids ], |
|
47
|
|
|
|
|
|
|
"root set IDs", |
|
48
|
|
|
|
|
|
|
); |
|
49
|
33
|
|
|
|
|
491
|
}); |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
throws_ok { |
|
52
|
|
|
|
|
|
|
$self->txn_do(scope => 1, body => sub { |
|
53
|
33
|
|
|
|
|
1155
|
$self->insert_ok( KiokuDB::Test::Person->new( name => "another" ) ); |
|
54
|
|
|
|
|
|
|
|
|
55
|
33
|
|
|
|
|
417
|
my $root = $self->root_set; |
|
56
|
|
|
|
|
|
|
|
|
57
|
33
|
|
|
|
|
265
|
does_ok( $root, "Data::Stream::Bulk" ); |
|
58
|
|
|
|
|
|
|
|
|
59
|
33
|
|
|
|
|
13910
|
my @objs = $root->all; |
|
60
|
|
|
|
|
|
|
|
|
61
|
33
|
|
|
|
|
1783
|
my @ids = $self->objects_to_ids(@objs); |
|
62
|
|
|
|
|
|
|
|
|
63
|
132
|
|
|
|
|
3102
|
is_deeply( |
|
64
|
33
|
|
|
|
|
111
|
[ sort map { $_->name } @objs ], |
|
65
|
|
|
|
|
|
|
[ sort qw(foo bar gorch another) ], |
|
66
|
|
|
|
|
|
|
"root set reflects insertion", |
|
67
|
|
|
|
|
|
|
); |
|
68
|
|
|
|
|
|
|
|
|
69
|
33
|
|
|
|
|
23360
|
is_deeply( |
|
70
|
|
|
|
|
|
|
[ sort $self->backend->root_entry_ids->all ], |
|
71
|
|
|
|
|
|
|
[ sort @ids ], |
|
72
|
|
|
|
|
|
|
"root set IDs are the same", |
|
73
|
|
|
|
|
|
|
); |
|
74
|
|
|
|
|
|
|
|
|
75
|
33
|
|
|
|
|
23735
|
die "rollback"; |
|
76
|
33
|
|
|
33
|
|
2276
|
}); |
|
77
|
33
|
|
|
|
|
12642
|
} qr/rollback/; |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
$self->txn_lives(sub { |
|
80
|
33
|
|
|
33
|
|
317
|
my $root = $self->root_set; |
|
81
|
|
|
|
|
|
|
|
|
82
|
33
|
|
|
|
|
259
|
my @objs = $root->all; |
|
83
|
|
|
|
|
|
|
|
|
84
|
33
|
|
|
|
|
1815
|
my @ids = $self->objects_to_ids(@objs); |
|
85
|
|
|
|
|
|
|
|
|
86
|
99
|
|
|
|
|
2450
|
is_deeply( |
|
87
|
33
|
|
|
|
|
116
|
[ sort map { $_->name } @objs ], |
|
88
|
|
|
|
|
|
|
[ sort qw(foo bar gorch) ], |
|
89
|
|
|
|
|
|
|
"root set rolled back", |
|
90
|
|
|
|
|
|
|
); |
|
91
|
|
|
|
|
|
|
|
|
92
|
33
|
|
|
|
|
24599
|
is_deeply( |
|
93
|
|
|
|
|
|
|
[ sort $self->backend->root_entry_ids->all ], |
|
94
|
|
|
|
|
|
|
[ sort @ids ], |
|
95
|
|
|
|
|
|
|
"ids are the same", |
|
96
|
|
|
|
|
|
|
); |
|
97
|
33
|
|
|
|
|
13012
|
}); |
|
98
|
|
|
|
|
|
|
|
|
99
|
33
|
|
|
|
|
11930
|
my $foo_id; |
|
100
|
|
|
|
|
|
|
$self->txn_lives(sub { |
|
101
|
33
|
|
|
33
|
|
299
|
my %objs = map { $_->name => $_ } $self->root_set->all; |
|
|
99
|
|
|
|
|
3757
|
|
|
102
|
33
|
|
|
|
|
986
|
$foo_id = $self->object_to_id($objs{foo}); |
|
103
|
33
|
|
|
|
|
430
|
}); |
|
104
|
|
|
|
|
|
|
|
|
105
|
33
|
|
|
|
|
17437
|
ok( defined($foo_id), "got an ID for foo" ); |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
throws_ok { |
|
108
|
|
|
|
|
|
|
$self->txn_do(scope => 1, body => sub { |
|
109
|
33
|
|
|
|
|
275
|
$self->delete_ok($foo_id); |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
{ |
|
112
|
33
|
|
|
|
|
122
|
my $root = $self->root_set; |
|
|
33
|
|
|
|
|
278
|
|
|
113
|
|
|
|
|
|
|
|
|
114
|
33
|
|
|
|
|
238
|
my @objs = $root->all; |
|
115
|
|
|
|
|
|
|
|
|
116
|
33
|
|
|
|
|
1777
|
my @ids = $self->objects_to_ids(@objs); |
|
117
|
|
|
|
|
|
|
|
|
118
|
66
|
|
|
|
|
1679
|
is_deeply( |
|
119
|
33
|
|
|
|
|
116
|
[ sort map { $_->name } @objs ], |
|
120
|
|
|
|
|
|
|
[ sort qw(bar gorch) ], |
|
121
|
|
|
|
|
|
|
"root set reflects deletion", |
|
122
|
|
|
|
|
|
|
); |
|
123
|
|
|
|
|
|
|
|
|
124
|
33
|
|
|
|
|
23318
|
is_deeply( |
|
125
|
|
|
|
|
|
|
[ sort $self->backend->root_entry_ids->all ], |
|
126
|
|
|
|
|
|
|
[ sort @ids ], |
|
127
|
|
|
|
|
|
|
"root set IDs are the same", |
|
128
|
|
|
|
|
|
|
); |
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
{ |
|
132
|
33
|
|
|
|
|
1242
|
$self->insert_ok( KiokuDB::Test::Person->new( name => "blah" ) ); |
|
|
33
|
|
|
|
|
1141
|
|
|
133
|
|
|
|
|
|
|
|
|
134
|
33
|
|
|
|
|
430
|
my $root = $self->root_set; |
|
135
|
|
|
|
|
|
|
|
|
136
|
33
|
|
|
|
|
272
|
does_ok( $root, "Data::Stream::Bulk" ); |
|
137
|
|
|
|
|
|
|
|
|
138
|
33
|
|
|
|
|
14469
|
my @objs = $root->all; |
|
139
|
|
|
|
|
|
|
|
|
140
|
33
|
|
|
|
|
1692
|
my @ids = $self->objects_to_ids(@objs); |
|
141
|
|
|
|
|
|
|
|
|
142
|
99
|
|
|
|
|
2693
|
is_deeply( |
|
143
|
33
|
|
|
|
|
109
|
[ sort map { $_->name } @objs ], |
|
144
|
|
|
|
|
|
|
[ sort qw(blah bar gorch) ], |
|
145
|
|
|
|
|
|
|
"root set reflects deletion and insertion", |
|
146
|
|
|
|
|
|
|
); |
|
147
|
|
|
|
|
|
|
|
|
148
|
33
|
|
|
|
|
20794
|
is_deeply( |
|
149
|
|
|
|
|
|
|
[ sort $self->backend->root_entry_ids->all ], |
|
150
|
|
|
|
|
|
|
[ sort @ids ], |
|
151
|
|
|
|
|
|
|
"root set IDs are the same", |
|
152
|
|
|
|
|
|
|
); |
|
153
|
|
|
|
|
|
|
} |
|
154
|
|
|
|
|
|
|
|
|
155
|
33
|
|
|
|
|
1225
|
die "rollback"; |
|
156
|
33
|
|
|
33
|
|
2110
|
}); |
|
157
|
33
|
|
|
|
|
11029
|
} qr/rollback/; |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
$self->txn_lives(sub { |
|
160
|
33
|
|
|
33
|
|
309
|
my $root = $self->root_set; |
|
161
|
|
|
|
|
|
|
|
|
162
|
33
|
|
|
|
|
245
|
my @objs = $root->all; |
|
163
|
|
|
|
|
|
|
|
|
164
|
33
|
|
|
|
|
1855
|
my @ids = $self->objects_to_ids(@objs); |
|
165
|
|
|
|
|
|
|
|
|
166
|
99
|
|
|
|
|
2663
|
is_deeply( |
|
167
|
33
|
|
|
|
|
102
|
[ sort map { $_->name } @objs ], |
|
168
|
|
|
|
|
|
|
[ sort qw(foo bar gorch) ], |
|
169
|
|
|
|
|
|
|
"root set", |
|
170
|
|
|
|
|
|
|
); |
|
171
|
|
|
|
|
|
|
|
|
172
|
33
|
|
|
|
|
24672
|
is_deeply( |
|
173
|
|
|
|
|
|
|
[ sort $self->backend->root_entry_ids->all ], |
|
174
|
|
|
|
|
|
|
[ sort @ids ], |
|
175
|
|
|
|
|
|
|
"ids are the same", |
|
176
|
|
|
|
|
|
|
); |
|
177
|
33
|
|
|
|
|
13405
|
}); |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
$self->txn_lives(sub { |
|
180
|
33
|
|
|
33
|
|
266
|
my @objs = $self->all_objects->all; |
|
181
|
|
|
|
|
|
|
|
|
182
|
33
|
|
|
|
|
2442
|
my @ids = $self->objects_to_ids(@objs); |
|
183
|
|
|
|
|
|
|
|
|
184
|
132
|
|
|
|
|
3273
|
is_deeply( |
|
185
|
33
|
|
|
|
|
108
|
[ sort map { $_->name } @objs ], |
|
186
|
|
|
|
|
|
|
[ sort qw(foo bar gorch quxx) ], |
|
187
|
|
|
|
|
|
|
"all entries", |
|
188
|
|
|
|
|
|
|
); |
|
189
|
|
|
|
|
|
|
|
|
190
|
33
|
|
|
|
|
24084
|
is_deeply( |
|
191
|
|
|
|
|
|
|
[ sort $self->backend->all_entry_ids->all ], |
|
192
|
|
|
|
|
|
|
[ sort @ids ], |
|
193
|
|
|
|
|
|
|
"all IDs", |
|
194
|
|
|
|
|
|
|
); |
|
195
|
33
|
|
|
|
|
12720
|
}); |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
throws_ok { |
|
198
|
|
|
|
|
|
|
$self->txn_do(scope => 1, body => sub { |
|
199
|
33
|
|
|
|
|
263
|
$self->backend->clear; |
|
200
|
|
|
|
|
|
|
|
|
201
|
33
|
|
|
|
|
281
|
is_deeply( |
|
202
|
|
|
|
|
|
|
[ $self->all_objects->all ], |
|
203
|
|
|
|
|
|
|
[ ], |
|
204
|
|
|
|
|
|
|
"no enrtries (db cleared)", |
|
205
|
|
|
|
|
|
|
); |
|
206
|
|
|
|
|
|
|
|
|
207
|
33
|
|
|
|
|
19640
|
$self->insert_ok( KiokuDB::Test::Person->new( name => "very new" ) ); |
|
208
|
|
|
|
|
|
|
|
|
209
|
33
|
|
|
|
|
2228
|
is_deeply( |
|
210
|
33
|
|
|
|
|
451
|
[ map { $_->name } $self->all_objects->all ], |
|
211
|
|
|
|
|
|
|
[ "very new" ], |
|
212
|
|
|
|
|
|
|
"one entry", |
|
213
|
|
|
|
|
|
|
); |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
$self->txn_lives(sub { |
|
216
|
33
|
|
|
|
|
261
|
$self->backend->clear; |
|
217
|
|
|
|
|
|
|
|
|
218
|
33
|
|
|
|
|
263
|
is_deeply( |
|
219
|
|
|
|
|
|
|
[ $self->all_objects->all ], |
|
220
|
|
|
|
|
|
|
[ ], |
|
221
|
|
|
|
|
|
|
"no enrtries (db cleared)", |
|
222
|
|
|
|
|
|
|
); |
|
223
|
33
|
|
|
|
|
19876
|
}); |
|
224
|
|
|
|
|
|
|
|
|
225
|
33
|
|
|
|
|
12220
|
is_deeply( |
|
226
|
|
|
|
|
|
|
[ $self->all_objects->all ], |
|
227
|
|
|
|
|
|
|
[ ], |
|
228
|
|
|
|
|
|
|
"no enrtries (db cleared)", |
|
229
|
|
|
|
|
|
|
); |
|
230
|
|
|
|
|
|
|
|
|
231
|
33
|
|
|
|
|
19055
|
die "rollback"; |
|
232
|
33
|
|
|
33
|
|
1546
|
}); |
|
233
|
33
|
|
|
|
|
12734
|
} qr/rollback/, "rolled back"; |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
$self->txn_lives(sub { |
|
236
|
33
|
|
|
33
|
|
232
|
my @objs = $self->all_objects->all; |
|
237
|
|
|
|
|
|
|
|
|
238
|
33
|
|
|
|
|
2443
|
my @ids = $self->objects_to_ids(@objs); |
|
239
|
|
|
|
|
|
|
|
|
240
|
132
|
|
|
|
|
3330
|
is_deeply( |
|
241
|
33
|
|
|
|
|
113
|
[ sort map { $_->name } @objs ], |
|
242
|
|
|
|
|
|
|
[ sort qw(foo bar gorch quxx) ], |
|
243
|
|
|
|
|
|
|
"all entries restored", |
|
244
|
|
|
|
|
|
|
); |
|
245
|
|
|
|
|
|
|
|
|
246
|
33
|
|
|
|
|
25637
|
is_deeply( |
|
247
|
|
|
|
|
|
|
[ sort $self->backend->all_entry_ids->all ], |
|
248
|
|
|
|
|
|
|
[ sort @ids ], |
|
249
|
|
|
|
|
|
|
"all IDs", |
|
250
|
|
|
|
|
|
|
); |
|
251
|
33
|
|
|
|
|
12930
|
}); |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
$self->txn_lives(sub { |
|
254
|
33
|
|
|
33
|
|
240
|
$self->backend->clear; |
|
255
|
33
|
|
|
|
|
12899
|
}); |
|
256
|
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
$self->txn_lives(sub { |
|
258
|
33
|
|
|
33
|
|
276
|
is_deeply( |
|
259
|
|
|
|
|
|
|
[ $self->all_objects->all ], |
|
260
|
|
|
|
|
|
|
[ ], |
|
261
|
|
|
|
|
|
|
"no enrtries (db cleared)", |
|
262
|
|
|
|
|
|
|
); |
|
263
|
33
|
|
|
|
|
12450
|
}); |
|
264
|
|
|
|
|
|
|
} |
|
265
|
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
__PACKAGE__ |
|
269
|
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
__END__ |
|
271
|
|
|
|
|
|
|
|