line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright 2015 - present MongoDB, Inc. |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); |
4
|
|
|
|
|
|
|
# you may not use this file except in compliance with the License. |
5
|
|
|
|
|
|
|
# You may obtain a copy of the License at |
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0 |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# Unless required by applicable law or agreed to in writing, software |
10
|
|
|
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, |
11
|
|
|
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12
|
|
|
|
|
|
|
# See the License for the specific language governing permissions and |
13
|
|
|
|
|
|
|
# limitations under the License. |
14
|
|
|
|
|
|
|
|
15
|
59
|
|
|
59
|
|
406
|
use strict; |
|
59
|
|
|
|
|
144
|
|
|
59
|
|
|
|
|
1829
|
|
16
|
59
|
|
|
59
|
|
343
|
use warnings; |
|
59
|
|
|
|
|
129
|
|
|
59
|
|
|
|
|
2220
|
|
17
|
|
|
|
|
|
|
package MongoDB::Op::_FSyncUnlock; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Encapsulate collection list operations; returns arrayref of collection |
20
|
|
|
|
|
|
|
# names |
21
|
|
|
|
|
|
|
|
22
|
59
|
|
|
59
|
|
329
|
use version; |
|
59
|
|
|
|
|
135
|
|
|
59
|
|
|
|
|
365
|
|
23
|
|
|
|
|
|
|
our $VERSION = 'v2.2.1'; |
24
|
|
|
|
|
|
|
|
25
|
59
|
|
|
59
|
|
4887
|
use Moo; |
|
59
|
|
|
|
|
160
|
|
|
59
|
|
|
|
|
399
|
|
26
|
|
|
|
|
|
|
|
27
|
59
|
|
|
59
|
|
20909
|
use MongoDB::Op::_Command; |
|
59
|
|
|
|
|
176
|
|
|
59
|
|
|
|
|
1565
|
|
28
|
59
|
|
|
59
|
|
27592
|
use MongoDB::Op::_Query; |
|
59
|
|
|
|
|
181
|
|
|
59
|
|
|
|
|
2260
|
|
29
|
59
|
|
|
59
|
|
489
|
use MongoDB::ReadConcern; |
|
59
|
|
|
|
|
142
|
|
|
59
|
|
|
|
|
1409
|
|
30
|
59
|
|
|
59
|
|
325
|
use MongoDB::ReadPreference; |
|
59
|
|
|
|
|
133
|
|
|
59
|
|
|
|
|
1483
|
|
31
|
59
|
|
|
|
|
437
|
use MongoDB::_Types qw( |
32
|
|
|
|
|
|
|
Document |
33
|
59
|
|
|
59
|
|
306
|
); |
|
59
|
|
|
|
|
148
|
|
34
|
59
|
|
|
|
|
461
|
use Types::Standard qw( |
35
|
|
|
|
|
|
|
InstanceOf |
36
|
59
|
|
|
59
|
|
62171
|
); |
|
59
|
|
|
|
|
146
|
|
37
|
59
|
|
|
59
|
|
41437
|
use Tie::IxHash; |
|
59
|
|
|
|
|
147
|
|
|
59
|
|
|
|
|
1410
|
|
38
|
|
|
|
|
|
|
|
39
|
59
|
|
|
59
|
|
319
|
use namespace::clean; |
|
59
|
|
|
|
|
178
|
|
|
59
|
|
|
|
|
292
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
has client => ( |
42
|
|
|
|
|
|
|
is => 'ro', |
43
|
|
|
|
|
|
|
required => 1, |
44
|
|
|
|
|
|
|
isa => InstanceOf['MongoDB::MongoClient'], |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
with $_ for qw( |
48
|
|
|
|
|
|
|
MongoDB::Role::_PrivateConstructor |
49
|
|
|
|
|
|
|
MongoDB::Role::_DatabaseOp |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub execute { |
53
|
0
|
|
|
0
|
0
|
|
my ( $self, $link, $topology ) = @_; |
54
|
|
|
|
|
|
|
|
55
|
0
|
0
|
|
|
|
|
my $res = |
56
|
|
|
|
|
|
|
$link->supports_fsync_command |
57
|
|
|
|
|
|
|
? $self->_command_fsync_unlock( $link, $topology ) |
58
|
|
|
|
|
|
|
: $self->_legacy_fsync_unlock( $link, $topology ); |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
return $res; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub _command_fsync_unlock { |
64
|
0
|
|
|
0
|
|
|
my ( $self, $link, $topology ) = @_; |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
my $cmd = Tie::IxHash->new( |
67
|
|
|
|
|
|
|
fsyncUnlock => 1, |
68
|
|
|
|
|
|
|
); |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
my $op = MongoDB::Op::_Command->_new( |
71
|
|
|
|
|
|
|
db_name => $self->db_name, |
72
|
|
|
|
|
|
|
query => $cmd, |
73
|
|
|
|
|
|
|
query_flags => {}, |
74
|
|
|
|
|
|
|
read_preference => MongoDB::ReadPreference->new, |
75
|
|
|
|
|
|
|
bson_codec => $self->bson_codec, |
76
|
|
|
|
|
|
|
monitoring_callback => $self->monitoring_callback, |
77
|
|
|
|
|
|
|
); |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
my $res = $op->execute( $link, $topology ); |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
return $res->{output}; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub _legacy_fsync_unlock { |
85
|
0
|
|
|
0
|
|
|
my ( $self, $link, $topology ) = @_; |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
my $op = MongoDB::Op::_Query->_new( |
88
|
|
|
|
|
|
|
bson_codec => $self->bson_codec, |
89
|
|
|
|
|
|
|
client => $self->client, |
90
|
|
|
|
|
|
|
coll_name => '$cmd.sys.unlock', |
91
|
|
|
|
|
|
|
db_name => 'admin', |
92
|
|
|
|
|
|
|
filter => {}, |
93
|
|
|
|
|
|
|
full_name => 'admin.$cmd.sys.unlock', |
94
|
|
|
|
|
|
|
options => MongoDB::Op::_Query->precondition_options( { limit => -1 } ), |
95
|
|
|
|
|
|
|
read_concern => MongoDB::ReadConcern->new, |
96
|
|
|
|
|
|
|
read_preference => MongoDB::ReadPreference->new, |
97
|
|
|
|
|
|
|
monitoring_callback => $self->monitoring_callback, |
98
|
|
|
|
|
|
|
); |
99
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
return $op->execute( $link, $topology )->next; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
1; |