pgsql: Speed up resync() again (using textonly-queries).

parent ac1503ee
......@@ -505,14 +505,7 @@ protected void _destruct() {
}
private .pgsql_util.Result textquery(string q) {
.pgsql_util.Result res;
#if 1
foreach (q / ";"; ; string sq)
res = big_query(sq);
#else // textqueries and portals do not mix well
res = big_query(q, (["_text":1]));
#endif
return res;
return big_query(q, (["_text":1]));
}
private void resyncdone() {
......@@ -521,11 +514,15 @@ private void resyncdone() {
}
private void reset_dbsession() {
proxy.statementsinflight->wait_till_drained();
error(1);
.pgsql_util.Result res
= textquery("ROLLBACK;RESET ALL;CLOSE ALL;DISCARD TEMP");
while (res->fetch_row());
mixed err = catch {
proxy.statementsinflight->wait_till_drained();
error(1);
.pgsql_util.Result res
= textquery("ROLLBACK;RESET ALL;CLOSE ALL;DISCARD TEMP");
while (res->fetch_row());
};
if (err && !proxy.delayederror)
proxy.delayederror = err;
resyncdone();
}
......
......@@ -910,7 +910,7 @@ class Result {
if (c = _c)
cr = c->i;
else
losterror();
losterror(LOSTERROR);
_query = query;
datarows = Thread.Queue();
_ddescribe = Thread.Condition();
......@@ -1029,11 +1029,11 @@ class Result {
return index;
}
private void losterror() {
string err;
private void losterror(void|string err) {
if (pgsqlsess)
err = pgsqlsess->geterror(1);
error("%s\n", err || LOSTERROR);
err = pgsqlsess->geterror(1) || err;
if (err)
error("%s\n", err);
}
private void trydelayederror() {
......@@ -2535,11 +2535,9 @@ class proxy {
msglen -= 4;
PD("NoData %O\n", portal._query);
#endif
if (!portal._forcetext) {
portal._fetchlimit = 0; // disables subsequent Executes
portal->_processrowdesc(({}), ({}));
portal = 0;
}
portal._fetchlimit = 0; // disables subsequent Executes
portal->_processrowdesc(({}), ({}));
portal = 0;
break;
}
case 'H':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment