Skip to content

Commit

Permalink
in_tail: db: reset bindings after file insertion (fluent#2576)
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo Silva <[email protected]>
  • Loading branch information
edsiper authored and Magnus Sirviö committed Oct 7, 2020
1 parent a90f35e commit f3e04ba
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion plugins/in_tail/tail_db.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ struct flb_sqldb *flb_tail_db_open(const char *path,
}
}


ret = flb_sqldb_query(db, SQL_PRAGMA_JOURNAL_MODE, NULL, NULL);
if (ret != FLB_OK) {
flb_plg_error(ctx->ins, "db: could not set pragma 'journal_mode'");
Expand Down Expand Up @@ -143,11 +142,16 @@ static int db_file_insert(struct flb_tail_file *file, struct flb_tail_config *ct
/* Run the insert */
ret = sqlite3_step(ctx->stmt_insert_file);
if (ret != SQLITE_DONE) {
sqlite3_clear_bindings(ctx->stmt_insert_file);
sqlite3_reset(ctx->stmt_insert_file);
flb_plg_error(ctx->ins, "cannot execute insert file %s inode=%lu",
file->name, file->inode);
return -1;
}

sqlite3_clear_bindings(ctx->stmt_insert_file);
sqlite3_reset(ctx->stmt_insert_file);

/* Get the database ID for this file */
return flb_sqldb_last_id(ctx->db);
}
Expand Down

0 comments on commit f3e04ba

Please sign in to comment.