Project: EMQ Technologies (App Definition and Development / Streaming & Messaging)
File: e5.0.4.en.md

Unified the configuration formats for `cluster.core_nodes` and `cluster.statics.seeds`. Now they both support formats in array `["emqx1@127.0.0.1", "emqx2@127.0.0.1"]` and the comma-separated string `"emqx1@127.0.0.1,emqx2@127.0.0.1"`. Introduced a new function to convert a formatted date to an integer timestamp: datetounix_ts/3. `datetounix_ts(TimeUnit, FormatString, InputDateTimeString)` Optimized the configuration priority mechanism to fix the issue where the configuration changes made to `etc/emqx.conf` do not take effect after restarting EMQX. More information about the new mechanism: Deprecated the integration with StatsD. Set the level of plugin configuration options to low, users usually manage the plugins through the dashboard, rarely modify them manually, so we lowered the level. Renamed `etcd.ssl` to `etcd.ssl_options` to keep all SSL options consistent in the configuration file. Improved the storage format of Unicode characters in data files, Now we can store Unicode characters. For example: `SELECT * FROM "t/1" WHERE clientid = "--"`. Added `shutdown_counter` printout to `emqx ctl listeners` command. Increased the time precision of trace logs from second to microsecond. For example, change from `2023-05-02T08:43:50+00:00` to `2023-05-02T08:43:50.237945+00:00`. Renamed `maxmessagequeuelen` to `maxmailboxsize` in the `forceshutdown` configuration. The old name is kept as an alias, so this change is backward compatible. Hide the `resourceoption.requesttimeout` of the webhook and it will use the value of `http` `request_timeout`. Added node rebalance/node evacuation functionality. See also: Implemented Pulsar Producer Bridge and only producer role is supported now. Introduced 3 built-in functions in the rule engine SQL-like language for creating values of the MongoDB date type. Supported and schemas in Schema Registry. Implemented OpenTSDB data bridge. Implemented Oracle Database Bridge. Added enterprise data bridge for Apache IoTDB. Improved get config items performance by eliminating temporary references. Simplified the configuration of the `retainer` feature. Marked `flow_control` as a non-importance field. Improved the security and privacy of some resource logs by masking sensitive information in the log. Reduced resource usage per MQTT packet handling. Reduced memory footprint in hot code path. The hot path includes the code that is frequently executed in core functionalities such as message handling, connection management, authentication, and authorization. Improved the configuration of the limiter. Reduced the complexity of the limiter's configuration. Updated the `configs/limiter` API to suit this refactor. Reduced the memory usage of the limiter configuration. Optimized the instance of limiter for whose rate is `infinity` to reduce memory and CPU usage. Removed the default limit of connect rate which used to be `1000/s`. Added support for QUIC TLS password-protected certificate file. Fixed the issue that could lead to crash logs being printed when stopping EMQX via `systemd`. `2023-03-29T16:43:25.915761+08:00 [error] Generic server memsup terminating. Reason: {portdied,normal}. Last message: {'EXIT',<0.2117.0>,{portdied,normal}}. State: [{data,[{"Timeout",60000}]},{items,{"Memory Usage",[{"Allocated",929959936},{"Total",3832242176}]}},{items,{"Worst Memory User",[{"Pid",<0.2031.0>},{"Memory",4720472}]}}]. 2023-03-29T16:43:25.924764+08:00 [error] crasher: initial call: memsup:init/1, pid: <0.2116.0>, registeredname: memsup, exit: {{portdied,normal},[{genserver,handlecommonreply,8,[{file,"genserver.erl"},{line,811}]},{proclib,initpdoapply,3,[{file,"proclib.erl"},{line,226}]}]}, ancestors: [osmonsup,<0.2114.0>], messagequeuelen: 0, messages: [], links: [<0.2115.0>], dictionary: [], trapexit: true, status: running, heapsize: 4185, stacksize: 29, reductions: 187637; neighbours: 2023-03-29T16:43:25.924979+08:00 [error] Supervisor: {local,osmonsup}. Context:

