in_tail: add error handling to flb_tail_db_file_set()
We have a few bug reports regarding to this function. Evidently
the SQL query generation can be broken on certain cases, but
we don't uncover the exact condition yet.
This patch adds additional logging to failure paths, to help
future debugging.
@@ -109,6 +109,10 @@ int flb_tail_db_file_set(struct flb_tail_file *file,
memset(&qs, '\0', sizeof(qs));
ret = flb_sqldb_query(ctx->db,
query, cb_file_check, &qs);
+ if (ret == FLB_ERROR) {
+ flb_plg_error(ctx->ins, "cannot execute SQL: %s", query);
+ return -1;
+ }
if (qs.rows == 0) {
/* Register the file */
@@ -118,6 +122,7 @@ int flb_tail_db_file_set(struct flb_tail_file *file,
file->name, (uint64_t) 0, (uint64_t) file->inode, created);
ret = flb_sqldb_query(ctx->db, query, NULL, NULL);
if (ret == FLB_ERROR) {
+ flb_plg_error(ctx->ins, "cannot execute SQL: %s", query);
return -1;
}
