MXS-1066 Add query hint to route to last used server

Add new hint type and support for it in the readwritesplit router.
This commit is contained in:
Marko
2018-07-09 11:07:33 +03:00
parent e2fb0093b1
commit 2acf5f545e
8 changed files with 37 additions and 1 deletions

View File

@ -49,6 +49,7 @@ static struct
{ "master", TOK_MASTER},
{ "slave", TOK_SLAVE},
{ "server", TOK_SERVER},
{ "last" , TOK_LAST},
{ NULL, static_cast<TOKEN_VALUE>(0)}
};
@ -334,6 +335,12 @@ hint_parser(HINT_SESSION *session, GWBUF *request)
rval = hint_create_route(rval,
HINT_ROUTE_TO_SLAVE, NULL);
break;
case TOK_LAST:
rval = hint_create_route(rval,
HINT_ROUTE_TO_LAST_USED, NULL);
break;
case TOK_SERVER:
state = HS_ROUTE_SERVER;
break;

View File

@ -40,6 +40,7 @@ typedef enum
TOK_MASTER,
TOK_SLAVE,
TOK_SERVER,
TOK_LAST,
TOK_LINEBRK,
TOK_END
} TOKEN_VALUE;