Reason: {portdied,normal}. Offender: id=memsup,pid=<0.2116.0>.` Fixed error in `/api/v5/monitor_current` API endpoint that happens when some EMQX nodes are down. Prior to this fix, sometimes the request returned HTTP code 500 and the following message: `{"code":"INTERNAL_ERROR","message":"error, badarg, [{erlang,'++',[{error,nodedown},[{node,'emqx@10.42.0.150'}]], ...` Fixed the crash issue of the alarm system. Leverage Mnesia dirty operations and circumvent extraneous calls to enhance 'emqx_alarm' performance. Use 'emqxresourcemanager' for reactivating alarms that have already been triggered. Implement the newly developed, fail-safe 'emqxalarm' API to control the activation and deactivation of alarms, thus preventing 'emqxresource_manager' from crashing due to alarm timeouts. The alarm system is susceptible to crashing under these concurrent conditions: A significant number of resources fail, such as when bridges continuously attempt to trigger alarms due to recurring errors. The system is under an extremely high load. Fixed HTTP path handling when composing the URL for the HTTP requests in authentication and authorization modules. Avoid unnecessary URL normalization since we cannot assume that external servers treat original and normalized URLs equally. This led to bugs like . Fixed the issue that path segments could be HTTP encoded twice. Fixed a bug where external plugins could not be configured via environment variables in a lone-node cluster. Fixed a compatibility issue of limiter configuration introduced by e5.0.3 which broke the upgrade from previous versions if the `capacity` is `infinity`. In e5.0.3 we have replaced `capacity` with `burst`. After this fix, a `capacity = infinity` config will be automatically converted to equivalent `burst = 0`. Deprecated config `broker.shareddispatchack_enabled`. This was designed to avoid dispatching messages to a shared-subscription session that has the client disconnected. However, since e5.0.0, this feature is no longer helpful because the shared-subscription messages in an expired session will be redispatched to other sessions in the group. See also: <https://github.com/emqx/emqx/pull/9104> . Improved bridges API error handling. If Webhook bridge URL is not valid, the bridges API will return '400' error instead of '500'. Fixed the issue that the priority of the configuration cannot be set during the rolling upgrade. For example, when authorization is modified in e5.0.2 and then upgraded e5.0.3 through the rolling upgrade, the authorization will be restored to the default. Added the limiter API `/configs/limiter` which was deleted by mistake back. Added several fixes, enhancements, and features in Mria: Protect `mria:join/1,2` with a global lock to prevent conflicts between two nodes trying to join each other simultaneously Implement new function `mria:sync_transaction/4,3,2`, which blocks the caller until a transaction is imported to the local node (if the local node is a replicant, otherwise, it behaves exactly the same as `mria:transaction/3,2`) Optimize `mria:running_nodes/0` Optimize `mria:ro_transaction/2` when called on a replicant node

Added the following fixes and features in Mria: Call `mriarlog:role/1` safely in mriamembership to ensure that mriamembership genserver won't crash if RPC to another node fails Add an extra field to `?rlog_sync` table to facilitate extending this functionality in future . Wrapped potentially sensitive data in `emqxconnectorhttp` if `Authorization` headers are being passed at initialization. Stopped emitting useless crash report when EMQX stops. Fixed the issue where EMQX cannot start when `sysmon.os.memcheckinterval` is disabled. Fixed an issue where the buffering layer processes could use a lot of CPU when inflight window is full. A summary has been added for all endpoints in the HTTP API documentation (accessible at "http://<emqxhostname>:18083/api-docs"). Health Check Interval and Auto Restart Interval now support the range from 1ms to 1 hour. Fixed an issue where the rule engine was unable to access variables exported by `FOREACH` - `DO` clause. Given a payload: `{"date": "2023-05-06", "array": ["a"]}`, as well as the following SQL statement: `FOREACH payload.date as date, payload.array as elem DO date, elem FROM "t/#" -- {"date": "2023-05-06", "array": ["a"]}` Prior to the fix, the `date` variable exported by `FOREACH` could not be accessed in the `DO` clause of the above SQL, resulting in the following output for the SQL statement: `[{"elem": "a","date": "undefined"}]`. Correctness check of the rules is enforced before saving the authorization file source. Previously, Saving wrong rules could lead to EMQX restart failure. Fixed an issue where trying to get bridge info or metrics could result in a crash when a node is joining a cluster. Fixed data bridge resource update race condition. In the 'delete + create' process for EMQX resource updates, long bridge creation times could cause dashboard request timeouts. If a bridge resource update was initiated before completion of its creation, it led to an erroneous deletion from the runtime, despite being present in the config file. This fix addresses the race condition in bridge resource updates, ensuring the accurate identification and addition of new resources, and maintaining consistency between runtime and configuration file statuses. Fixed the issue where the default value of SSL certificate for Dashboard Listener was not correctly interpolated, which caused HTTPS to be inaccessible when `verify_peer` and `cacertfile` were using the default configuration. Fixed the issue where the lack of a default value for `ssloptions` in listeners results in startup failure. For example, such command(`EMQXLISTENERSWSSDEFAULTBIND='0.0.0.0:8089' ./bin/emqx console`) would have caused a crash before. TDEngine data bridge now supports "Supertable" and "Create Tables Automatically". Before this fix, an insert with a supertable in the template will fail, like this: `insert into ${clientid} using msg TAGS (${clientid}) values (${ts},${msg})`. Add missing support of the event `$events/deliverydropped` into the rule engine test API `ruletest`. Ported some time formating fixes in Rule-Engine functions from version 4.4. Fix "internal error 500" when getting bridge statistics page while a node is joining the cluster. Avoid double percent-decode for topic name in API `/topics/{topic}` and `/topics`. Fix a config value handling for bridge resource option `autorestartinterval`, now it can be set to `infinity`.