Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAOS-16951 dtx: add invalid records discard capability #15790

Open
wants to merge 4 commits into
base: release/2.6
Choose a base branch
from
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
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
daos (2.6.3-2) unstable; urgency=medium
[ Jan Michalski ]
* Add ddb_ut and dtx_ut to the server-tests package

-- Jan Michalski <[email protected]> Mon, 27 Jan 2025 10:00:00 +0000

daos (2.6.3-1) unstable; urgency=medium
[ Dalton Bohning ]
* First release candidate for 2.6.3
Expand Down
2 changes: 2 additions & 0 deletions debian/daos-server-tests.install
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
usr/bin/dtx_tests
usr/bin/dtx_ut
usr/bin/jump_pl_map
usr/bin/ring_pl_map
usr/bin/evt_ctl
Expand All @@ -9,6 +10,7 @@ usr/bin/bio_ut
usr/bin/vea_ut
usr/bin/vos_tests
usr/bin/ddb_tests
usr/bin/ddb_ut
usr/bin/vea_stress
usr/bin/vos_perf
usr/bin/obj_ctl
16 changes: 14 additions & 2 deletions src/control/cmd/ddb/commands_wrapper.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// (C) Copyright 2022-2024 Intel Corporation.
// (C) Copyright 2025 Hewlett Packard Enterprise Development LP.
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
Expand Down Expand Up @@ -204,7 +205,7 @@ func ddbVeaUpdate(ctx *DdbContext, offset string, blk_cnt string) error {

func ddbDtxActCommit(ctx *DdbContext, path string, dtx_id string) error {
/* Set up the options */
options := C.struct_dtx_act_commit_options{}
options := C.struct_dtx_act_options{}
options.path = C.CString(path)
defer freeString(options.path)
options.dtx_id = C.CString(dtx_id)
Expand All @@ -215,7 +216,7 @@ func ddbDtxActCommit(ctx *DdbContext, path string, dtx_id string) error {

func ddbDtxActAbort(ctx *DdbContext, path string, dtx_id string) error {
/* Set up the options */
options := C.struct_dtx_act_abort_options{}
options := C.struct_dtx_act_options{}
options.path = C.CString(path)
defer freeString(options.path)
options.dtx_id = C.CString(dtx_id)
Expand Down Expand Up @@ -256,3 +257,14 @@ func ddbRmPool(ctx *DdbContext, path string) error {
/* Run the c code command */
return daosError(C.ddb_run_rm_pool(&ctx.ctx, &options))
}

func ddbDtxActDiscardInvalid(ctx *DdbContext, path string, dtx_id string) error {
/* Set up the options */
options := C.struct_dtx_act_options{}
options.path = C.CString(path)
defer freeString(options.path)
options.dtx_id = C.CString(dtx_id)
defer freeString(options.dtx_id)
/* Run the c code command */
return daosError(C.ddb_run_dtx_act_discard_invalid(&ctx.ctx, &options))
}
17 changes: 17 additions & 0 deletions src/control/cmd/ddb/ddb_commands.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//
// (C) Copyright 2022-2024 Intel Corporation.
// (C) Copyright 2025 Hewlett Packard Enterprise Development LP.
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
Expand Down Expand Up @@ -332,4 +333,20 @@ the path must include the extent, otherwise, it must not.`,
},
Completer: rmPoolCompleter,
})
// Command: dtx_act_discard_invalid
app.AddCommand(&grumble.Command{
Name: "dtx_act_discard_invalid",
Aliases: nil,
Help: "Discard the active DTX entry's records if invalid.",
LongHelp: "",
HelpGroup: "vos",
Args: func(a *grumble.Args) {
a.String("path", "VOS tree path to a container.")
a.String("dtx_id", "DTX id of the entry to validate or 'all' to validate all active DTX entries.")
},
Run: func(c *grumble.Context) error {
return ddbDtxActDiscardInvalid(ctx, c.Args.String("path"), c.Args.String("dtx_id"))
},
Completer: nil,
})
}
31 changes: 29 additions & 2 deletions src/dtx/tests/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ def scons():
"""Execute build"""
Import('denv', 'vts_objs')

# build dtx_tests

libraries = ['abt', 'bio', 'dtx', 'vos', 'gurt', 'daos_common_pmem', 'cmocka', 'pthread',
'uuid', 'cart', 'daos_tests']

Expand All @@ -19,10 +21,35 @@ def scons():

test_src = ['dtx_tests.c', 'sched_mock.c', 'ult_mock.c', 'srv_mock.c', 'pl_map_mock.c',
'../../common/tls.c', 'dts_utils.c', 'dts_local.c', 'dts_local_rdb.c',
'dts_structs.c', vts_objs]
vts_objs]
dtx_tests = tenv.d_program('dtx_tests', test_src, LIBS=libraries)

tenv.Install('$PREFIX/bin/', [dtx_tests])
# build dtx_ut

libraries = ['abt', 'bio', 'cmocka', 'daos_common_pmem', 'gurt', 'uuid', 'vea', 'pthread']

tenv = denv.Clone()
tenv.Append(CPPPATH=[Dir('../../vos').srcnode()])
tenv.require('pmdk')
tenv.AppendUnique(RPATH_FULL=['$PREFIX/lib64/daos_srv'])
tenv.Append(OBJPREFIX="c_")

# Required for vos_dtx_discard_invalid() tests.
# These functions are validated by their respective unit tests.
tenv.AppendUnique(LINKFLAGS=['-Wl,--wrap=ilog_is_valid'])
tenv.AppendUnique(LINKFLAGS=['-Wl,--wrap=vos_irec_is_valid'])
tenv.AppendUnique(LINKFLAGS=['-Wl,--wrap=evt_desc_is_valid'])
tenv.AppendUnique(LINKFLAGS=['-Wl,--wrap=dbtree_lookup'])

vos_src = Glob('../../vos/*.c')

test_src = ['dtx_ut.c', 'dts_discard_invalid.c', 'dts_structs.c',
'srv_mock.c', 'sched_mock.c']
dtx_ut = tenv.d_program('dtx_ut', test_src + vos_src, LIBS=libraries)

# install both

tenv.Install('$PREFIX/bin/', [dtx_tests, dtx_ut])


if __name__ == "SCons.Script":
Expand Down
Loading