Skip to content

Commit

Permalink
Add more hierarchy to stable parameters
Browse files Browse the repository at this point in the history
This helps keep parameters organized in conf files and makes them more
human-readable.
  • Loading branch information
tristan957 committed Sep 1, 2021
1 parent 2d3d7ae commit 45b0aff
Show file tree
Hide file tree
Showing 77 changed files with 225 additions and 162 deletions.
2 changes: 1 addition & 1 deletion cli/hse_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

#define CONFIG_KVS_PFX_LEN \
{ \
"pfx_len=<int>", "Set KVS prefix length, range [0..32], default: 0" \
"prefix.length=<int>", "Set KVS prefix length, range [0..32], default: 0" \
}

#define min(a, b) \
Expand Down
18 changes: 14 additions & 4 deletions config/mongodb_imp.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
{
"kvs": {
"MainKvs": {
"value_compression": "lz4",
"pfx_pivot": 1
"compression": {
"value": {
"algorithm": "lz4"
}
},
"prefix": {
"pivot": 1
}
},
"UniqIdxKvs": {
"pfx_pivot": 1
"prefix": {
"pivot": 1
}
},
"StdIdxKvs": {
"pfx_pivot": 1
"prefix": {
"pivot": 1
}
}
}
}
18 changes: 14 additions & 4 deletions config/mongodb_ycsb.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
{
"kvs": {
"MainKvs": {
"value_compression": "lz4",
"compression": {
"value": {
"algorithm": "lz4"
}
},
"cn_cursor_vra": 0,
"pfx_pivot": 1
"prefix": {
"pivot": 1
}
},
"UniqIdxKvs": {
"pfx_pivot": 1
"prefix": {
"pivot": 1
}
},
"StdIdxKvs": {
"pfx_pivot": 1
"prefix": {
"pivot": 1
}
}
}
}
22 changes: 17 additions & 5 deletions config/mongodb_ycsb_mclass_abcdef_load.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
{
"kvs": {
"default": {
"mclass_policy": "staging_max_capacity"
"mclass": {
"policy": "staging_max_capacity"
}
},
"MainKvs": {
"value_compression": "lz4",
"pfx_pivot": 1
"compression": {
"value": {
"algorithm": "lz4"
}
},
"prefix": {
"pivot": 1
}
},
"UniqIdxKvs": {
"pfx_pivot": 1
"prefix": {
"pivot": 1
}
},
"StdIdxKvs": {
"pfx_pivot": 1
"prefix": {
"pivot": 1
}
}
}
}
22 changes: 17 additions & 5 deletions config/mongodb_ycsb_mclass_abcdef_run.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
{
"kvs": {
"default": {
"mclass_policy": "staging_max_capacity"
"mclass": {
"policy": "staging_max_capacity"
}
},
"MainKvs": {
"value_compression": "lz4",
"pfx_pivot": 1
"compression": {
"value": {
"algorithm": "lz4"
}
},
"prefix": {
"pivot": 1
}
},
"UniqIdxKvs": {
"pfx_pivot": 1
"prefix": {
"pivot": 1
}
},
"StdIdxKvs": {
"pfx_pivot": 1
"prefix": {
"pivot": 1
}
}
}
}
4 changes: 3 additions & 1 deletion config/native_ycsb_abcdf_load.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"kvs": {
"default": {
"pfx_len": 7
"prefix": {
"length": 7
}
}
}
}
4 changes: 3 additions & 1 deletion config/native_ycsb_abcdf_run.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"kvs": {
"default": {
"pfx_len": 7
"prefix": {
"length": 7
}
}
}
}
4 changes: 3 additions & 1 deletion config/native_ycsb_e_load.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"kvs": {
"default": {
"pfx_len": 7
"prefix": {
"length": 7
}
}
}
}
4 changes: 3 additions & 1 deletion config/native_ycsb_e_run.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"csched_vb_scatter_pct": 1,
"kvs": {
"default": {
"pfx_len": 7,
"prefix": {
"length": 7
},
"cn_cursor_vra": 0
}
}
Expand Down
8 changes: 6 additions & 2 deletions config/native_ycsb_mclass_abcdf_load.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"kvs": {
"default": {
"mclass_policy": "staging_max_capacity",
"pfx_len": 7
"mclass": {
"policy": "staging_max_capacity"
},
"prefix": {
"length": 7
}
}
}
}
8 changes: 6 additions & 2 deletions config/native_ycsb_mclass_abcdf_run.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"kvs": {
"default": {
"mclass_policy": "staging_max_capacity",
"pfx_len": 7
"mclass": {
"policy": "staging_max_capacity"
},
"prefix": {
"length": 7
}
}
}
}
8 changes: 6 additions & 2 deletions config/native_ycsb_mclass_e_load.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"kvs": {
"default": {
"mclass_policy": "staging_max_capacity",
"pfx_len": 7
"mclass": {
"policy": "staging_max_capacity"
},
"prefix": {
"length": 7
}
}
}
}
8 changes: 6 additions & 2 deletions config/native_ycsb_mclass_e_run.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"kvs": {
"default": {
"mclass_policy": "staging_max_capacity",
"pfx_len": 7
"mclass": {
"policy": "staging_max_capacity"
},
"prefix": {
"length": 7
}
}
}
}
4 changes: 2 additions & 2 deletions hsejni/tests/hsejni_parse_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ MTF_DEFINE_UTEST(hsejni_parse_test, blank_list)

