Bug 1010390

Summary: [amqp1.0] Assert support
Product: Red Hat Enterprise MRG Reporter: Petr Matousek <pematous>
Component: qpid-cppAssignee: Gordon Sim <gsim>
Status: CLOSED CURRENTRELEASE QA Contact: Eric Sammons <esammons>
Severity: medium Docs Contact:
Priority: medium    
Version: DevelopmentCC: esammons, gsim, iboverma, jross, mtoth, pematous, zkraus
Target Milestone: 3.0   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qpid-cpp-0.22-30 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-01-21 12:56:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1010399    

Description Petr Matousek 2013-09-20 16:52:49 UTC
Description of problem:

There are currently many issues in the assert support over amqp1.0.
This is known issue described in the Gordon's amqp1.0 notes.
Raising this bug in order to track the issue and suggesting to fix in 3.x release.

example issues:

Properties are ignored in the x-declare properties map, ie:
./drain --connection-options "{  protocol : 'amqp1.0' }" "q;{'create': 'always', 'node': {'x-declare': {'arguments': {'no-local': True}}}}"
./drain  --connection-options "{  protocol : 'amqp1.0' }" "q;{'assert': 'always', 'node': {'x-declare': {'arguments': {'no-local': True}}}}
"2013-09-20 07:21:26 [Messaging] warning Properties will be ignored! q;{assert:always, node:{x-declare:{arguments:{no-local:True}}}}

--

amqp0-10 client asserts can't be used on amqp1.0 client defined nodes due to incompatible types in comparison:
./drain --connection-options "{  protocol : 'amqp1.0' }" "q;{'create': 'always', 'node': {'x-declare': {'arguments': {'no-local': True}}}}"
./drain  "q;{'assert': 'always', 'node': {'x-declare': {'arguments': {'no-local': True}}}}"
Option no-local does not match for q, expected F1:boolean(1), got V2:4:vbin16(True)

--

map asserts are not supported yet

--

Unexpected results
/var/dtests/node_data/clients/qc2_drain --connection-options {protocol:amqp1.0}  "E735334;{ create:always,assert:always, node: { type:topic }}"
Desired capabilities not met: topic

Version-Release number of selected component (if applicable):
qpid-cpp-*-0.22-14

How reproducible:
100%

Steps to Reproduce:
n/a

Actual results:
poor assert policies support over amqp1.0

Expected results:
functional assert policies support over amqp1.0

Comment 1 Gordon Sim 2013-09-20 17:06:56 UTC
> Unexpected results
> /var/dtests/node_data/clients/qc2_drain --connection-options {protocol:amqp1.0}  "E735334;{ create:always,assert:always, node: { type:topic }}"
> Desired capabilities not met: topic

The above issue is fixed by https://svn.apache.org/r1525040 (it was an issue of not sending both the create-on-demand and topic capabilities).

Comment 2 Gordon Sim 2013-09-24 11:27:44 UTC
Fixed upstream: https://svn.apache.org/r1525858

Comment 4 Gordon Sim 2013-09-24 16:23:08 UTC
I should point out that using assert with properties of the node uses a mechanism that strictly speaking violates the 1.0 specification and is in any case qpidd specific. The issue is that the node properties should not be sent on  attach if the dynamic flag is not set (this is similar to what happens for the create option).

Asserting on filters or capabilities on the other hand relies only on the standard protocol rules so should work with any compliant peer.

Comment 7 Petr Matousek 2013-12-03 11:33:11 UTC
Despite that using asserts with properties of the node is not recommended, as explained in the comment 4, most of the issues were solved.

Automated tests still reports several issues when asserting the following properties:
auto-delete, lvq, limit-policy, qpid.trace.id, qpid.trace.exclude

amqp1.0 assert on auto-delete queue (declared either by 0-10 or 1.0):

