Commit 5c8b67f8 authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Work on print out of transaction statements.

Document and be consistent about how log statements are printed.

Make the dispatch-reported data be of struct VSL_transactions, and
move the transaction metadata there.

Add a verbose option.
parent ddced7a2
......@@ -95,7 +95,7 @@ main(int argc, char * const *argv)
vsm = VSM_New();
AN(vsm);
while ((optchar = getopt(argc, argv, "dg:n:r:")) != -1) {
while ((optchar = getopt(argc, argv, "dg:n:r:v")) != -1) {
switch (optchar) {
case 'd':
d_opt = 1;
......@@ -113,7 +113,8 @@ main(int argc, char * const *argv)
r_arg = optarg;
break;
default:
usage();
if (!VSL_Arg(vsl, optchar, optarg))
usage();
}
}
......@@ -165,7 +166,7 @@ main(int argc, char * const *argv)
AZ(c);
}
i = VSLQ_Dispatch(q, VSL_PrintSet, stdout);
i = VSLQ_Dispatch(q, VSL_PrintTransactions, stdout);
if (i == 0) {
/* Nothing to do but wait */
VTIM_sleep(0.01);
......@@ -174,7 +175,7 @@ main(int argc, char * const *argv)
break;
} else if (i <= -2) {
/* XXX: Make continuation optional */
VSLQ_Flush(q, VSL_PrintSet, stdout);
VSLQ_Flush(q, VSL_PrintTransactions, stdout);
VSLQ_Delete(&q);
AZ(q);
if (i == -2) {
......@@ -191,7 +192,7 @@ main(int argc, char * const *argv)
}
if (q != NULL) {
VSLQ_Flush(q, VSL_PrintSet, stdout);
VSLQ_Flush(q, VSL_PrintTransactions, stdout);
VSLQ_Delete(&q);
AZ(q);
}
......
......@@ -59,16 +59,22 @@ struct VSLC_ptr {
struct VSL_cursor {
/* The record this cursor points to */
struct VSLC_ptr rec;
};
/* If not -1, the vxid of all records in this set */
int32_t vxid;
/* For set cursors, the depth level of these records */
unsigned level;
enum VSL_transaction_e {
VSL_t_unknown,
VSL_t_sess,
VSL_t_req,
VSL_t_esireq,
VSL_t_bereq,
VSL_t_raw,
};
/* Nonzero if pointer values from this cursor are still valid
after next call to VSL_Next */
unsigned shmptr_ok;
struct VSL_transaction {
unsigned level;
int32_t vxid;
enum VSL_transaction_e type;
struct VSL_cursor *c;
};
enum VSL_grouping_e {
......@@ -192,11 +198,13 @@ int VSL_Match(struct VSL_data *vsl, const struct VSL_cursor *c);
* 0: No match
*/
int VSL_PrintVXID(struct VSL_data *vsl, const struct VSL_cursor *c, void *fo);
int VSL_Print(struct VSL_data *vsl, const struct VSL_cursor *c, void *fo);
/*
* Print the log record pointed to by cursor to stream.
*
* Format: <vxid> <tag> <type> <data>
* Format: (t=type)
* 1234567890 12345678901234 1 ...
* vxid tag t content
*
* Arguments:
* vsl: The VSL_data context
......@@ -208,11 +216,13 @@ int VSL_PrintVXID(struct VSL_data *vsl, const struct VSL_cursor *c, void *fo);
* -5: I/O write error - see errno
*/
int VSL_PrintLevel(struct VSL_data *vsl, const struct VSL_cursor *c, void *fo);
int VSL_PrintTerse(struct VSL_data *vsl, const struct VSL_cursor *c, void *fo);
/*
* Print the log record pointed to by cursor to stream.
*
* Format: <level> <tag> <type> <data>
* Format:
* 12345678901234 ...
* tag content
*
* Arguments:
* vsl: The VSL_data context
......@@ -227,10 +237,7 @@ int VSL_PrintLevel(struct VSL_data *vsl, const struct VSL_cursor *c, void *fo);
int VSL_PrintAll(struct VSL_data *vsl, struct VSL_cursor *c, void *fo);
/*
* Calls VSL_Next on c until c is exhausted. In turn calls
* prints all records where VSL_Match returns true.
*
* If c->vxid == -1, calls VSL_PrintVXID on each record. Else
* prints a VXID header and calls VSL_PrintLevel on each record.
* VSL_Print on all records where VSL_Match returns true.
*
* Arguments:
* vsl: The VSL_data context
......@@ -242,11 +249,14 @@ int VSL_PrintAll(struct VSL_data *vsl, struct VSL_cursor *c, void *fo);
* !=0: Return value from either VSL_Next or VSL_Print
*/
int VSL_PrintSet(struct VSL_data *vsl, struct VSL_cursor *cp[], void *fo);
int VSL_PrintTransactions(struct VSL_data *vsl,
struct VSL_transaction *ptrans[], void *fo);
/*
* Calls VSL_PrintAll on each cursor in cp[]. If any cursor in cp
* has vxid != -1 it will end with a double line break as a set
* delimeter.
* Prints out each transaction in the array ptrans. For
* transactions of level > 0 it will print a header before the log
* records. The records will for level == 0 (single records) or if
* v_opt is set, be printed by VSL_Print. Else VSL_PrintTerse is
* used.
*
* Arguments:
* vsl: The VSL_data context
......@@ -255,7 +265,7 @@ int VSL_PrintSet(struct VSL_data *vsl, struct VSL_cursor *cp[], void *fo);
*
* Return values:
* 0: OK
* !=0: Return value from either VSL_Next or VSL_PrintAll
* !=0: Return value from either VSL_Next or VSL_Print
*/
struct VSLQ *VSLQ_New(struct VSL_data *vsl, struct VSL_cursor **cp,
......@@ -280,16 +290,15 @@ void VSLQ_Delete(struct VSLQ **pvslq);
* Delete the query pointed to by pvslq, freeing up the resources
*/
typedef int VSLQ_dispatch_f(struct VSL_data *vsl, struct VSL_cursor *cp[],
void *priv);
typedef int VSLQ_dispatch_f(struct VSL_data *vsl,
struct VSL_transaction *trans[], void *priv);
/*
* The callback function type for use with VSLQ_Dispatch.
*
* Arguments:
* vsl: The VSL_data context
* cp[]: A NULL terminated array of pointer to cursors. Each cursor
* will iterate over the log records of a single VXID
* priv: The priv argument from VSL_Dispatch
* vsl: The VSL_data context
* trans[]: A NULL terminated array of pointers to VSL_transaction.
* priv: The priv argument from VSL_Dispatch
*
* Return value:
* 0: OK - continue
......
......@@ -102,10 +102,10 @@ LIBVARNISHAPI_1.3 {
VSL_DeleteCursor;
VSL_Next;
VSL_Match;
VSL_PrintVXID;
VSL_PrintLevel;
VSL_Print;
VSL_PrintTerse;
VSL_PrintAll;
VSL_PrintSet;
VSL_PrintTransactions;
VSLQ_New;
VSLQ_Delete;
VSLQ_Dispatch;
......
......@@ -154,15 +154,30 @@ VSL_Match(struct VSL_data *vsl, const struct VSL_cursor *c)
return (1);
}
const char *VSL_transactions[256] = {
/* 12345678901234 */
[VSL_t_unknown] = "<< Unknown >>",
[VSL_t_sess] = "<< Session >>",
[VSL_t_req] = "<< Request >>",
[VSL_t_esireq] = "<< ESI-req >>",
[VSL_t_bereq] = "<< BeReq >>",
[VSL_t_raw] = "<< Record >>",
};
#define VSL_PRINT(...) \
do { \
if (0 > fprintf(__VA_ARGS__)) \
return (-5); \
} while (0)
int
VSL_PrintVXID(struct VSL_data *vsl, const struct VSL_cursor *c, void *fo)
VSL_Print(struct VSL_data *vsl, const struct VSL_cursor *c, void *fo)
{
enum VSL_tag_e tag;
uint32_t vxid;
unsigned len;
const char *data;
int type;
int i;
CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC);
if (c == NULL || c->rec.ptr == NULL)
......@@ -177,76 +192,51 @@ VSL_PrintVXID(struct VSL_data *vsl, const struct VSL_cursor *c, void *fo)
data = VSL_CDATA(c->rec.ptr);
if (tag == SLT_Debug) {
i = fprintf(fo, "%10u %-15s %c \"", vxid, VSL_tags[tag], type);
if (i < 0)
return (-5);
VSL_PRINT(fo, "%10u %-14s %c \"", vxid, VSL_tags[tag], type);
while (len-- > 0) {
if (*data >= ' ' && *data <= '~')
i = fprintf(fo, "%c", *data);
VSL_PRINT(fo, "%c", *data);
else
i = fprintf(fo, "%%%02x", (unsigned char)*data);
if (i < 0)
return (-5);
VSL_PRINT(fo, "%%%02x", (unsigned char)*data);
data++;
}
i = fprintf(fo, "\"\n");
if (i < 0)
return (-5);
return (0);
}
VSL_PRINT(fo, "\"\n");
} else
VSL_PRINT(fo, "%10u %-14s %c %.*s\n", vxid, VSL_tags[tag],
type, (int)len, data);
i = fprintf(fo, "%10u %-15s %c %.*s\n",
vxid, VSL_tags[tag], type, (int)len, data);
if (i < 0)
return (-5);
return (0);
}
int
VSL_PrintLevel(struct VSL_data *vsl, const struct VSL_cursor *c, void *fo)
VSL_PrintTerse(struct VSL_data *vsl, const struct VSL_cursor *c, void *fo)
{
enum VSL_tag_e tag;
unsigned len, lvl;
unsigned len;
const char *data;
int type;
int i;
CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC);
if (c == NULL || c->rec.ptr == NULL)
return (0);
if (fo == NULL)
fo = stdout;
tag = VSL_TAG(c->rec.ptr);
len = VSL_LEN(c->rec.ptr);
type = VSL_CLIENT(c->rec.ptr) ? 'c' : VSL_BACKEND(c->rec.ptr) ?
'b' : '-';
data = VSL_CDATA(c->rec.ptr);
lvl = c->level;
if (tag == SLT_Debug) {
i = fprintf(fo, "%2u %-15s %c \"", lvl, VSL_tags[tag],
type);
if (i < 0)
return (-5);
VSL_PRINT(fo, "%-14s \"", VSL_tags[tag]);
while (len-- > 0) {
if (*data >= ' ' && *data <= '~')
i = fprintf(fo, "%c", *data);
VSL_PRINT(fo, "%c", *data);
else
i = fprintf(fo, "%%%02x",
(unsigned char)*data);
if (i < 0)
return (-5);
VSL_PRINT(fo, "%%%02x", (unsigned char)*data);
data++;
}
i = fprintf(fo, "\"\n");
if (i < 0)
return (-5);
return (0);
}
i = fprintf(fo, "%2u %-15s %c %.*s\n",
lvl, VSL_tags[tag], type, (int)len, data);
if (i < 0)
return (-5);
VSL_PRINT(fo, "\"\n");
} else
VSL_PRINT(fo, "%-14s %.*s\n", VSL_tags[tag], (int)len, data);
return (0);
}
......@@ -257,46 +247,76 @@ VSL_PrintAll(struct VSL_data *vsl, struct VSL_cursor *c, void *fo)
if (c == NULL)
return (0);
if (c->vxid >= 0) {
i = fprintf(fo, "vv VXID: %11u vv\n", c->vxid);
if (i < 0)
return (-5);
}
while (1) {
i = VSL_Next(c);
if (i <= 0)
return (i);
if (!VSL_Match(vsl, c))
continue;
if (c->vxid < 0)
i = VSL_PrintVXID(vsl, c, fo);
else
i = VSL_PrintLevel(vsl, c, fo);
i = VSL_Print(vsl, c, fo);
if (i != 0)
return (i);
}
}
int
VSL_PrintSet(struct VSL_data *vsl, struct VSL_cursor *cp[], void *fo)
VSL_PrintTransactions(struct VSL_data *vsl, struct VSL_transaction *pt[],
void *fo)
{
struct VSL_transaction *t;
int i;
int delim = 0;
struct VSL_cursor *c;
int verbose;
(void)vsl;
if (pt[0] == NULL)
return (0);
t = pt[0];
while (t) {
verbose = 0;
if (t->level == 0 || vsl->v_opt)
verbose = 1;
c = cp[0];
while (c) {
if (c->vxid >= 0)
if (t->level) {
/* Print header */
if (t->level > 3)
VSL_PRINT(fo, "*%1.1u* ", t->level);
else
VSL_PRINT(fo, "%-3.*s ", t->level, "***");
VSL_PRINT(fo, "%*.s%-14s %*.s%-10u\n",
verbose ? 10 + 1 : 0, " ",
VSL_transactions[t->type],
verbose ? 1 + 1 : 0, " ",
t->vxid);
delim = 1;
i = VSL_PrintAll(vsl, c, fo);
if (i)
return (i);
c = *++cp;
}
if (delim) {
i = fprintf(fo, "\n");
if (i < 0)
return (-5);
}
while (1) {
/* Print records */
i = VSL_Next(t->c);
if (i < 0)
return (i);
if (i == 0)
break;
if (!VSL_Match(vsl, t->c))
continue;
if (t->level > 3)
VSL_PRINT(fo, "-%1.1u- ", t->level);
else if (t->level)
VSL_PRINT(fo, "%-3.*s ", t->level, "---");
if (verbose)
i = VSL_Print(vsl, t->c, fo);
else
i = VSL_PrintTerse(vsl, t->c, fo);
if (i != 0)
return (i);
}
t = *++pt;
}
if (delim)
VSL_PRINT(fo, "\n");;
return (0);
}
......@@ -80,6 +80,8 @@ struct VSL_data {
/* Bitmaps of -ix selected tags */
struct vbitmap *vbm_select;
struct vbitmap *vbm_supress;
int v_opt;
};
/* vsl_query.c */
......@@ -87,4 +89,4 @@ struct vslq_query;
struct vslq_query *vslq_newquery(struct VSL_data *vsl,
enum VSL_grouping_e grouping, const char *query);
void vslq_deletequery(struct vslq_query **pquery);
int vslq_runquery(struct vslq_query *query, struct VSL_cursor *cp[]);
int vslq_runquery(struct vslq_query *query, struct VSL_transaction *ptrans[]);
......@@ -131,6 +131,7 @@ VSL_Arg(struct VSL_data *vsl, int opt, const char *arg)
{
switch (opt) {
case 'i': case'x': return (vsl_ix_arg(vsl, opt, arg));
case 'v': vsl->v_opt = 1; return (1);
default:
return (0);
}
......
......@@ -250,8 +250,6 @@ VSL_CursorVSM(struct VSL_data *vsl, struct VSM_data *vsm, int tail)
vsl_diag(vsl, "Out of memory\n");
return (NULL);
}
c->c.c.vxid = -1; /* N/A to this cursor type */
c->c.c.shmptr_ok = 1;
c->c.magic = VSLC_MAGIC;
c->c.tbl = & vslc_vsm_tbl;
......@@ -409,7 +407,6 @@ VSL_CursorFile(struct VSL_data *vsl, const char *name)
vsl_diag(vsl, "Out of memory\n");
return (NULL);
}
c->c.c.vxid = -1; /* N/A to this cursor type */
c->c.magic = VSLC_MAGIC;
c->c.tbl = &vslc_file_tbl;
......
......@@ -50,21 +50,6 @@
struct vtx;
enum vtx_type_e {
vtx_t_unknown,
vtx_t_sess,
vtx_t_req,
vtx_t_esireq,
vtx_t_bereq,
};
enum vtx_link_e {
vtx_l_sess,
vtx_l_req,
vtx_l_esireq,
vtx_l_bereq,
};
struct vslc_raw {
struct vslc c;
unsigned magic;
......@@ -111,7 +96,7 @@ struct vtx {
#define VTX_F_COMPLETE 0x1
#define VTX_F_READY 0x2
enum vtx_type_e type;
enum VSL_transaction_e type;
struct vtx *parent;
VTAILQ_HEAD(,vtx) child;
......@@ -307,7 +292,7 @@ vtx_new(struct VSLQ *vslq)
vtx->key.vxid = 0;
vtx->t_start = VTIM_mono();
vtx->flags = 0;
vtx->type = vtx_t_unknown;
vtx->type = VSL_t_unknown;
vtx->parent = NULL;
VTAILQ_INIT(&vtx->child);
vtx->n_child = 0;
......@@ -399,7 +384,6 @@ vtx_lori(struct VSLQ *vslq, unsigned vxid)
vtx = vtx_new(vslq);
AN(vtx);
vtx->key.vxid = vxid;
vtx->c.c.c.vxid = vxid;
AZ(VRB_INSERT(vtx_tree, &vslq->tree, &vtx->key));
return (vtx);
}
......@@ -486,7 +470,7 @@ vtx_check_ready(struct VSLQ *vslq, struct vtx *vtx)
AN(vtx->flags & VTX_F_COMPLETE);
AZ(vtx->flags & VTX_F_READY);
if (vtx->type == vtx_t_unknown)
if (vtx->type == VSL_t_unknown)
vtx_diag(vtx, "vtx of unknown type marked complete");
ready = vtx;
......@@ -511,14 +495,14 @@ vtx_check_ready(struct VSLQ *vslq, struct vtx *vtx)
}
static int
vtx_parsetag_bl(const char *str, unsigned strlen, enum vtx_type_e *ptype,
vtx_parsetag_bl(const char *str, unsigned strlen, enum VSL_transaction_e *ptype,
unsigned *pvxid)
{
char ibuf[strlen + 1];
char tbuf[7];
unsigned vxid;
int i;
enum vtx_type_e type = vtx_t_unknown;
enum VSL_transaction_e type = VSL_t_unknown;
AN(str);
memcpy(ibuf, str, strlen);
......@@ -527,13 +511,13 @@ vtx_parsetag_bl(const char *str, unsigned strlen, enum vtx_type_e *ptype,
if (i < 1)
return (-1);
if (!strcmp(tbuf, "sess"))
type = vtx_t_sess;
type = VSL_t_sess;
else if (!strcmp(tbuf, "req"))
type = vtx_t_req;
type = VSL_t_req;
else if (!strcmp(tbuf, "esireq"))
type = vtx_t_esireq;
type = VSL_t_esireq;
else if (!strcmp(tbuf, "bereq"))
type = vtx_t_bereq;
type = VSL_t_bereq;
else
return (-1);
if (i == 1)
......@@ -564,7 +548,7 @@ static int
vtx_scan_begintag(struct VSLQ *vslq, struct vtx *vtx, const uint32_t *ptr)
{
int i;
enum vtx_type_e type;
enum VSL_transaction_e type;
unsigned p_vxid;
struct vtx *p_vtx;
......@@ -578,8 +562,8 @@ vtx_scan_begintag(struct VSLQ *vslq, struct vtx *vtx, const uint32_t *ptr)
return (vtx_diag_tag(vtx, ptr, "parse error"));
/* Check/set vtx type */
assert(type != vtx_t_unknown);
if (vtx->type != vtx_t_unknown && vtx->type != type)
assert(type != VSL_t_unknown);
if (vtx->type != VSL_t_unknown && vtx->type != type)
return (vtx_diag_tag(vtx, ptr, "type mismatch"));
vtx->type = type;
......@@ -588,7 +572,7 @@ vtx_scan_begintag(struct VSLQ *vslq, struct vtx *vtx, const uint32_t *ptr)
if (vslq->grouping == VSL_g_vxid)
return (0); /* No links */
if (vslq->grouping == VSL_g_request && vtx->type == vtx_t_req)
if (vslq->grouping == VSL_g_request && vtx->type == VSL_t_req)
return (0); /* No links */
/* Lookup and check parent vtx */
......@@ -612,7 +596,7 @@ static int
vtx_scan_linktag(struct VSLQ *vslq, struct vtx *vtx, const uint32_t *ptr)
{
int i;
enum vtx_type_e c_type;
enum VSL_transaction_e c_type;
unsigned c_vxid;
struct vtx *c_vtx;
......@@ -628,7 +612,7 @@ vtx_scan_linktag(struct VSLQ *vslq, struct vtx *vtx, const uint32_t *ptr)
if (vslq->grouping == VSL_g_vxid)
return (0); /* No links */
if (vslq->grouping == VSL_g_request && vtx->type == vtx_t_sess)
if (vslq->grouping == VSL_g_request && vtx->type == VSL_t_sess)
return (0); /* No links */
/* Lookup and check child vtx */
......@@ -641,7 +625,7 @@ vtx_scan_linktag(struct VSLQ *vslq, struct vtx *vtx, const uint32_t *ptr)
return (vtx_diag_tag(vtx, ptr, "duplicate link"));
if (c_vtx->flags & VTX_F_READY)
return (vtx_diag_tag(vtx, ptr, "link too late"));
if (c_vtx->type != vtx_t_unknown && c_vtx->type != c_type)
if (c_vtx->type != VSL_t_unknown && c_vtx->type != c_type)
return (vtx_diag_tag(vtx, ptr, "type mismatch"));
c_vtx->type = c_type;
......@@ -669,7 +653,7 @@ vtx_scan(struct VSLQ *vslq, struct vtx *vtx)
continue;
}
if (vtx->type == vtx_t_unknown && tag != SLT_Begin)
if (vtx->type == VSL_t_unknown && tag != SLT_Begin)
vtx_diag_tag(vtx, ptr, "early log rec");
switch (tag) {
......@@ -719,7 +703,9 @@ vslq_callback(struct VSLQ *vslq, struct vtx *vtx, VSLQ_dispatch_f *func,
void *priv)
{
unsigned n = vtx->n_descend + 1;
struct vslc_vtx *cp[n + 1];
struct VSL_transaction trans[n];
struct VSL_transaction *ptrans[n + 1];
struct vslc_vtx *c;
unsigned i, j;
AN(vslq);
......@@ -728,40 +714,46 @@ vslq_callback(struct VSLQ *vslq, struct vtx *vtx, VSLQ_dispatch_f *func,
if (func == NULL)
return (0);
if (vslq->grouping == VSL_g_session &&
vtx->type != vtx_t_sess)
vtx->type != VSL_t_sess)
return (0);
if (vslq->grouping == VSL_g_request &&
vtx->type != vtx_t_req)
vtx->type != VSL_t_req)
return (0);
/* Build cursor array */
i = j = 0;
cp[i] = &vtx->c;
vslc_vtx_reset(cp[i]);
cp[i]->c.c.level = 0;
i++;
/* Build transaction array */
vslc_vtx_reset(&vtx->c);
trans[0].level = 1;
trans[0].vxid = vtx->key.vxid;
trans[0].type = vtx->type;
trans[0].c = &vtx->c.c.c;
i = 1;
j = 0;
while (j < i) {
vtx = VTAILQ_FIRST(&cp[j]->vtx->child);
while (vtx) {
CAST_OBJ_NOTNULL(c, (void *)trans[j].c, VSLC_VTX_MAGIC);
VTAILQ_FOREACH(vtx, &c->vtx->child, list_child) {
assert(i < n);
cp[i] = &vtx->c;
vslc_vtx_reset(cp[i]);
cp[i]->c.c.level = cp[j]->c.c.level + 1;
vslc_vtx_reset(&vtx->c);
trans[i].level = trans[j].level + 1;
trans[i].vxid = vtx->key.vxid;
trans[i].type = vtx->type;
trans[i].c = &vtx->c.c.c;
i++;
vtx = VTAILQ_NEXT(vtx, list_child);
}
j++;
}
assert(i == n);
cp[i] = NULL;
/* Build pointer array */
for (i = 0; i < n; i++)
ptrans[i] = &trans[i];
ptrans[i] = NULL;
/* Query test goes here */
if (vslq->query != NULL &&
vslq_runquery(vslq->query, (struct VSL_cursor **)cp))
if (vslq->query != NULL && vslq_runquery(vslq->query, ptrans))
return (0);
/* Callback */
return ((func)(vslq->vsl, (struct VSL_cursor **)cp, priv));
return ((func)(vslq->vsl, ptrans, priv));
}
struct VSLQ *
......@@ -835,20 +827,23 @@ static int
vslq_raw(struct VSLQ *vslq, VSLQ_dispatch_f *func, void *priv)
{
struct vslc_raw rawc;
struct VSL_transaction trans;
struct VSL_transaction *ptrans[2];
struct VSL_cursor *c;
struct VSL_cursor *pc[2];
int i;
assert(vslq->grouping == VSL_g_raw);
c = vslq->c;
memset(&rawc, 0, sizeof rawc);
rawc.c.c.vxid = -1;
rawc.c.magic = VSLC_MAGIC;
rawc.c.tbl = &vslc_raw_tbl;
rawc.magic = VSLC_RAW_MAGIC;
pc[0] = &rawc.c.c;
pc[1] = NULL;
trans.level = 0;
trans.type = VSL_t_raw;
trans.c = &rawc.c.c;
ptrans[0] = &trans;
ptrans[1] = NULL;
while (1) {
i = VSL_Next(c);
......@@ -861,11 +856,14 @@ vslq_raw(struct VSLQ *vslq, VSLQ_dispatch_f *func, void *priv)
rawc.len = VSL_NEXT(c->rec.ptr) - c->rec.ptr;
rawc.next = rawc.start;
rawc.c.c.rec.ptr = NULL;
trans.vxid = VSL_ID(c->rec.ptr);
/* Query check goes here */
i = 0;
if (vslq->query == NULL ? 1 : vslq_runquery(vslq->query, pc))
i = (func)(vslq->vsl, pc, priv);
if (vslq->query != NULL && vslq_runquery(vslq->query, ptrans))
continue;
/* Callback */
i = (func)(vslq->vsl, ptrans, priv);
if (i)
break;
}
......
......@@ -88,8 +88,9 @@ vslq_deletequery(struct vslq_query **pquery)
}
int
vslq_runquery(struct vslq_query *query, struct VSL_cursor *cp[])
vslq_runquery(struct vslq_query *query, struct VSL_transaction *ptrans[])
{
struct VSL_transaction *t;
struct VSL_cursor *c;
int i, len;
const char *data;
......@@ -97,8 +98,9 @@ vslq_runquery(struct vslq_query *query, struct VSL_cursor *cp[])
CHECK_OBJ_NOTNULL(query, VSLQ_QUERY_MAGIC);
AN(query->regex);
c = cp[0];
while (c) {
t = ptrans[0];
while (t) {
c = t->c;
while (1) {
i = VSL_Next(c);
if (i == 0)
......@@ -115,7 +117,7 @@ vslq_runquery(struct vslq_query *query, struct VSL_cursor *cp[])
}
}
AZ(VSL_ResetCursor(c));
c = *++cp;
t = *++ptrans;
}
return (0);
......
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