Usually, in Workgen tables are created at the start and then a workload is executed on them (see example_simple.py).
As part of PM-2712, one of the requirements is to continuously create tables, even after the workload has started.
This ticket needs to update Workgen so a new table can be added/visible to the internal variables in Workgen at any time. This could be a simple API called add_table. The Python interface should be updated as well.
There are a set of internal variables in Workgen related to the existing tables:
// A 'tint' or ('table integer') is a unique small value integer // assigned to each table URI in use. Currently, we assign it once, // and its value persists through the lifetime of the Context. typedef uint32_t tint_t; ... std::map<tint_t, uint32_t> _table_usage; // value is Usage WT_CURSOR **_cursors; // indexed by tint_t ... std::map<std::string, tint_t> _tint; // maps uri -> tint_t std::map<tint_t, std::string> _table_names; // reverse mapping TableRuntime *_table_runtime; // # entries per tint_t uint32_t _runtime_alloced; // length of _table_runtime tint_t _tint_last; // last tint allocated
All those should be updated safely and for this purpose, a locking mechanism should be implemented.