diff options
| author | Michael Klishin <michael@novemberain.com> | 2017-06-08 22:46:17 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-06-08 22:46:17 +0300 |
| commit | a23338ad6fa3d0b7b2e9613ba0e84fff12078d82 (patch) | |
| tree | fbe748e11b054acbd524fcaeebece3944b81b4fe /src | |
| parent | d6d9e9824c3284efb9fd9b166686dc0e84fe4451 (diff) | |
| parent | a674f9b08280a2ec3c323df50e58a61b00ae038f (diff) | |
| download | rabbitmq-server-git-a23338ad6fa3d0b7b2e9613ba0e84fff12078d82.tar.gz | |
Merge pull request #1246 from rabbitmq/rabbitmq-server-1243
OTP-20 compatibility workaround for queue directory names. 3.6 only!
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_queue_index.erl | 2 | ||||
| -rw-r--r-- | src/term_to_binary_compat.erl | 32 |
2 files changed, 33 insertions, 1 deletions
diff --git a/src/rabbit_queue_index.erl b/src/rabbit_queue_index.erl index f487cc52c3..5d7ced615c 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(Name)), + <<Num:128>> = erlang:md5(term_to_binary_compat:queue_name_to_binary(Name)), rabbit_misc:format("~.36B", [Num]). queues_dir() -> diff --git a/src/term_to_binary_compat.erl b/src/term_to_binary_compat.erl new file mode 100644 index 0000000000..a3e1045623 --- /dev/null +++ b/src/term_to_binary_compat.erl @@ -0,0 +1,32 @@ +%% The contents of this file are subject to the Mozilla Public License +%% Version 1.1 (the "License"); you may not use this file except in +%% compliance with the License. You may obtain a copy of the License +%% at http://www.mozilla.org/MPL/ +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and +%% limitations under the License. +%% +%% The Original Code is RabbitMQ. +%% +%% The Initial Developer of the Original Code is GoPivotal, Inc. +%% Copyright (c) 2017 Pivotal Software, Inc. All rights reserved. +%% + +-module(term_to_binary_compat). + +-include("rabbit.hrl"). + +-export([queue_name_to_binary/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 + |