# ./spout --connection-options "{  protocol : 'amqp1.0' }" "autodel_q;{node:{x-declare:{auto-delete:True}},create:always}"
OR
# ./spout --connection-options "{  protocol : 'amqp0-10' }" "autodel_q;{node:{x-declare:{auto-delete: True}},create:always}"
# ./spout --connection-options "{  protocol : 'amqp1.0' }" "autodel_q;{node:{x-declare:{auto-delete: True}},assert:always}"
Requested node properties not met: {auto-delete:True}

Type incompatibilities when using 0-10 asserts on amqp1.0 declared nodes:

# ./spout  --connection-options "{ protocol : 'amqp1.0' }" "testNodePropertyQueues_1;{node:{x-declare:{arguments:{qpid.last_value_queue_key:somekey}}},create:always}"
# ./drain  --connection-options "{ protocol : 'amqp0-10' }" "testNodePropertyQueues_1;{node:{x-declare:{arguments:{qpid.last_value_queue_key:somekey}}},assert:always}"
Option qpid.last_value_queue_key does not match for testNodePropertyQueues_1, expected V2:7:str16(somekey), got V2:7:vbin16(somekey)

# ./spout  --connection-options "{ protocol : 'amqp1.0' }" "testNodePropertyQueues_2;{node:{x-declare:{arguments:{qpid.policy_type:reject}}}, create:always}"
# ./drain  --connection-options "{ protocol : 'amqp0-10' }" "testNodePropertyQueues_2;{node:{x-declare:{arguments:{qpid.policy_type:reject}}},assert:always}"
Option qpid.policy_type does not match for testNodePropertyQueues_2, expected V2:6:str16(reject), got V2:6:vbin16(reject)
(note: applies to all policy types: flow_to_disk, ring, ring strict..)

# ./spout  --connection-options "{ protocol : 'amqp1.0' }" "testNodePropertyQueues_3;{node:{x-declare:{arguments:{qpid.trace.id:trace-id}}}, create:always}"
# ./drain  --connection-options "{ protocol : 'amqp0-10' }" "testNodePropertyQueues_3;{node:{x-declare:{arguments:{qpid.trace.id:trace-id}}},assert:always}"
Option qpid.trace.id does not match for testNodePropertyQueues_3, expected V2:8:str16(trace-id), got V2:8:vbin16(trace-id)
# 
# ./spout  --connection-options "{ protocol : 'amqp1.0' }" "testNodePropertyQueues_4;{node:{x-declare:{arguments:{qpid.trace.exclude:trace-exclude}}}, create:always}"
# ./drain  --connection-options "{ protocol : 'amqp0-10' }" "testNodePropertyQueues_4;{node:{x-declare:{arguments:{qpid.trace.exclude:trace-exclude}}},assert:always}"
Option qpid.trace.exclude does not match for testNodePropertyQueues_4, expected V2:13:str16(trace-exclude), got V2:13:vbin16(trace-exclude)

Comment 8 Gordon Sim 2013-12-03 17:59:31 UTC
The issue with autodelete is fixed by https://svn.apache.org/r1547496. The issue regarding the type of queue properties for queue created on-demand over 1.0 is fixed by https://svn.apache.org/r1547496.

Comment 9 Gordon Sim 2013-12-03 18:01:40 UTC
Oops, sorry, I hadn't copied the new url for the second change above it seems. The fix for the property types is: https://svn.apache.org/r1547495.

I.e. for clarity there are two fixes:

(1) https://svn.apache.org/r1547495
(2) https://svn.apache.org/r1547496

Comment 11 Petr Matousek 2014-01-06 15:03:22 UTC
QE note: 0-10 like node/link properties assert seems to work well now, no failures reported by automated tests
To be tested: asserts on amqp1.0 capabilities

Comment 12 Zdenek Kraus 2014-02-14 07:04:46 UTC
I've used a amqp 1.0 client with asserts for qpid node properties created by amqp 1.0. I'm aware of Comment 4, but I wanted to be sure If we would support that.

failing properties asserts:

