diff --git a/server/modules/include/readwritesplit.h b/server/modules/include/readwritesplit.h index c8479cb11..30993ece6 100644 --- a/server/modules/include/readwritesplit.h +++ b/server/modules/include/readwritesplit.h @@ -50,6 +50,9 @@ typedef enum rses_property_type_t { RSES_PROP_TYPE_COUNT=RSES_PROP_TYPE_LAST+1 } rses_property_type_t; +/** default values for rwsplit configuration parameters */ +#define CONFIG_MAX_SLAVE_CONN 1 + /** * Session variable command */ diff --git a/server/modules/routing/readwritesplit/readwritesplit.c b/server/modules/routing/readwritesplit/readwritesplit.c index 96a7474a3..e17a78318 100644 --- a/server/modules/routing/readwritesplit/readwritesplit.c +++ b/server/modules/routing/readwritesplit/readwritesplit.c @@ -353,6 +353,12 @@ static ROUTER* createInstance( } } } + /** + * Set default value for max_slave_connections. + * If parameter is set in config file this setting will be overwritten. + */ + router->rwsplit_config.rw_max_slave_conn_count = CONFIG_MAX_SLAVE_CONN; + /** * Copy all config parameters from service to router instance. * Finally, copy version number to indicate that configs match. @@ -413,7 +419,7 @@ static void* newSession( #if defined(SS_DEBUG) client_rses->rses_chk_top = CHK_NUM_ROUTER_SES; client_rses->rses_chk_tail = CHK_NUM_ROUTER_SES; -#endif +#endif /** * If service config has been changed, reload config from service to * router instance first. diff --git a/server/modules/routing/test/makefile b/server/modules/routing/test/makefile new file mode 100644 index 000000000..039f2910e --- /dev/null +++ b/server/modules/routing/test/makefile @@ -0,0 +1,41 @@ +# cleantests - clean local and subdirectories' tests +# buildtests - build all local and subdirectories' tests +# runtests - run all local tests +# testall - clean, build and run local and subdirectories' tests + +include ../../../../build_gateway.inc +include $(ROOT_PATH)/makefile.inc +include $(ROOT_PATH)/test.inc + +CC=cc +TESTLOG := $(shell pwd)/testrouting.log +RET := -1 + +cleantests: + - $(DEL) *.o + - $(DEL) *~ + + +testall: + -$(MAKE) cleantests + -$(MAKE) DEBUG=Y buildtests + -$(MAKE) runtests + @echo "" >> $(TESTLOG) + @echo "-------------------------------" >> $(TESTLOG) + @echo $(shell date) >> $(TESTLOG) + @echo "Test Read/Write Split Router" >> $(TESTLOG) + $(MAKE) -C $(ROOT_PATH)/server/modules/routing/readwritesplit testall + + +buildtests: + $(MAKE) -C $(ROOT_PATH)/server/modules/routing/readwritesplit buildtests + + +runtests: + @echo "" > $(TESTLOG) + @echo "-------------------------------" >> $(TESTLOG) + @echo $(shell date) >> $(TESTLOG) + @echo "Test routing" >> $(TESTLOG) + @echo "-------------------------------" >> $(TESTLOG) + @echo "Nothing to run here so far" >> $(TESTLOG) + @cat $(TESTLOG) >> $(TEST_MAXSCALE_LOG)