line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright 2016 - 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
|
|
371
|
use strict; |
|
59
|
|
|
|
|
117
|
|
|
59
|
|
|
|
|
1770
|
|
16
|
59
|
|
|
59
|
|
322
|
use warnings; |
|
59
|
|
|
|
|
103
|
|
|
59
|
|
|
|
|
2071
|
|
17
|
|
|
|
|
|
|
package MongoDB::Op::_DropIndexes; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Implements index drops; returns a MongoDB::CommandResult |
20
|
|
|
|
|
|
|
|
21
|
59
|
|
|
59
|
|
279
|
use version; |
|
59
|
|
|
|
|
106
|
|
|
59
|
|
|
|
|
389
|
|
22
|
|
|
|
|
|
|
our $VERSION = 'v2.2.2'; |
23
|
|
|
|
|
|
|
|
24
|
59
|
|
|
59
|
|
4353
|
use Moo; |
|
59
|
|
|
|
|
121
|
|
|
59
|
|
|
|
|
337
|
|
25
|
|
|
|
|
|
|
|
26
|
59
|
|
|
59
|
|
21503
|
use MongoDB::Error; |
|
59
|
|
|
|
|
178
|
|
|
59
|
|
|
|
|
6612
|
|
27
|
59
|
|
|
59
|
|
400
|
use MongoDB::Op::_Command; |
|
59
|
|
|
|
|
141
|
|
|
59
|
|
|
|
|
1582
|
|
28
|
59
|
|
|
59
|
|
318
|
use Safe::Isa; |
|
59
|
|
|
|
|
127
|
|
|
59
|
|
|
|
|
7879
|
|
29
|
59
|
|
|
|
|
460
|
use MongoDB::_Types qw( |
30
|
|
|
|
|
|
|
Numish |
31
|
|
|
|
|
|
|
Stringish |
32
|
59
|
|
|
59
|
|
379
|
); |
|
59
|
|
|
|
|
123
|
|
33
|
|
|
|
|
|
|
|
34
|
59
|
|
|
59
|
|
36643
|
use namespace::clean; |
|
59
|
|
|
|
|
137
|
|
|
59
|
|
|
|
|
419
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has index_name => ( |
37
|
|
|
|
|
|
|
is => 'ro', |
38
|
|
|
|
|
|
|
required => 1, |
39
|
|
|
|
|
|
|
isa => Stringish, |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
has max_time_ms => ( |
43
|
|
|
|
|
|
|
is => 'ro', |
44
|
|
|
|
|
|
|
isa => Numish, |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
with $_ for qw( |
48
|
|
|
|
|
|
|
MongoDB::Role::_PrivateConstructor |
49
|
|
|
|
|
|
|
MongoDB::Role::_CollectionOp |
50
|
|
|
|
|
|
|
MongoDB::Role::_WriteOp |
51
|
|
|
|
|
|
|
); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub execute { |
54
|
0
|
|
|
0
|
0
|
|
my ( $self, $link ) = @_; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
my $op = MongoDB::Op::_Command->_new( |
57
|
|
|
|
|
|
|
db_name => $self->db_name, |
58
|
|
|
|
|
|
|
query => [ |
59
|
|
|
|
|
|
|
dropIndexes => $self->coll_name, |
60
|
|
|
|
|
|
|
index => $self->index_name, |
61
|
0
|
0
|
|
|
|
|
( $link->supports_helper_write_concern ? ( @{ $self->write_concern->as_args } ) : () ), |
|
0
|
0
|
|
|
|
|
|
62
|
|
|
|
|
|
|
(defined($self->max_time_ms) |
63
|
|
|
|
|
|
|
? (maxTimeMS => $self->max_time_ms) |
64
|
|
|
|
|
|
|
: () |
65
|
|
|
|
|
|
|
), |
66
|
|
|
|
|
|
|
], |
67
|
|
|
|
|
|
|
query_flags => {}, |
68
|
|
|
|
|
|
|
bson_codec => $self->bson_codec, |
69
|
|
|
|
|
|
|
monitoring_callback => $self->monitoring_callback, |
70
|
|
|
|
|
|
|
); |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
my $res; |
73
|
0
|
|
|
|
|
|
eval { |
74
|
0
|
|
|
|
|
|
$res = $op->execute($link); |
75
|
0
|
|
|
|
|
|
$res->assert_no_write_concern_error; |
76
|
|
|
|
|
|
|
}; |
77
|
|
|
|
|
|
|
# XXX This logic will be a problem for command monitoring - may need to |
78
|
|
|
|
|
|
|
# move into Op::_Command as an 'error_filter' callback or something. |
79
|
0
|
0
|
|
|
|
|
if ( my $err = $@ ) { |
80
|
0
|
0
|
|
|
|
|
if ( $err->$_isa("MongoDB::DatabaseError") ) { |
81
|
|
|
|
|
|
|
# 2.6 and 3.0 don't have the code, so we fallback to string |
82
|
|
|
|
|
|
|
# matching on the error message |
83
|
0
|
0
|
0
|
|
|
|
return $err->result |
84
|
|
|
|
|
|
|
if $err->code == INDEX_NOT_FOUND() || $err->message =~ /index not found with name/; |
85
|
|
|
|
|
|
|
} |
86
|
0
|
|
|
|
|
|
die $err; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
return $res; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
1; |