Skip to content

Commit

Permalink
storage: recreate cio_stream if storage type is different(fluent#8259)
Browse files Browse the repository at this point in the history
cio_load creates storage stream if directory exists.
It prevents to create memory stream by input plugins.
This patch is to recreate stream if the type is different.

Signed-off-by: Takahiro Yamashita <[email protected]>
  • Loading branch information
nokute78 committed Dec 16, 2023
1 parent 2612a1a commit ee16113
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/flb_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,18 @@ int flb_storage_input_create(struct cio_ctx *cio,
return -1;
}
}
else if (stream->type != cio_storage_type) {
flb_info("[storage] storage type mismatch. input type=%s",
flb_storage_get_type(in->storage_type));
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");
}

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

0 comments on commit ee16113

Please sign in to comment.