Skip to content

Commit 19b6f59

Browse files
mchaarawignailzenh
andauthored
DAOS-18161 object: load container write stamp from VOS (#17388)
After restart, load the latest epoch of writes that require aggregation from VOS instead of setting it to zero, otherwise EC aggregation has to scan the container again even it's not changed after previous aggregation. Signed-off-by: Liang Zhen <gnailzenh@gmail.com> Co-authored-by: Liang Zhen <gnailzenh@gmail.com>
1 parent b1619c3 commit 19b6f59

File tree

3 files changed

+31
-17
lines changed

3 files changed

+31
-17
lines changed

src/include/daos_srv/vos_types.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* (C) Copyright 2015-2025 Intel Corporation.
3-
* (C) Copyright 2025 Hewlett Packard Enterprise Development LP
3+
* (C) Copyright 2025-2026 Hewlett Packard Enterprise Development LP
44
*
55
* SPDX-License-Identifier: BSD-2-Clause-Patent
66
*/
@@ -174,6 +174,8 @@ typedef struct {
174174
daos_size_t ci_used;
175175
/** Highest (Last) aggregated epoch */
176176
daos_epoch_t ci_hae;
177+
/** latest epoch for writes that require aggregation */
178+
daos_epoch_t ci_agg_write;
177179
/** TODO */
178180
} vos_cont_info_t;
179181

src/object/srv_ec_aggregate.c

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2789,19 +2789,27 @@ cont_ec_aggregate_cb(struct ds_cont_child *cont, daos_epoch_range_t *epr,
27892789
return rc;
27902790
}
27912791

2792-
if (likely(cont->sc_ec_agg_eph_valid)) {
2793-
if (cont->sc_ec_agg_eph == 0) {
2794-
D_INFO(DF_CONT ": update cont->sc_ec_agg_eph to " DF_X64,
2795-
DP_CONT(cont->sc_pool->spc_uuid, cont->sc_uuid),
2796-
cont->sc_ec_agg_eph_boundary);
2797-
cont->sc_ec_agg_eph = cont->sc_ec_agg_eph_boundary;
2798-
}
2799-
} else {
2792+
if (!cont->sc_ec_agg_eph_valid) {
28002793
D_DEBUG(DB_EPC, DF_CONT ": pause EC aggregation for sc_ec_agg_eph_boundary.\n",
28012794
DP_CONT(cont->sc_pool->spc_uuid, cont->sc_uuid));
28022795
return 0;
28032796
}
28042797

2798+
if (cont->sc_ec_agg_eph == 0) {
2799+
D_INFO(DF_CONT ": update cont->sc_ec_agg_eph to " DF_X64,
2800+
DP_CONT(cont->sc_pool->spc_uuid, cont->sc_uuid),
2801+
cont->sc_ec_agg_eph_boundary);
2802+
cont->sc_ec_agg_eph = cont->sc_ec_agg_eph_boundary;
2803+
}
2804+
2805+
if (cont->sc_ec_update_timestamp == 0) {
2806+
vos_cont_info_t info;
2807+
2808+
/* load the timestamp of the last write that can be aggregated from VOS */
2809+
vos_cont_query(ec_agg_param->ap_cont_handle, &info);
2810+
cont->sc_ec_update_timestamp = info.ci_agg_write;
2811+
}
2812+
28052813
ec_agg_eph = cont->sc_ec_agg_eph;
28062814
ec_agg_param->ap_min_unagg_eph = DAOS_EPOCH_MAX;
28072815
if (flags & VOS_AGG_FL_FORCE_SCAN) {
@@ -2813,10 +2821,7 @@ cont_ec_aggregate_cb(struct ds_cont_child *cont, daos_epoch_range_t *epr,
28132821
ec_agg_param->ap_filter_eph = MAX(epr->epr_lo, cont->sc_ec_agg_eph);
28142822
}
28152823

2816-
/* Currently cont->sc_ec_update_timestamp is in memory so this optimization won't be helpful
2817-
* when there is no container update since restart.
2818-
*/
2819-
if (ec_agg_param->ap_filter_eph != 0 && cont->sc_ec_update_timestamp != 0 &&
2824+
if (ec_agg_param->ap_filter_eph != 0 &&
28202825
ec_agg_param->ap_filter_eph >= cont->sc_ec_update_timestamp) {
28212826
D_DEBUG(DB_EPC, DF_CONT " skip EC agg " DF_U64 ">= " DF_U64 "\n",
28222827
DP_CONT(cont->sc_pool_uuid, cont->sc_uuid), ec_agg_param->ap_filter_eph,

src/vos/vos_container.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* (C) Copyright 2016-2023 Intel Corporation.
3-
* (C) Copyright 2025 Hewlett Packard Enterprise Development LP
3+
* (C) Copyright 2025-2026 Hewlett Packard Enterprise Development LP
44
*
55
* SPDX-License-Identifier: BSD-2-Clause-Patent
66
*/
@@ -510,16 +510,23 @@ int
510510
vos_cont_query(daos_handle_t coh, vos_cont_info_t *cont_info)
511511
{
512512
struct vos_container *cont;
513+
struct vos_cont_df *cont_df;
514+
uint64_t feats;
513515

514516
cont = vos_hdl2cont(coh);
515517
if (cont == NULL) {
516518
D_ERROR("Empty container handle for querying?\n");
517519
return -DER_INVAL;
518520
}
519521

520-
cont_info->ci_nobjs = cont->vc_cont_df->cd_nobjs;
521-
cont_info->ci_used = cont->vc_cont_df->cd_used;
522-
cont_info->ci_hae = cont->vc_cont_df->cd_hae;
522+
cont_df = cont->vc_cont_df;
523+
memset(cont_info, 0, sizeof(*cont_info));
524+
cont_info->ci_nobjs = cont_df->cd_nobjs;
525+
cont_info->ci_used = cont_df->cd_used;
526+
cont_info->ci_hae = cont_df->cd_hae;
527+
528+
feats = dbtree_feats_get(&cont_df->cd_obj_root);
529+
vos_feats_agg_time_get(feats, &cont_info->ci_agg_write);
523530

524531
return 0;
525532
}

0 commit comments

Comments
 (0)