From 419f470d5477e5fd9c5baf5101639e20613fca27 Mon Sep 17 00:00:00 2001 From: Francis Deslauriers Date: Wed, 22 May 2019 15:33:33 -0400 Subject: [PATCH] Fix: flt.utils.trimmer: no error when upstream can not seek Issue ===== According to commit 7de0e49, every upstream message iterators of a `flt.utils.trimmer` must support seeking. If it's not the case, the graph should fail gracefully. I encountered a situation where this invariant is not held. I can reproduce this issue by commenting out the `_SEEK_BEGINNING_METHOD()` and `_CAN_SEEK_BEGINNING_METHOD()` of the `flt.utils.muxer` and ran the following graph: babeltrace run \ --component=src:src.ctf.fs \ --params='paths=["/home/frdeso/lttng-traces/auto-20181210-133612"]' \ --component=mux:filter.utils.muxer \ --component=trim:filter.utils.trimmer \ --params='begin="13:36:12.871289834",end="13:36:12.871303475"' \ --component=sink:sink.text.pretty \ \ --connect=src.*:mux.* \ --connect=mux.*:trim.* \ --connect=trim.*:sink.* Note: The `begin` and `end` parameters are event timestamps from the trace. When the trimmer component sees that seeking is not supported, it simply skip the seeking and continue. This triggers a `BT_ASSERT()` later on. See commit message 7474e7d3f0d005280c6614be5c818735e65d8b3b for more details on seeking. See commit message 7de0e49a7c4bb3c04075703e6767d15b7beb277f for more details on trimmer. Solution ======== Error out if seeking is disabled on upstream message iterators. Drawbacks ========= None. Signed-off-by: Francis Deslauriers Change-Id: I35cdec3b8eac54f2f596d0f50661608b624d3e2e Reviewed-on: https://review.lttng.org/c/babeltrace/+/1325 Tested-by: jenkins Reviewed-by: Philippe Proulx --- plugins/utils/trimmer/trimmer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/utils/trimmer/trimmer.c b/plugins/utils/trimmer/trimmer.c index 8e114e17..0c33c879 100644 --- a/plugins/utils/trimmer/trimmer.c +++ b/plugins/utils/trimmer/trimmer.c @@ -896,7 +896,7 @@ bt_self_message_iterator_status state_seek_initially( if (!bt_self_component_port_input_message_iterator_can_seek_beginning( trimmer_it->upstream_iter)) { BT_LOGE_STR("Cannot make upstream message iterator initially seek its beginning."); - status = BT_SELF_MESSAGE_ITERATOR_STATUS_OK; + status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR; goto end; } @@ -909,7 +909,7 @@ bt_self_message_iterator_status state_seek_initially( BT_LOGE("Cannot make upstream message iterator initially seek: " "seek-ns-from-origin=%" PRId64, trimmer_it->begin.ns_from_origin); - status = BT_SELF_MESSAGE_ITERATOR_STATUS_OK; + status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR; goto end; } -- 2.34.1