qpid.exclusive-binding:False
qpid.exclusive-binding:True
qpid.file_count:10
qpid.file_size:10000
qpid.ive:False
qpid.msg_sequence:False
qpid.msg_sequence:True
qpid.optimistic_consume:False
qpid.optimistic_consume:True
qpid.persist_last_node:False
qpid.persist_last_node:True
qpid.queue_event_generation:10
qpid.sequence_counter:10  ## this could be failing due to Bug 1040526
x-qpid-capacity:10
x-qpid-flow-resume-capacity:5
x-qpid-maximum-message-age:10


So my conclusion, If we would support that, please fix it, on the other hand if we won't support that we have to make a note to documentation.

Comment 13 Zdenek Kraus 2014-02-14 07:15:03 UTC
addition to Comment 12

please note that following properties asserts works:

'qpid.alert_count': 10
'qpid.alert_repeat_gap': 10
'qpid.alert_size': 10
'qpid.flow_resume_count': 15
'qpid.flow_resume_size': 400
'qpid.flow_stop_count': 24
'qpid.flow_stop_size': 480
'qpid.ive': True
'qpid.last_value_queue': False
'qpid.last_value_queue_key': 'somekey'
'qpid.last_value_queue_no_browse': False
'qpid.last_value_queue_no_browse': True
'qpid.last_value_queue': True
'qpid.max_count': 64
'qpid.max_size': 512
'qpid.msg_sequence': True
'qpid.paging': False
'qpid.paging': True
'qpid.paging': True, 'qpid.max_pages_loaded': 16
'qpid.paging': True, 'qpid.page_factor': 4
'qpid.policy_type': 'reject'
'qpid.policy_type': 'ring'
'qpid.priorities': 1
'qpid.queue_msg_sequence': 'msg_sq_no'
'qpid.trace.exclude': 'trace-exclude'
'qpid.trace.id': 'trace-id'
'x-qpid-maximum-message-count': 10
'x-qpid-maximum-message-size': 10
'x-qpid-minimum-alert-repeat-gap': 10
'x-qpid-priorities': 1

Comment 14 Gordon Sim 2014-02-14 18:01:03 UTC
(In reply to Zdenek Kraus from comment #12)
> I've used a amqp 1.0 client with asserts for qpid node properties created by
> amqp 1.0. I'm aware of Comment 4, but I wanted to be sure If we would
> support that.
> 
> failing properties asserts:
> 
> qpid.exclusive-binding:False
> qpid.exclusive-binding:True

This option isn't yet exposed over AMQP 1.0

> qpid.ive:False

This works for me on trunk. It's an exchange property, so would obviously only work if the node is an exchange. Perhaps there is a difference between latest 3.0 candidate code and trunk however. (Or perhaps I am misunderstanding the test case?)

> qpid.file_count:10
> qpid.file_size:10000

These really should be asserted on, but at present it is the journal module, not the broker, that recognises them. Special support could be added however.

> qpid.msg_sequence:False
> qpid.msg_sequence:True

This was an old async replication related property, the new functionality is offered through the qpid.queue_msg_sequence option.

> qpid.optimistic_consume:False
> qpid.optimistic_consume:True
> qpid.persist_last_node:False
> qpid.persist_last_node:True
> qpid.queue_event_generation:10

The optimistic_consume, persist_last_node and queue_event_generation options don't exist any more.

> qpid.sequence_counter:10  ## this could be failing due to Bug 1040526

That is not really an option, it's queue state and not something I think should necessarily readable and assertable on here.

> x-qpid-capacity:10
> x-qpid-flow-resume-capacity:5
> x-qpid-maximum-message-age:10

None of these are actually supported options.

Comment 15 Valiantsina Hubeika 2014-08-28 09:32:23 UTC
All scenarios described in above comments are tested,also asserts on amqp1.0 capabilities are tested. All tested scenarios pass (if the feature itself is implemented flawlessly) except 
qpid.file_count:10
qpid.file_size:10000 . 
This will be tracked as a separate bug. 

verified on 
qpid-0.22-47