Skip to content
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

storage: recreate cio_stream if storage type is different(#8259) #8290

Merged
merged 2 commits into from
Jan 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/flb_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,22 @@ int flb_storage_input_create(struct cio_ctx *cio,
return -1;
}
}
else if (stream->type != cio_storage_type) {
flb_debug("[storage] storage type mismatch. input type=%s",
flb_storage_get_type(in->storage_type));
if (stream->type == FLB_STORAGE_FS) {
flb_warn("[storage] Need to remove '%s/%s' if it is empty", cio->options.root_path, in->name);
}

cio_stream_destroy(stream);
stream = cio_stream_create(cio, in->name, cio_storage_type);
if (!stream) {
flb_error("[storage] cannot create stream for instance %s",
in->name);
return -1;
}
flb_info("[storage] re-create stream type=%s", flb_storage_get_type(in->storage_type));
}

/* allocate storage context for the input instance */
si = flb_malloc(sizeof(struct flb_storage_input));
Expand Down
Loading