mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
Revert "Revert "replace shelling out w/ pymongo calls in smoke.py""
This reverts commit 465566855d
.
This commit is contained in:
parent
465566855d
commit
0920dbf991
@ -49,6 +49,8 @@ from subprocess import (Popen,
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
from pymongo import Connection
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
|
|
||||||
# TODO clean this up so we don't need globals...
|
# TODO clean this up so we don't need globals...
|
||||||
@ -159,11 +161,12 @@ class mongod(object):
|
|||||||
raise Exception("Failed to start mongod")
|
raise Exception("Failed to start mongod")
|
||||||
|
|
||||||
if self.slave:
|
if self.slave:
|
||||||
while True:
|
local = Connection(port=self.port).local
|
||||||
argv = [shell_executable, "--port", str(self.port), "--quiet", "--eval", 'db.printSlaveReplicationInfo()']
|
synced = False
|
||||||
res = Popen(argv, stdout=PIPE).communicate()[0]
|
while not synced:
|
||||||
if res.find('initial sync') < 0:
|
synced = True
|
||||||
break
|
for source in local.sources.find(fields=["syncedTo"]):
|
||||||
|
synced = synced and "syncedTo" in source and source["syncedTo"]
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
if not self.proc:
|
if not self.proc:
|
||||||
@ -211,17 +214,12 @@ def check_db_hashes(master, slave):
|
|||||||
if not slave.slave:
|
if not slave.slave:
|
||||||
raise(Bug("slave instance doesn't have slave attribute set"))
|
raise(Bug("slave instance doesn't have slave attribute set"))
|
||||||
|
|
||||||
print "waiting for slave to catch up..."
|
print "waiting for slave to catch up, result:"
|
||||||
argv = [shell_executable, "--port", str(master.port), "--quiet", "--eval", 'db.smokeWait.insert( {} ); printjson( db.getLastErrorCmd(2, 120000) );']
|
print Connection(port=master.port).test.smokeWait.insert({}, w=2, wtimeout=120000)
|
||||||
res = Popen(argv, stdout=PIPE).communicate()
|
|
||||||
print "wait result: " + str( res[0] ) + "\t" + str( res[1] )
|
|
||||||
|
|
||||||
# FIXME: maybe make this run dbhash on all databases?
|
# FIXME: maybe make this run dbhash on all databases?
|
||||||
for mongod in [master, slave]:
|
for mongod in [master, slave]:
|
||||||
argv = [shell_executable, "--port", str(mongod.port), "--quiet", "--eval", "x=db.runCommand('dbhash'); printjson(x.collections)"]
|
mongod.dict = Connection(port=mongod.port).test.command("dbhash")["collections"]
|
||||||
hashstr = Popen(argv, stdout=PIPE).communicate()[0]
|
|
||||||
# WARNING FIXME KLUDGE et al.: this is sleazy and unsafe.
|
|
||||||
mongod.dict = eval(hashstr)
|
|
||||||
|
|
||||||
global lost_in_slave, lost_in_master, screwy_in_slave, replicated_dbs
|
global lost_in_slave, lost_in_master, screwy_in_slave, replicated_dbs
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user