odissey: minor refactoring of be reset function
@@ -322,11 +322,13 @@ int od_bereset(od_server_t *server)
OD_SRESET);
/* support route rollback off */
- if (server->is_transaction && !route->scheme->rollback) {
+ if (! route->scheme->rollback) {
+ if (server->is_transaction) {
od_debug(&pooler->od->log, server->io,
"S (reset): in active transaction, dropping");
goto drop;
}
+ }
/* support route cancel off */
if (! route->scheme->cancel) {
@@ -342,7 +344,7 @@ int od_bereset(od_server_t *server)
* Number of queries sent to server is not equal
* to the number of received replies.
*
- * Do following logic, until server becomes
+ * Do the following logic, until server becomes
* synchronized:
*
* 1. Wait each ReadyForQuery until we receive all
@@ -355,7 +357,7 @@ int od_bereset(od_server_t *server)
* may stall database on its own and may require
* additional Cancel request.
*
- * 3. continue with (1)
+ * 3. Continue with (1)
*/
int wait_timeout = 1000;
int wait_try = 0;
@@ -397,7 +399,8 @@ int od_bereset(od_server_t *server)
/* send rollback in case if server has an active
* transaction running */
- if (server->is_transaction && route->scheme->rollback) {
+ if (route->scheme->rollback) {
+ if (server->is_transaction) {
char query_rlb[] = "ROLLBACK";
rc = od_bequery(server, "reset rollback", query_rlb,
sizeof(query_rlb));
@@ -405,6 +408,7 @@ int od_bereset(od_server_t *server)
goto error;
assert(! server->is_transaction);
}
+ }
/* send reset query */
if (route->scheme->discard) {
