summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/split_collections_and_indexes.js
blob: 991a5fe293741034dece21a66e252b81e7a6c3af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
if (!jsTest.options().storageEngine || jsTest.options().storageEngine === "wiredTiger") {
    var baseDir = "jstests_split_c_and_i";

    var dbpath = MongoRunner.dataPath + baseDir + "/";

    var m = MongoRunner.runMongod({
        dbpath: dbpath,
        wiredTigerDirectoryForIndexes: ''});
    db = m.getDB( "foo" );
    db.bar.insert( { x : 1 } );
    assert.eq( 1, db.bar.count() );

    db.adminCommand( {fsync:1} );

    assert( listFiles( dbpath + "/index" ).length > 0 );
    assert( listFiles( dbpath + "/collection" ).length > 0 );

    MongoRunner.stopMongod(m.port);

    // Subsequent attempts to start server using same dbpath but different
    // wiredTigerDirectoryForIndexes and directoryperdb options should fail.
    assert.isnull(MongoRunner.runMongod({
        dbpath: dbpath,
        restart: true}));
    assert.isnull(MongoRunner.runMongod({
        dbpath: dbpath,
        restart: true,
        directoryperdb: ''}));
    assert.isnull(MongoRunner.runMongod({
        dbpath: dbpath,
        restart: true,
        wiredTigerDirectoryForIndexes: '',
        directoryperdb: ''}));
}