File tree 1 file changed +24
-1
lines changed
1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -65,14 +65,37 @@ function checkForDroppedCollections(database){
65
65
// collection name.
66
66
var pendingDropRegex = new RegExp ( "system\.drop\..*\." ) ;
67
67
collections = database . runCommand ( "listCollections" , { includePendingDrops : true } ) . cursor . firstBatch ;
68
- collection = collections . find ( c => pendingDropRegex . test ( c . name ) ) ;
68
+ collection = collections . find ( function ( c ) { pendingDropRegex . test ( c . name ) } ) ;
69
69
return collection ;
70
70
}
71
71
72
+ /*
73
+ * Cast a string number to an integer, and throw an exception if it fails.
74
+ */
75
+ function toInt ( string_number ) {
76
+ var number = parseInt ( string_number ) ;
77
+ if ( isNaN ( number ) ) {
78
+ throw "parseInt returned NaN" ;
79
+ }
80
+ return number ;
81
+ }
82
+
72
83
function checkForDroppedCollectionsTestDBs ( db , multidb ) {
73
84
// Check for any collections in 'drop-pending' state in any test
74
85
// database. The test databases have name testN, where N is 0 to
75
86
// multidb - 1;
87
+
88
+ // The checks only matter for versions 3.5 and later.
89
+ // The shell has some issues with the checks before 3.2
90
+ var serverVersion = db . version ( ) . split ( "." ) ;
91
+ var clientVersion = version ( ) . split ( "." ) ;
92
+
93
+ if ( toInt ( serverVersion [ 0 ] ) < 3 || ( toInt ( serverVersion [ 0 ] ) == 3 && toInt ( serverVersion [ 1 ] ) < 5 ) ) {
94
+ return ;
95
+ }
96
+ if ( toInt ( clientVersion [ 0 ] ) < 3 || ( toInt ( clientVersion [ 0 ] ) == 3 && toInt ( clientVersion [ 1 ] ) < 2 ) ) {
97
+ return ;
98
+ }
76
99
for ( var i = 0 ; i < multidb ; i ++ ) {
77
100
var sibling_db = db . getSiblingDB ( 'test' + i ) ;
78
101
var retries = 0 ;
You can’t perform that action at this time.
0 commit comments