Merge pull request #12755 from thalesmg/fix-kafka-probe-buffer-disk-m-20240321
fix(kafka-based bridges): avoid trying to get raw config for replayq dir
This commit is contained in:
commit
8ffd1304a5
|
@ -668,9 +668,8 @@ partitioner(random) -> random;
|
||||||
partitioner(key_dispatch) -> first_key_dispatch.
|
partitioner(key_dispatch) -> first_key_dispatch.
|
||||||
|
|
||||||
replayq_dir(BridgeType, BridgeName) ->
|
replayq_dir(BridgeType, BridgeName) ->
|
||||||
RawConf = emqx_conf:get_raw([actions, BridgeType, BridgeName]),
|
|
||||||
DirName = iolist_to_binary([
|
DirName = iolist_to_binary([
|
||||||
emqx_bridge_lib:downgrade_type(BridgeType, RawConf),
|
maybe_v1_type_name(BridgeType),
|
||||||
":",
|
":",
|
||||||
BridgeName,
|
BridgeName,
|
||||||
":",
|
":",
|
||||||
|
@ -678,6 +677,14 @@ replayq_dir(BridgeType, BridgeName) ->
|
||||||
]),
|
]),
|
||||||
filename:join([emqx:data_dir(), "kafka", DirName]).
|
filename:join([emqx:data_dir(), "kafka", DirName]).
|
||||||
|
|
||||||
|
%% To avoid losing queued data on disk, we must use the same directory as the old v1
|
||||||
|
%% bridges, if any. Among the Kafka-based bridges that exist since v1, only Kafka changed
|
||||||
|
%% its type name. Other bridges are either unchanged, or v2-only, and should use their v2
|
||||||
|
%% type names.
|
||||||
|
maybe_v1_type_name(Type) when is_atom(Type) -> maybe_v1_type_name(atom_to_binary(Type));
|
||||||
|
maybe_v1_type_name(<<"kafka_producer">>) -> <<"kafka">>;
|
||||||
|
maybe_v1_type_name(Type) -> Type.
|
||||||
|
|
||||||
with_log_at_error(Fun, Log) ->
|
with_log_at_error(Fun, Log) ->
|
||||||
try
|
try
|
||||||
Fun()
|
Fun()
|
||||||
|
|
Loading…
Reference in New Issue