From: Jérémie Galarneau Date: Fri, 3 Apr 2020 19:05:37 +0000 (-0400) Subject: Fix: relayd: harmonize path format in backward-compat mode X-Git-Tag: v2.13.0-rc1~683 X-Git-Url: http://git.liburcu.org/?a=commitdiff_plain;h=d2cb4a903e7b0868be99c6d558ce0c782af81c27;hp=d2cb4a903e7b0868be99c6d558ce0c782af81c27;p=lttng-tools.git Fix: relayd: harmonize path format in backward-compat mode Observed issue ============== Currently, the relay daemon produces the following path formats depending on the whether a tracepath is provided, the version of the session daemon peer, and the grouping option specified on launch of the relay daemon. Hostname grouping, no custom trace path pre 2.11: $BASE/$SHOSTNAME/$SESSION-$DATETIME 2.12: $BASE/$SHOSTNAME/$SESSION-$DATETIME Hostname grouping, custom trace path pre 2.11: $BASE/$HOSTNAME/$TRACEPATH 2.12: $BASE/$HOSTNAME/$TRACEPATH Tracing session grouping, no custom trace path pre 2.11: $BASE/$SESSION/$HOSTNAME-$DATETIME 2.12: $BASE/$SESSION/$HOSTNAME-$DATETIME Tracing session grouping, custom trace path pre 2.11: $BASE/$SESSION/$HOSTNAME/$TRACEPATH 2.12: $BASE/$SESSION/$HOSTNAME-$DATETIME/$TRACEPATH As you can see, there is a single case where the format diverges based on the version of the session daemon. Cause ===== Pre-2.11 session daemons do not transmit a session creation time when a TRACEPATH is specified as part of the streaming url (e.g. `lttng create my_session --set-url net://localhost/a_path`) Hence, the backward compatibility path formatting code does not insert a "DATETIME" string in the resulting path. Solution ======== The relay daemon samples the time when it creates its session and that time is formatted into the DATETIME representation if no DATETIME is present in the path provided by pre-2.11 peers. Drawbacks ========= Sampling the relay session creation time will not yield the exact same behaviour as what a 2.11+ peer would produce, but it is a reasonable approximation for most use-cases. Users depending on this time being the exact same as that sampled by the session daemon will need to adapt tools anyhow if they use the new --group-output-by-session option, so the change doesn't introduce more problems. This behaviour can be surprising when snapshots are streamed by pre-2.11 peers as the session creation DATETIME will be different for all snapshots. This is not ideal, but still less jarring than getting a completely different path format depending on a peer's version. Signed-off-by: Jérémie Galarneau Change-Id: I3316aa35a34985e83ae759851af3a899b0011789 Signed-off-by: Jérémie Galarneau ---