ref: fde6c854ad..e4705b54b0 for: 4.1.11 TOOLS-1163 mongodump/restore mongoexport/import and slashes in collection names TOOLS-1610 implement the extended json spec in import/export TOOLS-1835 Migrate mongoimport to new Go Driver TOOLS-1836 Migrate mongoexport to new Go Driver TOOLS-1837 Migrate mongodump to new Go Driver TOOLS-1838 Migrate mongorestore to new Go Driver TOOLS-1839 Migrate mongostat to new Go Driver TOOLS-1840 Migrate mongofiles to new Go Driver TOOLS-1841 Migrate mongotop to new Go Driver TOOLS-1842 Migrate bsondump to new Go Driver TOOLS-1906 Ignore mongorestore error "x509 certificate routines:X509_STORE_add_cert:cert already in hash table" TOOLS-2068 mongodump oplog delay TOOLS-2137 Implement client metadata handshake support for each tool TOOLS-2166 mongoimport --uri logs incorrect connected hosts TOOLS-2173 Migrate mongo-tools-common to Go driver bson compatibility TOOLS-2176 Vendor libraries for Go driver conversion TOOLS-2179 TestBsondump doesnt run on windows TOOLS-2182 Use Go driver for connection string URI parsing TOOLS-2199 Remove --repair option from mongodump TOOLS-2200 Tools qa tests failing in Evergreen with Go driver version of mongodump TOOLS-2202 Fix mongostat js tests TOOLS-2210 Build with tools with Address Space Layout Randomised (ASLR) flags enabled TOOLS-2211 Migrate from Evergreen v2 toolchain to v3 toolchain TOOLS-2213 Update tools to Go driver 1.0.0 TOOLS-2217 MongoExport doesn't parse read preference from URI TOOLS-2222 Mongodump should ignore config.transactions and config.transaction_coordinators TOOLS-2233 mongo-tools fails to build with go-1.12 TOOLS-2236 Build tools with Go 1.12 TOOLS-2247 Run gofmt TOOLS-2249 mongodump panics if collection doesn't exist TOOLS-2255 Tools should save metadata as canonical extended JSON TOOLS-2256 Refactor mongodump oplog iterator byte copying TOOLS-2257 Update bsondump to output canonical extended json TOOLS-2259 Tools do not properly check for connection establishment before executing TOOLS-2261 Tools kerberos tests failing TOOLS-2269 Compile time version variables lost in conversion to external common library TOOLS-2271 no_options_restore.js fails CI testing with latest
68 lines
2.3 KiB
JavaScript
68 lines
2.3 KiB
JavaScript
// tests gridfs with a sharded fs.chunks collection.
|
|
// @tags: [requires_sharding]
|
|
|
|
var test = new ShardingTest({shards: 3, mongos: 1, config: 1, verbose: 2, other: {chunkSize: 1}});
|
|
|
|
var mongos = test.s0;
|
|
|
|
var filename = "mongod"; // A large file we are guaranteed to have
|
|
if (_isWindows())
|
|
filename += ".exe";
|
|
|
|
function testGridFS(name) {
|
|
var d = mongos.getDB(name);
|
|
|
|
// this function should be called on a clean db
|
|
assert.eq(d.name.files.count(), 0);
|
|
assert.eq(d.fs.chunks.count(), 0);
|
|
|
|
var rawmd5 = md5sumFile(filename);
|
|
|
|
// upload file (currently calls filemd5 internally)
|
|
var exitCode = MongoRunner.runMongoTool("mongofiles",
|
|
{
|
|
port: mongos.port,
|
|
db: name,
|
|
},
|
|
"put",
|
|
filename);
|
|
assert.eq(0, exitCode, "mongofiles failed to upload '" + filename + "' into a sharded cluster");
|
|
|
|
assert.eq(d.fs.files.count(), 1);
|
|
var fileObj = d.fs.files.findOne();
|
|
print("fileObj: " + tojson(fileObj));
|
|
|
|
// Call filemd5 ourself and check results.
|
|
var res = d.runCommand({filemd5: fileObj._id});
|
|
print("filemd5 output: " + tojson(res));
|
|
assert(res.ok);
|
|
assert.eq(rawmd5, res.md5);
|
|
|
|
var numChunks = d.fs.chunks.find({files_id: fileObj._id}).itcount();
|
|
// var numChunks = d.fs.chunks.count({files_id: fileObj._id}) // this is broken for now
|
|
assert.eq(numChunks, res.numChunks);
|
|
}
|
|
|
|
print('\n\n\t**** unsharded ****\n\n');
|
|
name = 'unsharded';
|
|
testGridFS(name);
|
|
|
|
print('\n\n\t**** sharded db, unsharded collection ****\n\n');
|
|
name = 'sharded_db';
|
|
test.adminCommand({enablesharding: name});
|
|
testGridFS(name);
|
|
|
|
print('\n\n\t**** sharded collection on files_id ****\n\n');
|
|
name = 'sharded_files_id';
|
|
test.adminCommand({enablesharding: name});
|
|
test.adminCommand({shardcollection: name + '.fs.chunks', key: {files_id: 1}});
|
|
testGridFS(name);
|
|
|
|
print('\n\n\t**** sharded collection on files_id,n ****\n\n');
|
|
name = 'sharded_files_id_n';
|
|
test.adminCommand({enablesharding: name});
|
|
test.adminCommand({shardcollection: name + '.fs.chunks', key: {files_id: 1, n: 1}, unique: true});
|
|
testGridFS(name);
|
|
|
|
test.stop();
|