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
|
58
|
|
|
58
|
|
404
|
use strict; |
|
58
|
|
|
|
|
142
|
|
|
58
|
|
|
|
|
1836
|
|
16
|
58
|
|
|
58
|
|
316
|
use warnings; |
|
58
|
|
|
|
|
129
|
|
|
58
|
|
|
|
|
2110
|
|
17
|
|
|
|
|
|
|
package MongoDB::Op::_FSyncUnlock; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Encapsulate collection list operations; returns arrayref of collection |
20
|
|
|
|
|
|
|
# names |
21
|
|
|
|
|
|
|
|
22
|
58
|
|
|
58
|
|
319
|
use version; |
|
58
|
|
|
|
|
122
|
|
|
58
|
|
|
|
|
376
|
|
23
|
|
|
|
|
|
|
our $VERSION = 'v2.2.0'; |
24
|
|
|
|
|
|
|
|
25
|
58
|
|
|
58
|
|
4803
|
use Moo; |
|
58
|
|
|
|
|
150
|
|
|
58
|
|
|
|
|
433
|
|
26
|
|
|
|
|
|
|
|
27
|
58
|
|
|
58
|
|
21283
|
use MongoDB::Op::_Command; |
|
58
|
|
|
|
|
137
|
|
|
58
|
|
|
|
|
1579
|
|
28
|
58
|
|
|
58
|
|
25857
|
use MongoDB::Op::_Query; |
|
58
|
|
|
|
|
187
|
|
|
58
|
|
|
|
|
2369
|
|
29
|
58
|
|
|
58
|
|
476
|
use MongoDB::ReadConcern; |
|
58
|
|
|
|
|
182
|
|
|
58
|
|
|
|
|
1318
|
|
30
|
58
|
|
|
58
|
|
330
|
use MongoDB::ReadPreference; |
|
58
|
|
|
|
|
134
|
|
|
58
|
|
|
|
|
1458
|
|
31
|
58
|
|
|
|
|
464
|
use MongoDB::_Types qw( |
32
|
|
|
|
|
|
|
Document |
33
|
58
|
|
|
58
|
|
301
|
); |
|
58
|
|
|
|
|
135
|
|
34
|
58
|
|
|
|
|
440
|
use Types::Standard qw( |
35
|
|
|
|
|
|
|
InstanceOf |
36
|
58
|
|
|
58
|
|
61467
|
); |
|
58
|
|
|
|
|
140
|
|
37
|
58
|
|
|
58
|
|
40841
|
use Tie::IxHash; |
|
58
|
|
|
|
|
139
|
|
|
58
|
|
|
|
|
1335
|
|
38
|
|
|
|
|
|
|
|
39
|
58
|
|
|
58
|
|
299
|
use namespace::clean; |
|
58
|
|
|
|
|
136
|
|
|
58
|
|
|
|
|
302
|
|
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; |