This is an automated email from the ASF dual-hosted git repository.
epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr-orbit.git
The following commit(s) were added to refs/heads/main by this push:
new 7127005e Fix the order of loading properties to properly support the
--workload-params setting (#39)
7127005e is described below
commit 7127005e835782b647b6d8252ac1f9c4d9222c8f
Author: Eric Pugh <[email protected]>
AuthorDate: Thu May 28 18:22:45 2026 -0400
Fix the order of loading properties to properly support the
--workload-params setting (#39)
Pick and chose who get merged as certain parameters we want the original
value to come through.
---
osbenchmark/workload/params.py | 9 +++++++++
tests/workload/params_test.py | 26 ++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/osbenchmark/workload/params.py b/osbenchmark/workload/params.py
index a5a53d3d..8e95e93e 100644
--- a/osbenchmark/workload/params.py
+++ b/osbenchmark/workload/params.py
@@ -330,6 +330,15 @@ class CreateCollectionParamSource(ParamSource):
p = {}
p.update(self._params)
p.update(self.collection_def)
+ # Allow operation-level params (typically supplied via
--workload-params
+ # at template-render time) to override the Collection's topology
fields.
+ # Path fields (configset, configset-path) are not overridable here:
+ # the loader has already resolved configset-path to an absolute path
+ # against the workload directory, and the operation template only
+ # carries the unresolved relative form.
+ for key in ("num-shards", "replication-factor", "tlog-replicas",
"pull-replicas"):
+ if key in self._params:
+ p[key] = self._params[key]
return p
diff --git a/tests/workload/params_test.py b/tests/workload/params_test.py
index e61c9c35..e010dc3d 100644
--- a/tests/workload/params_test.py
+++ b/tests/workload/params_test.py
@@ -1762,6 +1762,32 @@ class CreateCollectionParamSourceTests(TestCase):
with self.assertRaises(exceptions.InvalidSyntax):
params.CreateCollectionParamSource(workload=wl, params={})
+ def test_operation_params_override_collection_defaults(self):
+ col = workload.Collection(name="my-col", num_shards=1,
replication_factor=1)
+ wl = workload.Workload(name="unit-test", collections=[col])
+ ps = params.CreateCollectionParamSource(
+ workload=wl,
+ params={"collection": "my-col", "num-shards": 4,
"replication-factor": 2,
+ "tlog-replicas": 1, "pull-replicas": 3})
+ p = ps.params()
+ self.assertEqual(4, p["num-shards"])
+ self.assertEqual(2, p["replication-factor"])
+ self.assertEqual(1, p["tlog-replicas"])
+ self.assertEqual(3, p["pull-replicas"])
+
+ def test_configset_path_from_collection_wins_over_operation(self):
+ # The loader resolves configset-path to an absolute path against the
+ # workload directory; the operation template only carries the relative
+ # form. The loader-resolved path must survive.
+ col = workload.Collection(name="my-col", configset="my-col",
+
configset_path="/abs/workload/configsets/my-col")
+ wl = workload.Workload(name="unit-test", collections=[col])
+ ps = params.CreateCollectionParamSource(
+ workload=wl,
+ params={"collection": "my-col", "configset-path":
"configsets/my-col"})
+ p = ps.params()
+ self.assertEqual("/abs/workload/configsets/my-col",
p["configset-path"])
+
def test_registered_by_op_type_string(self):
col = workload.Collection(name="my-col")
wl = workload.Workload(name="unit-test", collections=[col])