-
Notifications
You must be signed in to change notification settings - Fork 307
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-6632 obj: add support for hints on the oclass generate API #4831
Changes from 3 commits
6a0bd40
b3db4a5
a3acd3b
31d40c7
1c6d5a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -976,6 +976,112 @@ daos_oclass_fit_max(daos_oclass_id_t oc_id, int domain_nr, int target_nr, | |
return oc ? 0 : -DER_NONEXIST; | ||
} | ||
|
||
int | ||
dc_set_oclass(daos_handle_t coh, int domain_nr, int target_nr, | ||
daos_ofeat_t ofeats, daos_oclass_hints_t hints, | ||
daos_oclass_id_t *oc_id_p) | ||
{ | ||
uint64_t rf_factor; | ||
daos_oclass_id_t cid = 0; | ||
struct daos_obj_class *oc; | ||
struct daos_oclass_attr ca; | ||
uint16_t shd, rdd; | ||
int grp_size; | ||
|
||
rf_factor = dc_cont_hdl2redunfac(coh); | ||
rdd = hints & DAOS_OCH_RDD_MASK; | ||
shd = hints & DAOS_OCH_SHD_MASK; | ||
|
||
/** first set a reasonable default based on RF & RDD hint (if set) */ | ||
switch (rf_factor) { | ||
case DAOS_PROP_CO_REDUN_RF0: | ||
if (rdd == DAOS_OCH_RDD_RP) | ||
cid = OC_RP_2GX; | ||
else if (rdd == DAOS_OCH_RDD_EC) | ||
cid = OC_EC_2P1G1; | ||
else | ||
cid = OC_SX; | ||
break; | ||
case DAOS_PROP_CO_REDUN_RF1: | ||
if (rdd == DAOS_OCH_RDD_RP) | ||
cid = OC_RP_2GX; | ||
else if (rdd == DAOS_OCH_RDD_EC || ofeats & DAOS_OF_ARRAY || | ||
ofeats & DAOS_OF_ARRAY_BYTE) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just confirm that does it mean that dc_array obj always map to EC ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. by default, yes if the container has RF > 0 |
||
/** TODO - this should be GX when supported */ | ||
cid = OC_EC_2P1G1; | ||
else | ||
cid = OC_RP_2GX; | ||
break; | ||
case DAOS_PROP_CO_REDUN_RF2: | ||
if (rdd == DAOS_OCH_RDD_RP) | ||
cid = OC_RP_3GX; | ||
else if (rdd == DAOS_OCH_RDD_EC || ofeats & DAOS_OF_ARRAY || | ||
ofeats & DAOS_OF_ARRAY_BYTE) | ||
/** TODO - this should be GX when supported */ | ||
cid = OC_EC_2P2G1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. must it be 2P1 or 2P2? is it possible to select 4P2, 8P2, 16P2 in future? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yea, i got those from @wangdi1 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, I mean P2 is the most popular. But I thought 4P2G1 might be most post popular choice generally. But I thought(heard) ANL might mostly use 8P2 or 16P2 for performance reason. Hmm, maybe domain_nr should be involved for consideration? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agreed that we probably need more correlation between the domain but also the target nr to set also the GX. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've added all classes (commit 806d1cf), I assume we are not going to land it to 1.2, so we can switch to new classes in follow-on patch There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we actually want to add to 1.2. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah wait.. i thought you were talking about my PR. but if we are not landing your PR to 1.2, then i can't change it here since we want to land this to 1.2. |
||
else | ||
cid = OC_RP_3GX; | ||
break; | ||
case DAOS_PROP_CO_REDUN_RF3: | ||
case DAOS_PROP_CO_REDUN_RF4: | ||
return -DER_INVAL; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. RF3/RF4 is not supported temporarily, and may be supported later? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is supported at the container level, but there is no oclass to support it today.. we need to add the oclass for it. |
||
} | ||
|
||
/* | ||
* If there are no sharding hints, we can return. | ||
* TODO - since all EC classes are only G1, no need to check sharding. | ||
* hint for that. | ||
*/ | ||
if (shd == 0 || cid == OC_EC_2P2G1 || cid == OC_EC_2P1G1) { | ||
oc = oclass_fit_max(cid, domain_nr, target_nr); | ||
if (oc) | ||
*oc_id_p = oc->oc_id; | ||
|
||
return oc ? 0 : -DER_NONEXIST; | ||
} | ||
|
||
oc = oclass_ident2cl(cid); | ||
if (!oc) | ||
return -DER_INVAL; | ||
|
||
memcpy(&ca, &oc->oc_attr, sizeof(ca)); | ||
grp_size = daos_oclass_grp_size(&ca); | ||
|
||
/** adjust the group size based on the sharding hint */ | ||
switch (shd) { | ||
case DAOS_OCH_SHD_DEF: | ||
case DAOS_OCH_SHD_MAX: | ||
ca.ca_grp_nr = DAOS_OBJ_GRP_MAX; | ||
break; | ||
case DAOS_OCH_SHD_TINY: | ||
ca.ca_grp_nr = 4; | ||
break; | ||
case DAOS_OCH_SHD_REG: | ||
ca.ca_grp_nr = max(128, target_nr * 25 / 100); | ||
break; | ||
case DAOS_OCH_SHD_HI: | ||
ca.ca_grp_nr = max(256, target_nr * 50 / 100); | ||
break; | ||
case DAOS_OCH_SHD_EXT: | ||
ca.ca_grp_nr = max(1024, target_nr * 80 / 100); | ||
break; | ||
default: | ||
D_ERROR("Invalid sharding hint\n"); | ||
return -DER_INVAL; | ||
} | ||
|
||
if (ca.ca_grp_nr == DAOS_OBJ_GRP_MAX || | ||
ca.ca_grp_nr * grp_size > target_nr) { | ||
/* search for the highest scalability in the allowed range */ | ||
ca.ca_grp_nr = max(1, (target_nr / grp_size)); | ||
} | ||
oc = oclass_scale2cl(&ca); | ||
if (oc) | ||
*oc_id_p = oc->oc_id; | ||
|
||
return oc ? 0 : -DER_NONEXIST; | ||
} | ||
|
||
/** a structure to map EC object class to EC codec structure */ | ||
struct daos_oc_ec_codec { | ||
/** object class id */ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RF0 means has no data protection right? so should be OC_SX for DAOS_OCH_RDD_RP, and seems is invalid parameter if with RF0 and rdd == DAOS_OCH_RDD_EC?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RF0 means no data protection as the minimum, but one can still do data protection, right?
this gets set when cont prop is RF0, and user says he wants replication in the hint. i think this should be valid?
if the hint is 0, it gets set to SX.
why is rdd = DAOS_OCH_RDD_EC invalid here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, this one looks fine to me.