Skip to content

Commit f75be93

Browse files
committed
testlatency.js
1 parent 1a59585 commit f75be93

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

replication/test_latency.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
*/
1212

1313
slave = db;
14-
assert(!slave.runCommand("ismaster").ismaster);
14+
if (slave.runCommand("ismaster").ismaster) {
15+
print("db from command line should be the slave -- and it isn't -- see comments in this .js file. exiting");
16+
quit();
17+
}
1518
print("slave ok");
1619

1720
master = new Mongo("localhost").getDB("test");
@@ -43,7 +46,7 @@ function latencytest() {
4346
slaveobj = t.findOne();
4447
if (slaveobj && slaveobj.y == obj.y)
4548
break;
46-
sleep(2); // wait 2 ms
49+
sleep(1);
4750
}
4851
}
4952

@@ -55,8 +58,8 @@ function run() {
5558
}
5659

5760
print();
58-
print("try running:");
59-
print(" ptime( function(){T.findOne()} )");
60-
print(" ptime( function(){t.findOne()} )");
61-
print(" run()");
61+
print("try running these:");
62+
print(" ptime( function(){T.findOne()} ) // should be quick as hits only 1 server");
63+
print(" ptime( function(){t.findOne()} ) // should be quick");
64+
print(" run() // takes a little time awaits full replication");
6265
print();

replication/tl.bat

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
mkdir \data\a
2+
mkdir \data\b
3+
start mongod --master --dbpath c:\data\a
4+
start mongod --slave --dbpath c:\data\b --port 27000 --source localhost
5+
mongo --shell localhost:27000 test_latency.js

vs2010/snippets/snippets.sln

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 11.00
3+
# Visual Studio 2010
4+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "replication", "replication", "{96D6995D-DBFC-4EBD-92F5-D9812F9C5B09}"
5+
ProjectSection(SolutionItems) = preProject
6+
..\..\replication\misc.js = ..\..\replication\misc.js
7+
..\..\replication\test_latency.js = ..\..\replication\test_latency.js
8+
..\..\replication\tl.bat = ..\..\replication\tl.bat
9+
EndProjectSection
10+
EndProject
11+
Global
12+
GlobalSection(SolutionProperties) = preSolution
13+
HideSolutionNode = FALSE
14+
EndGlobalSection
15+
EndGlobal

0 commit comments

Comments
 (0)