Commit Graph

4500 Commits

Author SHA1 Message Date
spring2maz 29f697dd69
Merge pull request #2009 from emqx/track-vsn-using-git-tag
Track vsn using git tag
2018-11-30 11:29:17 +01:00
spring2maz b87e72861a Fallback to git clone -n then checkout if git version is older than 1.8 2018-11-30 11:03:26 +01:00
spring2maz 14dfe03426 Use git tag for app vsn 2018-11-30 11:03:26 +01:00
spring2maz fe33aeb3dc For git older than 1.8, there is no shallow clone support 2018-11-30 17:47:59 +08:00
Feng Lee d9470f365f Optimize read/write concurrency of mnesia/ets tables 2018-11-30 17:46:15 +08:00
Feng Lee e15e5d1f98 Fix the atom leaks in emqx_reason_codes module. 2018-11-30 17:45:28 +08:00
周子博 fde5fbe73a Align the code 2018-11-30 17:44:29 +08:00
周子博 ddb9eaef7b Improve test coverage of emqx_metrics 2018-11-30 17:44:29 +08:00
周子博 ad8b547519 Make batch committing of metrics more elegant 2018-11-30 17:44:29 +08:00
周子博 f315994eb9 Remove unnecessary spec 2018-11-30 17:44:29 +08:00
周子博 c87aabbbeb Some forgotten changes in last commit 2018-11-30 17:44:29 +08:00
周子博 ea62b15c87 Alter apis provided by emqx_metrics, and use existing timer to commit metrics 2018-11-30 17:44:29 +08:00
周子博 194dbc02c8 Add batch commit for metrics 2018-11-30 17:44:29 +08:00
Shawn 76d5dedb3b
Remove simple log handler at startup (#2000)
The simple logger handler is not removed if we set the `log.to=file` in
emqx.conf.

This might be an issue of OTP logger:
https://bugs.erlang.org/browse/ERL-788

I set the error_logger to silent as a workaround.
2018-11-30 14:29:34 +08:00
Feng Lee 21ed012a0c Add an elegant batch module 2018-11-29 10:13:09 +08:00
Feng Lee 309f3560f3 Bump version to 3.0.0 2018-11-28 16:05:17 +08:00
周子博 5c291ff23e Fix the 'route_batch_delete' config 2018-11-28 16:04:04 +08:00
Gilbert Wong d08ed351be Do no execute rebar-clean before distclean
Prior to this change, this project support to be built with rebar3 and
erlang.mk meanwhile but when we want to make distclean, this project
would execute rebar-clean which would get dependencies via rebar3, it
slow down the procedure of distclean.
2018-11-27 17:00:23 +08:00
Gilbert d13c5f8ec1
Reduce dep size (#1981) 2018-11-26 17:55:48 +08:00
周子博 78fdb798f8 Update vsn 2018-11-26 13:51:32 +08:00
Shawn eeb0cab3e3 Update proc meta-data for empty clientid (#1980) 2018-11-23 18:11:46 +08:00
Shawn 09025338d4 Enable emqx.log by default (#1979) 2018-11-23 18:10:59 +08:00
Shawn 93a079752f Update cuttlefish to v2.1.1 (#1978) 2018-11-23 11:04:55 +08:00
Shawn 6fa183f847 Add CLI for log level (#1977) 2018-11-23 11:04:33 +08:00
Shawn 2bd0f16884 Add CLI for log tracer (#1973) 2018-11-23 11:01:10 +08:00
tigercl 551d5d99d2 Change 'aquire' to 'acquire' (#1976)
* Change 'aquire' to 'acquire'
2018-11-23 11:00:30 +08:00
tigercl 14b8036576 Use username replace id(issue#1737) (#1961)
* Use username replace id(issue#1737)

* Add test case for issue#1737

* Make with_connection/2 support batch connect
2018-11-21 22:51:33 +08:00
spring2maz a2c658ba19 Add acking mechamism for shared dispatch (#1872)
* Add acking mechamism for shared dispatch

For QoS0 messages, no acking
For QoS1/2 messages, 'ACK' at any of events below:
 - ACK when QoS is downgraded to 0
 - Message is sent to connection process
'NACK' at any of events below:
 - Message queue is full and the receiving session starts to drop old messages
 - The receiving session crash
Upon 'NACK', messages are dispatched to the 'next' subscriber in the group,
depending on the shared subscription dispatch strategy.
2018-11-21 22:49:45 +08:00
Gilbert 16821490ce Fix issue#1874 (#1964)
* Fix issue#1874
Prior to this change, if user use one client connect emqx with mqtt
v3.1.1, the client subscribe the topic and publish message to this
topic, it would receive this message itself published, this commit
provide a configure option to let user ignore the message itself published.

This change fix issue 1874.

* Small Fix

* Fix bug

* Better design

* Fix compile warning and improve coverage

* Better design to solve the performance issue

* Fix typo

* Fix typo

* Delete spaces in end of lines.

* Do not use anonymous function

* Better performance
2018-11-19 13:34:03 +08:00
terry-xiaoyu bc1464a33f Lazy logging without header 2018-11-19 11:17:58 +08:00
terry-xiaoyu 82b8047349 Helper funcs for adding proc meta-data 2018-11-19 11:17:58 +08:00
terry-xiaoyu e8cc65ef40 Change logger micros 2018-11-19 11:17:58 +08:00
terry-xiaoyu 41315bff0d Log macros for lazy evaluation 2018-11-19 11:17:58 +08:00
terry-xiaoyu 2269967f1a Lazy evaluation when logging messages
Formatting variables and then passing them into the logger functions leads
to performance issues. i.e.

```erlang
logger:debug("RECV ~s", [emqx_packet:format(Packet)])
```

Above message will only be printed when the current log level set to
`debug`, but the function emqx_packet:format/1 will always be evaluated no
matter what the current log level is.

OTP 21 provides a special meta-data named `report_cb`, which can be used
for lazy evaluation. The fun is only evaluated if the primary/handler log level
check passes, and is therefore recommended if it is expensive to generate
the message.
2018-11-19 11:17:58 +08:00
周子博 cb835af42b Fix bad comment 2018-11-19 10:49:05 +08:00
Andrei Nesterov 9d67a64165 Fix type validation for User-Property 2018-11-19 09:53:43 +08:00
terry-xiaoyu 078584172e Print EMQ X Version in the console 2018-11-10 12:14:26 +08:00
turtled faeda253e1 Fix conflicts 2018-11-10 11:44:55 +08:00
terry-xiaoyu 6e26f5e9af Revert logger print to io:format 2 2018-11-10 11:25:52 +08:00
terry-xiaoyu 2611b6fc2a Revert logger print to io:format 2018-11-10 11:01:11 +08:00
周子博 c76e2d1413 Fix 'badarg' in io_lib:format/2 when 'from' field is tuple 2018-11-09 18:32:26 +08:00
terry-xiaoyu 997958aed1 Change the start_link API for emqx_client
Prior to this change, emqx_client:start_link does 2 works in one call:
- init an erlang process for emqx_client
- send MQTT CONNECT to remote broker

But this solution have some drawbacks:

- the return value of `start_link` compiles the return values of the 2
 works: {ok, Pid, MqttResult}. It is inconsistent with the return value
 of `gen_statem:start_link`, may causes confusions.

- the return mode of the 2 works are different:
  `start_link` should always return {ok, Pid} or {error, Reason}, but
 connecting to mqtt may throw out exceptions as it handles the
 socket. But the caller couldn't have thought of the exception, he would
 pattern match on the result of `emqx_client:start_link`, but it crashed!

- If the init work succeed but the connection failed, the caller couldn't
get a Pid from the return value, but indeed it was created inside the
emqx_client. This hides the fact that the Pid was created, and when the
Pid dies, the caller would receive an message from a Pid it doesn' know about.

This change divived these 2 work into 2 APIs:
- `start_link/1` is to build and verify the options, and returns {ok,Pid}
 (on success) or {error, Reason} (on failure).
- `connect/1` is to send MQTT CONNECT, and returns {ok, MQTTResult::properties()} or
 {error, MQTTReason}. MQTT reason codes will contains in the `MQTTReason`.
2018-11-09 17:43:04 +08:00
terry-xiaoyu 2dc8ec8b11 Bridge via TLS 2018-11-09 17:43:04 +08:00
tigercl 3879dcdf59 Fix 'badarg' bug with duplicate subscriptions (#1943) 2018-11-08 23:02:35 +08:00
Gilbert Wong 32d3826440 Replace macro QOS$i to QOS_$I
The two styles of qos macro name in one project is chaotic. It is not
a good practice.

So I change the QOS$i to QOS_$i
2018-11-08 20:42:31 +08:00
terry-xiaoyu f448c62e47 Fix config descriptions of ACL cache 2018-11-08 20:41:57 +08:00
turtleDeng 0a337cbcb4
Merge pull request #1905 from emqx/Fix-for-mqtt-sn
Fix the init_proc_mng_policy bug
2018-11-05 22:30:51 +08:00
terry-xiaoyu cca27d1a5a Change filesync_repeat_interval to no_repeat 2018-11-05 16:04:58 +08:00
Gilbert Wong 4ea57c2bf9 Delete redundant case clauses in sendfun
Prior to this change, there are ok, {binary, _Data}. {datagram, _Peer,
_Dara} case clauses, and the {binary, _Data} and {datagram, _Peer,
_Data} are unnecessary cases

This change delete these two cases and add ok in the end of funtion in
send_fun of emqx_ws_connection.
2018-11-03 22:56:11 +08:00
spring2maz 7ad3a63173
Merge pull request #1926 from emqx/rewrite-mqueue
Rewrite emqx_mqueue.erl
2018-11-03 10:04:30 +01:00