Skip to content

Commit

Permalink
out_azure_blob: fixed blob endpoint tracking
Browse files Browse the repository at this point in the history
Signed-off-by: Leonardo Alminana <[email protected]>
  • Loading branch information
leonardo-albertovich authored and edsiper committed Oct 17, 2024
1 parent cbfc240 commit 30eb89e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions plugins/out_azure_blob/azure_blob.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,8 @@ static int process_blob_chunk(struct flb_azure_blob *ctx, struct flb_event_chunk
continue;
}

ret = azb_db_file_insert(ctx, source, ctx->endpoint, file_path, file_size);
ret = azb_db_file_insert(ctx, source, ctx->real_endpoint, file_path, file_size);

if (ret == -1) {
flb_plg_error(ctx->ins, "cannot insert blob file into database: %s (size=%lu)",
file_path, file_size);
Expand Down Expand Up @@ -893,10 +894,13 @@ static void cb_azb_blob_file_upload(struct flb_config *config, void *out_context
/* just continue, the row info was retrieved */
}

if (strcmp(file_destination, ctx->endpoint) != 0) {

if (strcmp(file_destination, ctx->real_endpoint) != 0) {
flb_plg_info(ctx->ins,
"endpoint change detected, restarting file : %s",
file_path);
"endpoint change detected, restarting file : %s\n%s\n%s",
file_path,
file_destination,
ctx->real_endpoint);

info->active_upload = FLB_FALSE;

Expand Down
2 changes: 1 addition & 1 deletion plugins/out_azure_blob/azure_blob_db.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ int azb_db_file_part_get_next(struct flb_azure_blob *ctx,
*part_delivery_attempts = sqlite3_column_int64(ctx->stmt_get_next_file_part, 5);
tmp = (char *) sqlite3_column_text(ctx->stmt_get_next_file_part, 6);
*file_delivery_attempts = sqlite3_column_int64(ctx->stmt_get_next_file_part, 7);
tmp_destination = (char *) sqlite3_column_text(ctx->stmt_get_next_file_part, 8);
tmp_destination = (char *) sqlite3_column_text(ctx->stmt_get_next_file_part, 9);
}
else if (ret == SQLITE_DONE) {
/* no records */
Expand Down

0 comments on commit 30eb89e

Please sign in to comment.