MTF_DEFINE_UTEST(hsejni_parse_test, no_commas)
{
char raw_arg_list[] = "kvdb.open.dur_enable=false";
char raw_arg_list[] = "kvdb.open.durability.enabled=false";
size_t paramc = 0;
const char *paramv[32];

jni_hse_config_parse(&paramc, paramv, raw_arg_list, "kvdb.open.", NELEM(paramv));

ASSERT_EQ(1, paramc);
ASSERT_EQ(0, strcmp("dur_enable=false", paramv[0]));
ASSERT_EQ(0, strcmp("durability.enabled=false", paramv[0]));
}

MTF_DEFINE_UTEST(hsejni_parse_test, too_many_commas)
Expand Down
1 change: 1 addition & 0 deletions lib/config/argv.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ argv_deserialize_to_params(
}

if (!ps) {
printf("%s\n", key);
err = merr(EINVAL);
goto out;
}
Expand Down
8 changes: 4 additions & 4 deletions lib/config/param.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ param_default_populate(
*(uint64_t *)data = ps.ps_default_value.as_uscalar;
break;
case PARAM_TYPE_ENUM:
*(uint64_t *)data = ps.ps_default_value.as_enum;
*(uint32_t *)data = ps.ps_default_value.as_enum;
break;
case PARAM_TYPE_STRING:
if (ps.ps_default_value.as_string) {
Expand Down Expand Up @@ -226,9 +226,9 @@ param_default_converter(const struct param_spec *ps, const cJSON *node, void *va
const double to_conv = cJSON_GetNumberValue(node);
if (!IS_WHOLE(to_conv))
return false;
if (to_conv < 0 || to_conv > (double)UINT64_MAX)
if (to_conv < 0 || to_conv > (double)UINT32_MAX)
return false;
*(uint64_t *)value = (uint64_t)to_conv;
*(uint32_t *)value = (uint32_t)to_conv;
break;
case PARAM_TYPE_STRING:
if (cJSON_IsNull(node)) {
Expand Down Expand Up @@ -296,7 +296,7 @@ param_default_validator(const struct param_spec *ps, const void *value)
return tmp >= ps->ps_bounds.as_uscalar.ps_min && tmp <= ps->ps_bounds.as_uscalar.ps_max;
}
case PARAM_TYPE_ENUM: {
const uint64_t tmp = *((uint64_t *)value);
const uint32_t tmp = *((uint32_t *)value);
return tmp >= ps->ps_bounds.as_enum.ps_min && tmp <= ps->ps_bounds.as_enum.ps_max;
}
case PARAM_TYPE_STRING: {
Expand Down
2 changes: 1 addition & 1 deletion lib/include/hse_ikvdb/vcomp_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifndef HSE_VCOMP_PARAMS_H
#define HSE_VCOMP_PARAMS_H

#define VCOMP_PARAM_NONE NULL
#define VCOMP_PARAM_NONE "none"
#define VCOMP_PARAM_LZ4 "lz4"

enum vcomp_algorithm
Expand Down
12 changes: 6 additions & 6 deletions lib/kvdb/kvdb_cparams.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

static const struct param_spec pspecs[] = {
{
.ps_name = "storage.capacity.fmaxsz",
.ps_name = "storage.capacity.file.max_size",
.ps_description = "file size in capacity mclass (GiB)",
.ps_flags = PARAM_FLAG_EXPERIMENTAL,
.ps_type = PARAM_TYPE_U64,
Expand All @@ -38,7 +38,7 @@ static const struct param_spec pspecs[] = {
}
},
{
.ps_name = "storage.capacity.mblocksz",
.ps_name = "storage.capacity.mblock.size",
.ps_description = "object size in capacity mclass (MiB)",
.ps_flags = PARAM_FLAG_EXPERIMENTAL,
.ps_type = PARAM_TYPE_U64,
Expand All @@ -57,7 +57,7 @@ static const struct param_spec pspecs[] = {
}
},
{
.ps_name = "storage.capacity.filecnt",
.ps_name = "storage.capacity.file.count",
.ps_description = "file count in capacity mclass",
.ps_flags = PARAM_FLAG_EXPERIMENTAL,
.ps_type = PARAM_TYPE_U8,
Expand Down Expand Up @@ -93,7 +93,7 @@ static const struct param_spec pspecs[] = {
},
},
{
.ps_name = "storage.staging.fmaxsz",
.ps_name = "storage.staging.file.max_size",
.ps_description = "file size in staging mclass (GiB)",
.ps_flags = PARAM_FLAG_EXPERIMENTAL,
.ps_type = PARAM_TYPE_U64,
Expand All @@ -112,7 +112,7 @@ static const struct param_spec pspecs[] = {
},
},
{
.ps_name = "storage.staging.mblocksz",
.ps_name = "storage.staging.mblock.size",
.ps_description = "object size in staging mclass (MiB)",
.ps_flags = PARAM_FLAG_EXPERIMENTAL,
.ps_type = PARAM_TYPE_U64,
Expand All @@ -131,7 +131,7 @@ static const struct param_spec pspecs[] = {
},
},
{
.ps_name = "storage.staging.filecnt",
.ps_name = "storage.staging.file.count",
.ps_description = "file count in staging mclass",
.ps_flags = PARAM_FLAG_EXPERIMENTAL,
.ps_type = PARAM_TYPE_U8,
Expand Down
Loading

0 comments on commit 45b0aff

Please sign in to comment.