Jelajahi Sumber

Merge pull request #9625 from zmstone/1228-only-high-load-detect-in-linux

fix(kafka): Memory OLP is only applicable in linux systems
Zaiming (Stone) Shi 3 tahun lalu
induk
melakukan
4e61e0602d

+ 3 - 1
lib-ee/emqx_ee_bridge/i18n/emqx_ee_bridge_kafka.conf

@@ -438,10 +438,12 @@ emqx_ee_bridge_kafka {
         desc {
             en: "Applicable when buffer mode is set to <code>memory</code> or <code>hybrid</code>.\n"
                 "EMQX will drop old cached messages under high memory pressure. "
-                "The high memory threshold is defined in config <code>sysmon.os.sysmem_high_watermark</code>."
+                "The high memory threshold is defined in config <code>sysmon.os.sysmem_high_watermark</code>. "
+                "NOTE: This config only works on Linux."
             zh: "缓存模式是 <code>memory</code> 或 <code>hybrid</code> 时适用。"
                 "当系统处于高内存压力时,从队列中丢弃旧的消息以减缓内存增长。"
                 "内存压力值由配置项 <code>sysmon.os.sysmem_high_watermark</code> 决定。"
+                "注意,该配置仅在 Linux 系统中有效。"
         }
         label {
             en: "Memory Overload Protection"

+ 1 - 1
lib-ee/emqx_ee_bridge/src/emqx_ee_bridge.app.src

@@ -1,6 +1,6 @@
 {application, emqx_ee_bridge, [
     {description, "EMQX Enterprise data bridges"},
-    {vsn, "0.1.1"},
+    {vsn, "0.1.2"},
     {registered, []},
     {applications, [
         kernel,

+ 6 - 2
lib-ee/emqx_ee_bridge/src/kafka/emqx_bridge_impl_kafka_producer.erl

@@ -236,10 +236,14 @@ producers_config(BridgeName, ClientId, Input) ->
             mode := BufferMode,
             per_partition_limit := PerPartitionLimit,
             segment_bytes := SegmentBytes,
-            memory_overload_protection := MemOLP
+            memory_overload_protection := MemOLP0
         }
     } = Input,
-
+    MemOLP =
+        case os:type() of
+            {unix, linux} -> MemOLP0;
+            _ -> false
+        end,
     {OffloadMode, ReplayqDir} =
         case BufferMode of
             memory -> {false, false};