Fix queued query handling

If a routing of a queued query caused it to be put back on the query
queue, the order in which the queue was reorganized was wrong. The first
query would get appended as the last query which caused the order to be
reversed.
This commit is contained in:
Markus Mäkelä 2019-03-15 20:35:17 +02:00
parent 4697128b3c
commit fd21bed5aa
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -521,8 +521,10 @@ static bool route_stored_query(RWSplitSession *rses)
}
else
{
/** Routing was stopped, we need to wait for a response before retrying */
rses->query_queue = gwbuf_append(temp_storage, rses->query_queue);
/** Routing was stopped, we need to wait for a response before retrying.
* temp_storage holds the tail end of the queue and query_queue contains the query we attempted
* to route. Append temp_storage to query_queue to keep the order of the queries correct. */
rses->query_queue = gwbuf_append(rses->query_queue, temp_storage);
break;
}
}