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
|
|
357
|
use strict; |
|
59
|
|
|
|
|
121
|
|
|
59
|
|
|
|
|
1628
|
|
16
|
59
|
|
|
59
|
|
284
|
use warnings; |
|
59
|
|
|
|
|
119
|
|
|
59
|
|
|
|
|
1838
|
|
17
|
|
|
|
|
|
|
package MongoDB::Op::_FSyncUnlock; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Encapsulate collection list operations; returns arrayref of collection |
20
|
|
|
|
|
|
|
# names |
21
|
|
|
|
|
|
|
|
22
|
59
|
|
|
59
|
|
278
|
use version; |
|
59
|
|
|
|
|
111
|
|
|
59
|
|
|
|
|
370
|
|
23
|
|
|
|
|
|
|
our $VERSION = 'v2.2.2'; |
24
|
|
|
|
|
|
|
|
25
|
59
|
|
|
59
|
|
4186
|
use Moo; |
|
59
|
|
|
|
|
129
|
|
|
59
|
|
|
|
|
408
|
|
26
|
|
|
|
|
|
|
|
27
|
59
|
|
|
59
|
|
18902
|
use MongoDB::Op::_Command; |
|
59
|
|
|
|
|
149
|
|
|
59
|
|
|
|
|
1334
|
|
28
|
59
|
|
|
59
|
|
30731
|
use MongoDB::Op::_Query; |
|
59
|
|
|
|
|
186
|
|
|
59
|
|
|
|
|
2122
|
|
29
|
59
|
|
|
59
|
|
415
|
use MongoDB::ReadConcern; |
|
59
|
|
|
|
|
119
|
|
|
59
|
|
|
|
|
1177
|
|
30
|
59
|
|
|
59
|
|
294
|
use MongoDB::ReadPreference; |
|
59
|
|
|
|
|
116
|
|
|
59
|
|
|
|
|
1302
|
|
31
|
59
|
|
|
|
|
445
|
use MongoDB::_Types qw( |
32
|
|
|
|
|
|
|
Document |
33
|
59
|
|
|
59
|
|
261
|
); |
|
59
|
|
|
|
|
128
|
|
34
|
59
|
|
|
|
|
405
|
use Types::Standard qw( |
35
|
|
|
|
|
|
|
InstanceOf |
36
|
59
|
|
|
59
|
|
55944
|
); |
|
59
|
|
|
|
|
124
|
|
37
|
59
|
|
|
59
|
|
36247
|
use Tie::IxHash; |
|
59
|
|
|
|
|
122
|
|
|
59
|
|
|
|
|
1204
|
|
38
|
|
|
|
|
|
|
|
39
|
59
|
|
|
59
|
|
267
|
use namespace::clean; |
|
59
|
|
|
|
|
109
|
|
|
59
|
|
|
|
|
495
|
|
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; |