-
Notifications
You must be signed in to change notification settings - Fork 1.8k
plugins: fix compilation if FLB_SQLDB (sqlite3) is disabled #10239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
945554d
2473ad3
b0540d2
a0bd3ed
1e40533
92a7a78
80cd590
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,6 @@ | |
| #include <fluent-bit/flb_config_map.h> | ||
| #include <fluent-bit/flb_gzip.h> | ||
| #include <fluent-bit/flb_base64.h> | ||
| #include <fluent-bit/flb_sqldb.h> | ||
| #include <fluent-bit/flb_input_blob.h> | ||
| #include <fluent-bit/flb_log_event_decoder.h> | ||
| #include <fluent-bit/flb_plugin.h> | ||
|
|
@@ -35,14 +34,17 @@ | |
| #include <msgpack.h> | ||
|
|
||
| #include "azure_blob.h" | ||
| #include "azure_blob_db.h" | ||
| #include "azure_blob_uri.h" | ||
| #include "azure_blob_conf.h" | ||
| #include "azure_blob_appendblob.h" | ||
| #include "azure_blob_blockblob.h" | ||
| #include "azure_blob_http.h" | ||
| #include "azure_blob_store.h" | ||
|
|
||
| #ifdef FLB_HAVE_SQLDB | ||
| #include "azure_blob_db.h" | ||
| #endif | ||
|
|
||
| #define CREATE_BLOB 1337 | ||
|
|
||
| /* thread_local_storage for workers */ | ||
|
|
@@ -248,6 +250,7 @@ static int create_blob(struct flb_azure_blob *ctx, char *name) | |
| return FLB_OK; | ||
| } | ||
|
|
||
| #ifdef FLB_HAVE_SQLDB | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this function wrapped by this conditional when it only executes an HTTP call? |
||
| static int delete_blob(struct flb_azure_blob *ctx, char *name) | ||
| { | ||
| int ret; | ||
|
|
@@ -322,6 +325,7 @@ static int delete_blob(struct flb_azure_blob *ctx, char *name) | |
| flb_upstream_conn_release(u_conn); | ||
| return FLB_OK; | ||
| } | ||
| #endif | ||
|
|
||
| static int http_send_blob(struct flb_config *config, struct flb_azure_blob *ctx, | ||
| flb_sds_t ref_name, | ||
|
|
@@ -488,16 +492,23 @@ static int send_blob(struct flb_config *config, | |
| if (!block_id) { | ||
| flb_plg_error(ctx->ins, "could not generate block id"); | ||
| flb_free(generated_random_string); | ||
| cfl_sds_destroy(ref_name); | ||
| flb_sds_destroy(ref_name); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is correct. |
||
| return FLB_RETRY; | ||
| } | ||
| uri = azb_block_blob_uri(ctx, tag, block_id, ms, generated_random_string); | ||
| ref_name = flb_sds_printf(&ref_name, "file=%s.%" PRIu64, name, ms); | ||
| } | ||
| else if (event_type == FLB_EVENT_TYPE_BLOBS) { | ||
| #ifdef FLB_HAVE_SQLDB | ||
| block_id = azb_block_blob_id_blob(ctx, name, part_id); | ||
| uri = azb_block_blob_uri(ctx, name, block_id, 0, generated_random_string); | ||
| ref_name = flb_sds_printf(&ref_name, "file=%s:%" PRIu64, name, part_id); | ||
| #else | ||
| flb_plg_error(ctx->ins, "FLB_EVENT_TYPE_BLOBS requires FLB_HAVE_SQLDB enabled at build time"); | ||
| flb_free(generated_random_string); | ||
| flb_sds_destroy(ref_name); | ||
| return FLB_ERROR; | ||
| #endif | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -772,6 +783,7 @@ static int cb_azure_blob_init(struct flb_output_instance *ins, | |
| return 0; | ||
| } | ||
|
|
||
| #ifdef FLB_HAVE_SQLDB | ||
| static int blob_chunk_register_parts(struct flb_azure_blob *ctx, uint64_t file_id, size_t total_size) | ||
| { | ||
| int ret; | ||
|
|
@@ -1171,6 +1183,7 @@ static int azb_timer_create(struct flb_azure_blob *ctx) | |
|
|
||
| return 0; | ||
| } | ||
| #endif | ||
|
|
||
| /** | ||
| * Azure Blob Storage ingestion callback function | ||
|
|
@@ -1660,6 +1673,7 @@ static void cb_azure_blob_flush(struct flb_event_chunk *event_chunk, | |
| } | ||
| } | ||
| else if (event_chunk->type == FLB_EVENT_TYPE_BLOBS) { | ||
| #ifdef FLB_HAVE_SQLDB | ||
| /* | ||
| * For Blob types, we use the flush callback to enqueue the file, then cb_azb_blob_file_upload() | ||
| * takes care of the rest like reading the file and uploading it to Azure. | ||
|
|
@@ -1668,6 +1682,9 @@ static void cb_azure_blob_flush(struct flb_event_chunk *event_chunk, | |
| if (ret == -1) { | ||
| FLB_OUTPUT_RETURN(FLB_RETRY); | ||
| } | ||
| #else | ||
| ret = FLB_ERROR; | ||
| #endif | ||
| } | ||
|
|
||
| if (json){ | ||
|
|
@@ -1728,11 +1745,13 @@ static int cb_worker_init(void *data, struct flb_config *config) | |
| FLB_TLS_SET(worker_info, info); | ||
| } | ||
|
|
||
| #ifdef FLB_HAVE_SQLDB | ||
| ret = azb_timer_create(ctx); | ||
| if (ret == -1) { | ||
| flb_plg_error(ctx->ins, "failed to create upload timer"); | ||
| return -1; | ||
| } | ||
| #endif | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,10 +20,14 @@ | |
| #include <fluent-bit/flb_output_plugin.h> | ||
| #include <fluent-bit/flb_base64.h> | ||
| #include <fluent-bit/flb_pack.h> | ||
| #include <fluent-bit/flb_utils.h> | ||
|
|
||
| #include "azure_blob.h" | ||
| #include "azure_blob_conf.h" | ||
|
|
||
| #ifdef FLB_HAVE_SQLDB | ||
| #include "azure_blob_db.h" | ||
| #endif | ||
|
|
||
| #include <sys/types.h> | ||
| #include <sys/stat.h> | ||
|
|
@@ -762,6 +766,7 @@ struct flb_azure_blob *flb_azure_blob_conf_create(struct flb_output_instance *in | |
| } | ||
| } | ||
|
|
||
| #ifdef FLB_HAVE_SQLDB | ||
| /* database file for blob signal handling */ | ||
| if (ctx->database_file) { | ||
| ctx->db = azb_db_open(ctx, ctx->database_file); | ||
|
|
@@ -771,6 +776,7 @@ struct flb_azure_blob *flb_azure_blob_conf_create(struct flb_output_instance *in | |
| } | ||
|
|
||
| pthread_mutex_init(&ctx->file_upload_commit_file_parts, NULL); | ||
| #endif | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This conditional should be one line before, even though
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See 6df3149, file_upload_commit_file_parts is excluded by FLB_HAVE_SQLDB. So it doesn't make sense to suddenly move it just for the purpose of initializing it. |
||
|
|
||
| flb_plg_info(ctx->ins, | ||
| "account_name=%s, container_name=%s, blob_type=%s, emulator_mode=%s, endpoint=%s, auth_type=%s", | ||
|
|
@@ -826,7 +832,9 @@ void flb_azure_blob_conf_destroy(struct flb_azure_blob *ctx) | |
| flb_upstream_destroy(ctx->u); | ||
| } | ||
|
|
||
|
|
||
| #ifdef FLB_HAVE_SQLDB | ||
| azb_db_close(ctx); | ||
| #endif | ||
|
|
||
| flb_free(ctx); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.