Skip to content

Commit

Permalink
DAOS-16902 pool: Polish map change logging (#15744) (#15917)
Browse files Browse the repository at this point in the history
No logic changes; just adding pool UUID and pool map address to pool map
change logging, and logging important messages to both stdout and log.

Signed-off-by: Li Wei <[email protected]>
  • Loading branch information
liw authored Feb 20, 2025
1 parent 53ed891 commit 0919f60
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 111 deletions.
6 changes: 4 additions & 2 deletions src/placement/tests/jump_map_place_obj.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* (C) Copyright 2016-2024 Intel Corporation.
* (C) Copyright 2025 Hewlett Packard Enterprise Development LP
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand Down Expand Up @@ -436,8 +437,9 @@ jtc_set_status_on_target(struct jm_test_ctx *ctx, const int status,
tgts.pti_ids = &tgt_id;
tgts.pti_number = 1;

int rc = ds_pool_map_tgts_update(ctx->po_map, &tgts, pool_opc_2map_opc(status),
false, &ctx->ver, ctx->enable_print_debug_msgs);
int rc = ds_pool_map_tgts_update(NULL /* pool_uuid */, ctx->po_map, &tgts,
pool_opc_2map_opc(status), false, &ctx->ver,
ctx->enable_print_debug_msgs);

/* Make sure pool map changed */
assert_success(rc);
Expand Down
33 changes: 18 additions & 15 deletions src/pool/srv_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -2121,11 +2121,11 @@ pool_svc_check_node_status(struct pool_svc *svc)
}

/*
* Log a NOTE of as well as print a message. Arguments may be evaluated more
* Log as well as print a message. Arguments may be evaluated more
* than once.
*/
#define DS_POOL_NOTE_PRINT(fmt, ...) do { \
D_NOTE(fmt, ## __VA_ARGS__); \
#define DS_POOL_LOG_PRINT(log, fmt, ...) do { \
D_##log(fmt, ## __VA_ARGS__); \
D_PRINT(fmt, ## __VA_ARGS__); \
} while (0)

Expand Down Expand Up @@ -2378,9 +2378,10 @@ pool_svc_step_up_cb(struct ds_rsvc *rsvc)
D_GOTO(out, rc);
}

DS_POOL_NOTE_PRINT(DF_UUID": rank %u became pool service leader "DF_U64": srv_pool_hdl="
DF_UUID" srv_cont_hdl="DF_UUID"\n", DP_UUID(svc->ps_uuid), rank,
svc->ps_rsvc.s_term, DP_UUID(pool_hdl_uuid), DP_UUID(cont_hdl_uuid));
DS_POOL_LOG_PRINT(NOTE, DF_UUID": rank %u became pool service leader "DF_U64
": srv_pool_hdl="DF_UUID" srv_cont_hdl="DF_UUID"\n",
DP_UUID(svc->ps_uuid), rank, svc->ps_rsvc.s_term, DP_UUID(pool_hdl_uuid),
DP_UUID(cont_hdl_uuid));
out:
if (rc != 0) {
if (events_initialized)
Expand All @@ -2399,9 +2400,9 @@ pool_svc_step_up_cb(struct ds_rsvc *rsvc)
* Step up with the error anyway, so that RPCs to the PS
* receive an error instead of timeouts.
*/
DS_POOL_NOTE_PRINT(DF_UUID": rank %u became pool service leader "DF_U64
" with error: "DF_RC"\n", DP_UUID(svc->ps_uuid), rank,
svc->ps_rsvc.s_term, DP_RC(svc->ps_error));
DS_POOL_LOG_PRINT(NOTE, DF_UUID": rank %u became pool service leader "DF_U64
" with error: "DF_RC"\n", DP_UUID(svc->ps_uuid), rank,
svc->ps_rsvc.s_term, DP_RC(svc->ps_error));
rc = 0;
}
return rc;
Expand All @@ -2419,12 +2420,12 @@ pool_svc_step_down_cb(struct ds_rsvc *rsvc)
sched_cancel_and_wait(&svc->ps_reconf_sched);
sched_cancel_and_wait(&svc->ps_rfcheck_sched);
ds_cont_svc_step_down(svc->ps_cont_svc);
DS_POOL_NOTE_PRINT(DF_UUID": rank %u no longer pool service leader "DF_U64"\n",
DP_UUID(svc->ps_uuid), rank, svc->ps_rsvc.s_term);
DS_POOL_LOG_PRINT(NOTE, DF_UUID": rank %u no longer pool service leader "DF_U64"\n",
DP_UUID(svc->ps_uuid), rank, svc->ps_rsvc.s_term);
} else {
DS_POOL_NOTE_PRINT(DF_UUID": rank %u no longer pool service leader "DF_U64
" with error: "DF_RC"\n", DP_UUID(svc->ps_uuid), rank,
svc->ps_rsvc.s_term, DP_RC(svc->ps_error));
DS_POOL_LOG_PRINT(NOTE, DF_UUID": rank %u no longer pool service leader "DF_U64
" with error: "DF_RC"\n", DP_UUID(svc->ps_uuid), rank,
svc->ps_rsvc.s_term, DP_RC(svc->ps_error));
svc->ps_error = 0;
}
}
Expand Down Expand Up @@ -7040,7 +7041,7 @@ pool_svc_update_map_internal(struct pool_svc *svc, unsigned int opc,
* before and after. If the version hasn't changed, we are done.
*/
map_version_before = pool_map_get_version(map);
rc = ds_pool_map_tgts_update(map, tgts, opc, exclude_rank, tgt_map_ver, true);
rc = ds_pool_map_tgts_update(svc->ps_uuid, map, tgts, opc, exclude_rank, tgt_map_ver, true);
if (rc != 0)
D_GOTO(out_map, rc);
map_version = pool_map_get_version(map);
Expand Down Expand Up @@ -7134,6 +7135,8 @@ pool_svc_update_map_internal(struct pool_svc *svc, unsigned int opc,
goto out_map_buf;
}

DS_POOL_LOG_PRINT(INFO, DF_UUID ": committed pool map: version=%u->%u map=%p\n",
DP_UUID(svc->ps_uuid), map_version_before, map_version, map);
updated = true;

/* Update svc->ps_pool to match the new pool map. */
Expand Down
Loading

0 comments on commit 0919f60

Please sign in to comment.