From: Jonathan Rajotte Date: Fri, 3 Jun 2022 15:34:13 +0000 (-0400) Subject: Custom upgrade: add a unique identifier for per-pid directory and shm path X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=31b507bcd7b4c436e6be6fbe7eef46a8e6dea008;hp=0b6b8118623769187e5c8363672460ce39397316;p=lttng-tools.git Custom upgrade: add a unique identifier for per-pid directory and shm path Since both path uses information that can now be identical for N "apps" (N lttng-ust instances for a single PID), we need to make sure that they do not clash. For now use the ua_session id which is monotonic. Signed-off-by: Jonathan Rajotte Change-Id: Ie7aea6c159ffd921d06763f251633441e7ac06d3 --- diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index 254e12cec..409fb3590 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -2415,8 +2415,8 @@ static void shadow_copy_session(struct ust_app_session *ua_sess, switch (ua_sess->buffer_type) { case LTTNG_BUFFER_PER_PID: ret = snprintf(ua_sess->path, sizeof(ua_sess->path), - DEFAULT_UST_TRACE_PID_PATH "/%s-%d-%s", app->name, app->pid, - datetime); + DEFAULT_UST_TRACE_PID_PATH "/%s-%d-%s-%ld", app->name, app->pid, + datetime, ua_sess->id); break; case LTTNG_BUFFER_PER_UID: ret = snprintf(ua_sess->path, sizeof(ua_sess->path), @@ -2444,8 +2444,8 @@ static void shadow_copy_session(struct ust_app_session *ua_sess, switch (ua_sess->buffer_type) { case LTTNG_BUFFER_PER_PID: ret = snprintf(tmp_shm_path, sizeof(tmp_shm_path), - "/" DEFAULT_UST_TRACE_PID_PATH "/%s-%d-%s", - app->name, app->pid, datetime); + "/" DEFAULT_UST_TRACE_PID_PATH "/%s-%d-%s-%ld", + app->name, app->pid, datetime, ua_sess->id); break; case LTTNG_BUFFER_PER_UID: ret = snprintf(tmp_shm_path, sizeof(tmp_shm_path), diff --git a/tests/regression/tools/metadata/test_ust b/tests/regression/tools/metadata/test_ust index 810a226cf..a92e55fa8 100755 --- a/tests/regression/tools/metadata/test_ust +++ b/tests/regression/tools/metadata/test_ust @@ -229,7 +229,14 @@ LTTNG_HOME="$TRACE_PATH" export LTTNG_HOME start_lttng_sessiond -tests=( test_per_uid test_per_pid ) +# test_per_pid is invalid since the session_id (monotonic) is suffixed to the +# path for to support multi-ust instance for a given pid and it is not +# available in the env. Note that if we want +# to upstream the support of multi-ust, we will need the figure out a way to +# comply with the requirement of the readers. + +#tests=( test_per_uid test_per_pid ) +tests=( test_per_uid ) for fct_test in "${tests[@]}"; do diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index e23626309..c1367f517 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -2527,7 +2527,7 @@ function validate_trace_path_ust_pid () session_name="$session_name-$date_time_pattern" fi - pattern="$trace_path/$session_name/ust/pid/$pid/$app_string-*-$date_time_pattern/metadata" + pattern="$trace_path/$session_name/ust/pid/$pid/$app_string-*-$date_time_pattern-*/metadata" validate_path_pattern "UST per-pid trace path is valid" "$pattern" "$trace_path" }