Custom upgrade: add a unique identifier for per-pid directory and shm path
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Fri, 3 Jun 2022 15:34:13 +0000 (11:34 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 30 Sep 2022 19:12:36 +0000 (15:12 -0400)
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 <jonathan.rajotte-julien@efficios.com>
Change-Id: Ie7aea6c159ffd921d06763f251633441e7ac06d3

src/bin/lttng-sessiond/ust-app.c
tests/regression/tools/metadata/test_ust
tests/utils/utils.sh

index 254e12cec7e0cf542964f310bd73467463043dc2..409fb3590160e697b2384ebb3b378efed1659c1f 100644 (file)
@@ -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),
index 810a226cf9fd7e3ec26d9eecc508202d3fd5d428..a92e55fa84e02cc31a2aaed85493f309eb44409c 100755 (executable)
@@ -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
index e236263096e933d704549c2b7d1248965d060aaa..c1367f517827c23af036836698d93bcbc84fd1e4 100644 (file)
@@ -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"
 }
This page took 0.031203 seconds and 5 git commands to generate.