Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:mongodb/mongo
- Loading branch information
Showing
226 changed files
with
6,947 additions
and
2,355 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import subprocess | ||
import os | ||
import sys | ||
from optparse import OptionParser | ||
|
||
""" This script aggregates several tracefiles into one tracefile | ||
All but the last argument are input tracefiles or .txt files which list tracefiles. | ||
The last argument is the tracefile to which the output will be written | ||
""" | ||
def aggregate(inputs, output): | ||
"""Aggregates the tracefiles given in inputs to a tracefile given by output""" | ||
args = ['lcov'] | ||
|
||
for name in inputs: | ||
args += ['-a', name] | ||
|
||
args += ['-o', output] | ||
|
||
print ' '.join(args) | ||
|
||
return subprocess.call(args) | ||
|
||
def getfilesize(path): | ||
if not os.path.isfile(path): | ||
return 0 | ||
return os.path.getsize(path) | ||
|
||
def main (): | ||
inputs = [] | ||
|
||
usage = "usage: %prog input1.info input2.info ... output.info" | ||
parser = OptionParser(usage=usage) | ||
|
||
(options, args) = parser.parse_args() | ||
if len(args) < 2: | ||
return "must supply input files" | ||
|
||
for path in args[:-1]: | ||
name, ext = os.path.splitext(path) | ||
|
||
if ext == '.info': | ||
if getfilesize(path) > 0: | ||
inputs.append(path) | ||
|
||
elif ext == '.txt': | ||
inputs += [line.strip() for line in open(path) | ||
if getfilesize(line.strip()) > 0] | ||
else: | ||
return "unrecognized file type" | ||
|
||
return aggregate(inputs, args[-1]) | ||
|
||
if __name__ == '__main__': | ||
sys.exit(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Providing the wrong number of fields in a pipeline stage specification triggers a parsing error. | ||
// SERVER-6861 | ||
|
||
t = db.jstests_server6861; | ||
t.drop(); | ||
|
||
t.save( { a:1 } ); | ||
|
||
function assertCode( code, expression ) { | ||
assert.eq( code, t.aggregate( expression ).code ); | ||
} | ||
|
||
function assertResult( result, expression ) { | ||
assert.eq( result, t.aggregate( expression ).result ); | ||
} | ||
|
||
// Correct number of fields. | ||
assertResult( [ { a:1 } ], { $project:{ _id:0, a:1 } } ); | ||
|
||
// Incorrect number of fields. | ||
assertCode( 16435, {} ); | ||
assertCode( 16435, { $project:{ _id:0, a:1 }, $group:{ _id:0 } } ); | ||
assertCode( 16435, { $project:{ _id:0, a:1 }, $group:{ _id:0 }, $sort:{ a:1 } } ); | ||
|
||
// Invalid stage specification. | ||
assertCode( 16436, { $noSuchStage:{ a:1 } } ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// The 'cursor not found in map -1' warning is not logged when get more exhausts a client cursor. | ||
// SERVER-6931 | ||
|
||
t = db.jstests_cursorb; | ||
t.drop(); | ||
|
||
// Exhaust a client cursor in get more. | ||
for( i = 0; i < 200; ++i ) { | ||
t.save( { a:i } ); | ||
} | ||
t.find().itcount(); | ||
|
||
// Check that the 'cursor not found in map -1' message is not printed. This message indicates an | ||
// attempt to look up a cursor with an invalid id and should never appear in the log. | ||
log = db.adminCommand( { getLog:'global' } ).log | ||
log.forEach( function( line ) { assert( !line.match( /cursor not found in map -1 / ), | ||
'Cursor map lookup with id -1.' ); } ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,40 @@ | ||
// Check the return value of a db.eval function running a database query, and ensure the function's | ||
// contents are logged in the profile log. | ||
|
||
t = db.evalb; | ||
t.drop(); | ||
// Use a reserved database name to avoid a conflict in the parallel test suite. | ||
var stddb = db; | ||
var db = db.getSisterDB( 'evalb' ); | ||
|
||
t.save( { x : 3 } ); | ||
function profileCursor() { | ||
return db.system.profile.find( { user:username } ); | ||
} | ||
|
||
assert.eq( 3, db.eval( function(){ return db.evalb.findOne().x; } ) , "A" ); | ||
function lastOp() { | ||
return profileCursor().sort( { $natural:-1 } ).next(); | ||
} | ||
|
||
db.setProfilingLevel( 2 ); | ||
try { | ||
|
||
assert.eq( 3, db.eval( function(){ return db.evalb.findOne().x; } ) , "B" ); | ||
username = 'jstests_evalb_user'; | ||
db.addUser( username, 'password', false, 1 ); | ||
db.auth( username, 'password' ); | ||
|
||
o = db.system.profile.find( { "command.$eval" : { $exists : true } } ).sort( { $natural : -1 } ).limit(1).next(); | ||
assert( tojson(o).indexOf( "findOne().x" ) > 0 , "C : " + tojson( o ) ) | ||
t = db.evalb; | ||
t.drop(); | ||
|
||
db.setProfilingLevel( 0 ); | ||
t.save( { x:3 } ); | ||
|
||
assert.eq( 3, db.eval( function() { return db.evalb.findOne().x; } ), 'A' ); | ||
|
||
db.setProfilingLevel( 2 ); | ||
|
||
assert.eq( 3, db.eval( function() { return db.evalb.findOne().x; } ), 'B' ); | ||
|
||
o = lastOp(); | ||
assert( tojson( o ).indexOf( 'findOne().x' ) > 0, 'C : ' + tojson( o ) ); | ||
} | ||
finally { | ||
|
||
db.setProfilingLevel(0); | ||
db = stddb; | ||
} |
Oops, something went wrong.