diff options
| author | Daniil Fedotov <fedotov.danil@gmail.com> | 2017-06-16 12:28:07 +0100 |
|---|---|---|
| committer | Daniil Fedotov <fedotov.danil@gmail.com> | 2017-06-16 12:28:07 +0100 |
| commit | a5aac7736361e8841b8b6938f372c3876c51518f (patch) | |
| tree | 5c1395f8f4c933d235c53eeda4a90f26f7ab7604 /src | |
| parent | 66b831d3ab635d111841fb6b07cc284974e028e4 (diff) | |
| download | rabbitmq-server-git-a5aac7736361e8841b8b6938f372c3876c51518f.tar.gz | |
Make term_to_binary_compat generate binaries using minor_version 1.
term_to_binary now has `minor_version:2` to always generate utf-8 atoms,
while default is `1`, so binaries generated in OTP-20 should be
the same as in OTP-19 for non-unicode atoms.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_queue_index.erl | 2 | ||||
| -rw-r--r-- | src/term_to_binary_compat.erl | 13 |
2 files changed, 4 insertions, 11 deletions
diff --git a/src/rabbit_queue_index.erl b/src/rabbit_queue_index.erl index 5d7ced615c..5a0f76a544 100644 --- a/src/rabbit_queue_index.erl +++ b/src/rabbit_queue_index.erl @@ -653,7 +653,7 @@ recover_message(false, _, no_del, RelSeq, {Segment, DirtyCount}) -> DirtyCount + 2}. queue_name_to_dir_name(Name = #resource { kind = queue }) -> - <<Num:128>> = erlang:md5(term_to_binary_compat:queue_name_to_binary(Name)), + <<Num:128>> = erlang:md5(term_to_binary_compat:term_to_binary_1(Name)), rabbit_misc:format("~.36B", [Num]). queues_dir() -> diff --git a/src/term_to_binary_compat.erl b/src/term_to_binary_compat.erl index a3e1045623..13396ddacb 100644 --- a/src/term_to_binary_compat.erl +++ b/src/term_to_binary_compat.erl @@ -18,15 +18,8 @@ -include("rabbit.hrl"). --export([queue_name_to_binary/1]). +-export([term_to_binary_1/1]). -queue_name_to_binary(#resource{kind = queue} = {resource, VHost, queue, Name}) -> - VHostBSize = byte_size(VHost), - NameBSize = byte_size(Name), - <<131, %% Binary format "version" - 104, 4, %% 4-element tuple - 100, 0, 8, "resource", %% `resource` atom - 109, VHostBSize:32, VHost/binary, %% Vhost binary - 100, 0, 5, "queue", %% `queue` atom - 109, NameBSize:32, Name/binary>>. %% Name binary +term_to_binary_1(Term) -> + term_to_binary(Term, [{minor_version, 1}]). |
