Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

use queue size to ensure history depth #31

Merged
merged 1 commit into from
May 19, 2015
Merged

Conversation

dirk-thomas
Copy link
Member

Connects to ros2/ros2#42

@esteve @tfoote @wjwwood Please review.

@dirk-thomas dirk-thomas self-assigned this May 19, 2015
@dirk-thomas dirk-thomas added the in progress Actively being worked on (Kanban column) label May 19, 2015
if (status != DDS::RETCODE_OK) {
rmw_set_error_string("failed to get default datawriter qos");
// printf("get_default_datawriter_qos() failed. Status = %d\n", status);
return nullptr;
}

// ensure the history depth is at least the requested queue size
if (datawriter_qos.history.kind == DDS::KEEP_LAST_HISTORY_QOS &&
Copy link
Member

Choose a reason for hiding this comment

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

Why check if the history kind is correct? Why not always set the history.kind to that and always set the history.depth to queue_size?

Copy link
Member Author

Choose a reason for hiding this comment

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

If the user has already configured a "better" history (e.g. keep all or a larger number) then the code should not reduce the history depth.

Copy link
Member

Choose a reason for hiding this comment

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

When would the user have had the chance to do that? The publisher was just created in this function. At best they could do it after the publisher is returned from this function.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is always possible to configure QoS parameters externally, e.g. via XML files.

Copy link
Member

Choose a reason for hiding this comment

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

My concern is that if the default changes history kind then the queue size is not even set. Also, if I pass a queue size into this create function I would expect the queue is set to exactly what I asked, regardless of the default history settings.

Copy link
Member

Choose a reason for hiding this comment

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

If we want to be able to fall back to system defaults, then we need a "create default publisher" option. I think it is the wrong behavior for the function to receive a queue_size and then potentially not use it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Always setting the history kind and depth here would prevent using vendor specific configuration options completely.

The history kind only support ALL and DEPTH N. If the default has been set to ALL the function doesn't reduce the history. If it is set to a specific DEPTH it ensures that it has at least the requested queue size. But if the default has been changed to a larger value it is not reduced.

Imo if the user changes the default configuration he is doing that for a specific reason and I would not overwrite that choice in our code.

Copy link
Member

Choose a reason for hiding this comment

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

The ability to do that is an implementation detail, this function must behave consistently based on the input. I think that if I design my node to explicitly need a queue size of 1 and you set the global to keep all that will not work. If you want to use the defaults then we need a way to specify "use default", which is how it is modeled in DDS. We cannot ask users to always specify a queue_size and then potentially ignore it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have created ros2/rmw#13 to possibly extend the rmw interface to support both cases. Until then we will keep the behavior implemented in this PR.

@tfoote
Copy link
Contributor

tfoote commented May 19, 2015

+1

1 similar comment
@wjwwood
Copy link
Member

wjwwood commented May 19, 2015

+1

dirk-thomas added a commit that referenced this pull request May 19, 2015
use queue size to ensure history depth
@dirk-thomas dirk-thomas merged commit d5c0b5a into master May 19, 2015
@dirk-thomas dirk-thomas deleted the pub_sub_queue_size branch May 19, 2015 21:34
@dirk-thomas dirk-thomas removed the in progress Actively being worked on (Kanban column) label May 19, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants