scylla-bench icon indicating copy to clipboard operation
scylla-bench copied to clipboard

Make the test loop independent of the mode and workload

Open denesb opened this issue 6 years ago • 0 comments

Currently the inner test loop (RunTest()) depends on the WorkloadGenerator type. The workload instance is used to store the state of the test run, for those test modes and workloads that do have a state. This forces the WorkloadGenerator interface to be a union of all possible requirements for all the different modes that use it. This was not much of a problem as most workloads were very similar, differing only in whether they were stateful or not. But with the addition of efficient range scans this problem became very much apparent. Range scans are very different from single partition queries (obviously) and have very different requirements. So much so that the DoRangeScan() mode is only compatible with the specific RangeScan workload and vice-versa. To solve this the code should be refactored such that:

  • The test runner loop is only exposed a test-runner interface which contains the minimal set of operations it needs to run the test (RunOp(), IsDone(), Restart()).
  • This test instance shall be self contained, not requiring the test runner to store any external state for it.
  • Current test modes would become classes, implementing the test interface.
  • Only those modes shall accept external workload objects for which it make sense (support different workloads).
  • Workload objects shall have as narrow as possible interfaces, being specialized to the test modes they make sense for.
  • Introduce as many workload interfaces as necessary to satisfy the previous requirement.

denesb avatar Aug 24 '18 11:08 denesb