buffer.c:gwbuf_make_contiguous: hint wasn't duplicated to new GWBUF struct. As a result hints were lost if query rewriting resulted in longer query than the original.
This commit is contained in:
VilhoRaatikka
2014-10-23 21:03:58 +03:00
parent b320b4df43
commit 42b52c6f51
2 changed files with 4 additions and 2 deletions

View File

@ -569,7 +569,8 @@ int len;
if ((newbuf = gwbuf_alloc(gwbuf_length(orig))) != NULL) if ((newbuf = gwbuf_alloc(gwbuf_length(orig))) != NULL)
{ {
gwbuf_type_t buftype = orig->gwbuf_type; newbuf->gwbuf_type = orig->gwbuf_type;
newbuf->hint = hint_dup(orig->hint);
ptr = GWBUF_DATA(newbuf); ptr = GWBUF_DATA(newbuf);
while (orig) while (orig)
@ -579,7 +580,6 @@ int len;
ptr += len; ptr += len;
orig = gwbuf_consume(orig, len); orig = gwbuf_consume(orig, len);
} }
newbuf->gwbuf_type = buftype;
} }
return newbuf; return newbuf;
} }

View File

@ -38,6 +38,8 @@
* *
* @param hint The hint list to duplicate * @param hint The hint list to duplicate
* @return A duplicate of the list * @return A duplicate of the list
*
* Note : Optimize this to use version numbering instead of copying memory
*/ */
HINT * HINT *
hint_dup(HINT *hint) hint_dup(HINT *hint)