Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/control/cmd/ddb/commands_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,18 @@ func ddbFeature(ctx *DdbContext, path, enable, disable string, show bool) error
defer freeString(options.path)
options.db_path = ctx.ctx.dc_db_path
if enable != "" {
err := daosError(C.ddb_feature_string2flags(&ctx.ctx, C.CString(enable),
cEnable := C.CString(enable)
defer freeString(cEnable)
err := daosError(C.ddb_feature_string2flags(&ctx.ctx, cEnable,
&options.set_compat_flags, &options.set_incompat_flags))
if err != nil {
return err
}
}
if disable != "" {
err := daosError(C.ddb_feature_string2flags(&ctx.ctx, C.CString(disable),
cDisable := C.CString(disable)
defer freeString(cDisable)
err := daosError(C.ddb_feature_string2flags(&ctx.ctx, cDisable,
&options.clear_compat_flags, &options.clear_incompat_flags))
if err != nil {
return err
Expand Down Expand Up @@ -312,8 +316,8 @@ func ddbDtxStat(ctx *DdbContext, path string, details bool) error {
/* Set up the options */
options := C.struct_dtx_stat_options{}
options.path = C.CString(path)
options.details = C.bool(details)
defer freeString(options.path)
options.details = C.bool(details)
/* Run the c code command */
return daosError(C.ddb_run_dtx_stat(&ctx.ctx, &options))
}
Expand Down
7 changes: 4 additions & 3 deletions src/utils/ddb/ddb_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -1148,10 +1148,11 @@ ddb_run_feature(struct ddb_ctx *ctx, struct feature_options *opt)
ddb_printf(ctx, "Incompat Flags: %lu\n", new_incompat_flags);
}
out:
if (close)
if (close) {
rc = dv_pool_close(ctx->dc_poh);
ctx->dc_poh = DAOS_HDL_INVAL;
ctx->dc_write_mode = false;
ctx->dc_poh = DAOS_HDL_INVAL;
ctx->dc_write_mode = false;
}

return rc;
}
Expand Down
6 changes: 4 additions & 2 deletions src/utils/ddb/tests/ddb_vos_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -1176,8 +1176,9 @@ static void
helper_stat_open_modify_close_stat(struct dt_vos_pool_ctx *tctx, struct file_state fs[2],
bool write_mode)
{
const char *path = tctx->dvt_pmem_file;
const char *path = tctx->dvt_pmem_file;
struct vos_file_parts path_parts = {0};
daos_handle_t saved_poh = tctx->dvt_poh;

assert_int_equal(stat(path, &fs[FILE_STATE_PRE].stat), 0);
sha256sum(path, fs[FILE_STATE_PRE].digest);
Expand All @@ -1186,6 +1187,7 @@ helper_stat_open_modify_close_stat(struct dt_vos_pool_ctx *tctx, struct file_sta
assert_success(dv_pool_open(path, &path_parts, &tctx->dvt_poh, 0, write_mode));
update_value_to_modify_tests((void **)&tctx);
assert_success(dv_pool_close(tctx->dvt_poh));
tctx->dvt_poh = saved_poh;

assert_int_equal(stat(path, &fs[FILE_STATE_POST].stat), 0);
sha256sum(path, fs[FILE_STATE_POST].digest);
Expand All @@ -1200,7 +1202,7 @@ read_only_vs_write_mode_test(void **state)
/** In read‑only mode, the pool contents remain unchanged, and its mtime stays the same. */
helper_stat_open_modify_close_stat(tctx, fs, false /** read-only */);
assert_int_equal(fs[FILE_STATE_PRE].stat.st_mtime, fs[FILE_STATE_POST].stat.st_mtime);
assert_memory_equal(fs[FILE_STATE_PRE].digest, fs[FILE_STATE_PRE].digest,
assert_memory_equal(fs[FILE_STATE_PRE].digest, fs[FILE_STATE_POST].digest,
SHA256_DIGEST_LEN);

/** In write mode, the pool contents will change and its mtime will increase. */
Expand Down
Loading