make rowcache a command line option instead of config file

This commit is contained in:
Sugu Sougoumarane 2013-07-08 14:08:44 -07:00
Родитель c5d9117f3a
Коммит 2b852dc7c7
4 изменённых файлов: 14 добавлений и 14 удалений

Просмотреть файл

@ -38,6 +38,7 @@ var (
authConfig = flag.String("auth-credentials", "", "name of file containing auth credentials")
configFile = flag.String("config", "", "config file name")
dbConfigFile = flag.String("dbconfig", "", "db config file name")
rowcache = flag.String("rowcache", "", "rowcache connection, host:port or /path/to/socket")
queryLog = flag.String("querylog", "", "for testing: log all queries to this file")
customrules = flag.String("customrules", "", "custom query rules file")
overridesFile = flag.String("schema-override", "", "schema overrides file")
@ -96,6 +97,7 @@ func main() {
relog.Info("config: %s\n", data)
unmarshalFile(*dbConfigFile, &dbconfig)
dbconfig.Memcache = *rowcache
relog.Info("dbconfig: %s\n", dbconfig)
unmarshalFile(*overridesFile, &schemaOverrides)

Просмотреть файл

@ -52,6 +52,7 @@ var (
tabletPath = flag.String("tablet-path", "", "path to zk node representing the tablet")
qsConfigFile = flag.String("queryserver-config-file", "", "config file name for the query service")
mycnfFile = flag.String("mycnf-file", "", "my.cnf file")
rowcache = flag.String("rowcache", "", "rowcache connection, host:port or /path/to/socket")
authConfig = flag.String("auth-credentials", "", "name of file containing auth credentials")
queryLog = flag.String("debug-querylog-file", "", "for testing: log all queries to this file")
customrules = flag.String("customrules", "", "custom query rules file")
@ -106,6 +107,7 @@ func main() {
if err != nil {
relog.Warning("%s", err)
}
dbcfgs.App.Memcache = *rowcache
if err := jscfg.ReadJson(*overridesFile, &schemaOverrides); err != nil {
relog.Warning("%s", err)

Просмотреть файл

@ -264,8 +264,6 @@ class VtoccTestEnv(TestEnv):
if res != 0:
raise Exception("Cannot create vt_test_keyspace database")
dbconfig = self.mysqldir+"/dbconf.json"
if utils.options.memcache:
memcache = self.mysqldir+"/memcache.sock"
with open(dbconfig, 'w') as f:
conf = {
'charset': 'utf8',
@ -276,8 +274,6 @@ class VtoccTestEnv(TestEnv):
'keyspace': 'test_keyspace',
'shard' : '0',
}
if utils.options.memcache:
conf['memcache'] = memcache
json.dump(conf, f)
self.mysql_conn = self.mysql_connect()
@ -307,8 +303,6 @@ class VtoccTestEnv(TestEnv):
schema_override = '/tmp/schema_override.json'
self.create_schema_override(schema_override)
if utils.options.memcache:
self.memcached = subprocess.Popen(["memcached", "-s", memcache])
occ_args = [
self.vtroot+"/bin/vtocc",
"-port", "9461",
@ -318,6 +312,11 @@ class VtoccTestEnv(TestEnv):
"-customrules", customrules,
"-schema-override", schema_override,
]
if utils.options.memcache:
memcache = self.mysqldir+"/memcache.sock"
self.memcached = subprocess.Popen(["memcached", "-s", memcache])
occ_args.extend(["-rowcache", memcache])
self.vtstderr = open("/tmp/vtocc_stderr.log", "a+")
self.vtocc = subprocess.Popen(occ_args, stderr=self.vtstderr)
for i in range(30):

Просмотреть файл

@ -245,8 +245,6 @@ class Tablet(object):
utils.prog_compile(['vtaction',
'vttablet',
])
if memcache:
self.start_memcache()
args = [os.path.join(utils.vtroot, 'bin', 'vttablet'),
'-port', '%s' % (port or self.port),
@ -255,6 +253,11 @@ class Tablet(object):
'-log.level', 'INFO',
'-db-configs-file', self._write_db_configs_file(repl_extra_flags),
'-debug-querylog-file', self.querylog_file]
if memcache:
self.start_memcache()
args.extend(['-rowcache', self.memcache_path])
if auth:
args.extend(['-auth-credentials', os.path.join(utils.vttop, 'test', 'test_data', 'authcredentials_test.json')])
@ -314,12 +317,6 @@ class Tablet(object):
config['repl'].update(repl_extra_flags)
path = os.path.join(self.tablet_dir, 'db-configs.json')
if self.memcached:
for d in config.values():
d['memcache'] = self.memcache_path
config['memcache'] = self.memcache_path
with open(path, 'w') as fi:
json.dump(config, fi)