Skip to content

OTP-20 compatibility workaround for queue directory names. 3.6 only! #1246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 8, 2017

Conversation

hairyhum
Copy link
Contributor

@hairyhum hairyhum commented Jun 6, 2017

Workaround for #1243 for 3.6
OTP-20 has different binary format for atoms (since OTP-14337)
So term_to_binary generates different value.
testm_to_binary_compat now have a function to generate a binary
identical to pre-20 versions.

Does not address management or stomp issues.

OTP-20 has different binary format for atoms (since OTP-14337)
So term_to_binary generates different value.
testm_to_binary_compat now have a function to generate a binary
identical to pre-20 versions.
@hairyhum hairyhum added this to the 3.6.11 milestone Jun 6, 2017

-export([queue_name_to_binary/1]).

queue_name_to_binary(#resource{kind = queue} = {resource, VHost, queue, Name}) ->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use #resource here to make things a bit more forward-compatible?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It cannot and should not be forward-compatible.
The function is a workaround and in 3.7 we should get rid of it. The code assumes that the record will be a tuple of this specific format. The match asserts that we haven't changed the record and the function still makes sense.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

queue_name_to_binary(#resource{kind = queue} = {resource, VHost, queue, Name}) ->
VHostBSize = byte_size(VHost),
NameBSize = byte_size(Name),
<<131,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You floated a version of this with comments next to each byte on Slack. I found them very useful.

@hairyhum hairyhum changed the title OTP-20 compatibility workaround for queue directory names. OTP-20 compatibility workaround for queue directory names. 3.6 only! Jun 6, 2017
@michaelklishin
Copy link
Collaborator

I'm getting the following test failures (on 19.3):

cluster_SUITE > cluster_tests > from_cluster_node1 > refresh_events
    #1. {error,
            {{badarg,
                 [{erlang,byte_size,
                      ["cluster_tests/from_cluster_node1/refresh_events-q"],
                      []},
                  {term_to_binary_compat,queue_name_to_binary,1,
                      [{file,"src/term_to_binary_compat.erl"},{line,25}]},
                  {rabbit_queue_index,queue_name_to_dir_name,1,
                      [{file,"src/rabbit_queue_index.erl"},{line,656}]},
                  {rabbit_queue_index,blank_state,1,
                      [{file,"src/rabbit_queue_index.erl"},{line,539}]},
                  {rabbit_queue_index,init,3,
                      [{file,"src/rabbit_queue_index.erl"},{line,303}]},
                  {rabbit_variable_queue,init,6,
                      [{file,"src/rabbit_variable_queue.erl"},{line,504}]},
                  {rabbit_priority_queue,init,3,
                      [{file,"src/rabbit_priority_queue.erl"},{line,148}]},
                  {rabbit_amqqueue_process,init_it2,3,
                      [{file,"src/rabbit_amqqueue_process.erl"},{line,195}]}]},
             {gen_server2,call,[<16201.924.0>,{init,new},infinity]}}}

cluster_SUITE > cluster_tests > from_cluster_node2 > refresh_events
    #1. {error,
            {{badarg,
                 [{erlang,byte_size,
                      ["cluster_tests/from_cluster_node2/refresh_events-q"],
                      []},
                  {term_to_binary_compat,queue_name_to_binary,1,
                      [{file,"src/term_to_binary_compat.erl"},{line,25}]},
                  {rabbit_queue_index,queue_name_to_dir_name,1,
                      [{file,"src/rabbit_queue_index.erl"},{line,656}]},
                  {rabbit_queue_index,blank_state,1,
                      [{file,"src/rabbit_queue_index.erl"},{line,539}]},
                  {rabbit_queue_index,init,3,
                      [{file,"src/rabbit_queue_index.erl"},{line,303}]},
                  {rabbit_variable_queue,init,6,
                      [{file,"src/rabbit_variable_queue.erl"},{line,504}]},
                  {rabbit_priority_queue,init,3,
                      [{file,"src/rabbit_priority_queue.erl"},{line,148}]},
                  {rabbit_amqqueue_process,init_it2,3,
                      [{file,"src/rabbit_amqqueue_process.erl"},{line,195}]}]},
             {gen_server2,call,[<16202.1365.0>,{init,new},infinity]}}}

@hairyhum
Copy link
Contributor Author

hairyhum commented Jun 8, 2017

Fixed tests, which were using strings instead of binaries for queue names.

@michaelklishin michaelklishin merged commit a23338a into stable Jun 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants