SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
load_generator.cc
Go to the documentation of this file.
1 /*
2  * SWC-DB© Copyright since 2019 Alex Kashirin <kashirin.alex@gmail.com>
3  * License details at <https://github.com/kashirin-alex/swc-db/#license>
4  */
5 
8 
10 
14 
17 
21 
23 
24 #include <random>
25 
26 
27 
28 namespace SWC {
29 
30 
31 namespace Utils {
32 
33 
39 namespace LoadGenerator {
40 
41 
42 // Distrbution Sequence
43 
44 enum Distrib : uint8_t {
46  STEPPING = 1,
47  UNIFORM = 2
48 };
49 
50 int from_string_distrib(const std::string& typ) {
51  switch(typ.length()) {
52  case 1: {
53  switch(*typ.data()) {
54  case '0':
55  return Distrib::SEQUENTIAL;
56  case '1':
57  return Distrib::UNIFORM;
58  case '2':
59  return Distrib::STEPPING;
60  default:
61  SWC_THROW(Error::CONFIG_BAD_VALUE, "Unrecognized Distribution");
62  }
63  break;
64  }
65  default: {
66  if(Condition::str_case_eq(typ.data(), "SEQUENTIAL", 10))
67  return Distrib::SEQUENTIAL;
68  if(Condition::str_case_eq(typ.data(),"UNIFORM", 7))
69  return Distrib::UNIFORM;
70  if(Condition::str_case_eq(typ.data(),"STEPPING", 8))
71  return Distrib::STEPPING;
72  break;
73  }
74  }
75  SWC_THROW(Error::CONFIG_BAD_VALUE, "Unrecognized Distribution");
76 }
77 
78 std::string repr_distrib(int typ) {
79  switch(typ) {
80  case 0:
81  return "SEQUENTIAL";
82  case 1:
83  return "UNIFORM";
84  case 2:
85  return "STEPPING";
86  }
87  SWC_THROW(Error::CONFIG_BAD_VALUE,"Unrecognized Distribution");
88 }
89 
90 // Distrbution Course
91 enum DistribCourse : uint8_t {
92  STEP = 0,
93  R_STEP = 1,
94  SINGLE = 2,
95  R_SINGLE = 3,
96  LEVELS = 4,
97  R_LEVELS = 5
98 };
99 
100 int from_string_distrib_course(const std::string& typ) {
101  switch(typ.length()) {
102  case 1: {
103  switch(*typ.data()) {
104  case '0':
105  return DistribCourse::STEP;
106  case '1':
107  return DistribCourse::R_STEP;
108  case '2':
109  return DistribCourse::SINGLE;
110  case '3':
112  case '4':
113  return DistribCourse::LEVELS;
114  case '5':
116  default:
117  SWC_THROW(
118  Error::CONFIG_BAD_VALUE, "Unrecognized Distribution Course");
119  }
120  break;
121  }
122  default: {
123  if(Condition::str_case_eq(typ.data(), "STEP", 4))
124  return DistribCourse::STEP;
125  if(Condition::str_case_eq(typ.data(),"R_STEP", 6))
126  return DistribCourse::R_STEP;
127  if(Condition::str_case_eq(typ.data(),"SINGLE", 6))
128  return DistribCourse::SINGLE;
129  if(Condition::str_case_eq(typ.data(),"R_SINGLE", 8))
131  if(Condition::str_case_eq(typ.data(),"LEVELS", 6))
132  return DistribCourse::LEVELS;
133  if(Condition::str_case_eq(typ.data(),"R_LEVELS", 8))
135  break;
136  }
137  }
138  SWC_THROW(Error::CONFIG_BAD_VALUE, "Unrecognized Distribution Course");
139 }
140 
141 std::string repr_distrib_course(int typ) {
142  switch(typ) {
143  case 0:
144  return "STEP";
145  case 1:
146  return "R_STEP";
147  case 2:
148  return "SINGLE";
149  case 3:
150  return "R_SINGLE";
151  case 4:
152  return "LEVELS";
153  case 5:
154  return "R_LEVELS";
155  }
156  SWC_THROW(Error::CONFIG_BAD_VALUE,"Unrecognized Distribution Course");
157 }
158 
159 } } // namespace Utils::LoadGenerator
160 
161 
162 
163 
164 namespace Config {
165 
166 void init_app_options(Settings* settings) {
167  init_comm_options(settings);
168  init_client_options(settings);
169 
170  Property::Value::get_pointer<Property::Value_enum_g>(
171  settings->cmdline_desc.get_default("swc.logging.level")
172  )->set(LOG_ERROR); // default level
173 
174  settings->cmdline_desc.definition(settings->usage_str(
175  "SWC-DB(load_generator) Usage: swcdb_load_generator [options]\n\nOptions:")
176  );
177 
178  settings->cmdline_desc.add_options()
179  ("with-broker", boo(false)->zero_token(),
180  "Query applicable requests with Broker")
181 
182  ("gen-handlers", i32(8), "Number of client Handlers")
183 
184  ("gen-insert", boo(true), "Generate new data")
185  ("gen-select", boo(false), "Select generated data")
186  ("gen-delete", boo(false), "Delete generated data")
187 
188  ("gen-select-empty", boo(false), "Expect empty select results")
189  ("gen-delete-column", boo(false), "Delete Column after")
190 
191  ("gen-progress", i32(100000),
192  "display progress every N cells or 0 for quiet")
193  ("gen-cell-a-time", boo(false), "Write one cell at a time")
194 
195  ("gen-cells", i64(1000),
196  "number of cells, total=cells*versions*(is SINGLE?1:fractions*onLevel)")
197  ("gen-cells-on-level", i64(1),
198  "number of cells, on fraction level")
199 
200  ("gen-fractions", i32(10),
201  "Number of Fractions per cell key")
202  ("gen-fraction-size", i32(10),
203  "fraction size in bytes at least")
204 
205  ("gen-distrib-seed", i64(1),
206  "Use this seed/step for Distribution injection")
207  ("gen-distrib-course",
212  ),
213  "Fractions distrib Course STEP|R_STEP|SINGLE|R_SINGLE|LEVELS|R_LEVELS")
214  ("gen-distrib",
219  ),
220  "Distribution SEQUENTIAL|STEPPING|UNIFORM")
221 
222  ("gen-value-size", i32(256),
223  "cell value in bytes or counts for a col-counter")
224 
225  ("gen-col-name", str("load_generator-"),
226  "Gen. load column name, joins with colm-number")
227  ("gen-col-number", i32(1),
228  "Number of columns to generate")
229 
230  ("gen-col-seq",
231  g_enum(
232  int(DB::Types::KeySeq::LEXIC),
233  nullptr,
236  ),
237  "Schema col-seq FC_+|LEXIC|VOLUME")
238 
239  ("gen-col-type",
240  g_enum(
241  int(DB::Types::Column::PLAIN),
242  nullptr,
245  ),
246  "Schema col-type PLAIN|COUNTER_I{64,32,16,8}|SERIAL")
247 
248  ("gen-versions", i32(1), "number of cell versions to generate")
249  ("gen-cell-versions", i32(1), "cell key schema-versions")
250  ("gen-cell-encoding",
251  g_enum(
252  int(DB::Types::Encoder::PLAIN),
253  nullptr,
256  ),
257  "Cell's Value encoding ZSTD|SNAPPY|ZLIB")
258 
259  ("gen-cs-count", i8(0), "Schema cs-count")
260  ("gen-cs-size", i32(0), "Schema cs-size")
261  ("gen-cs-replication", i8(0), "Schema cs-replication")
262 
263  ("gen-blk-size", i32(0), "Schema blk-size")
264  ("gen-blk-cells", i32(0), "Schema blk-cells")
265  ("gen-blk-encoding",
266  g_enum(
268  nullptr,
271  ),
272  "Schema blk-encoding NONE|ZSTD|SNAPPY|ZLIB")
273 
274  ("gen-log-rollout", i8(0),
275  "CommitLog rollout block ratio")
276  ("gen-log-compact-cointervaling", i8(0),
277  "CommitLog minimal cointervaling Fragments for compaction")
278  ("gen-log-preload", i8(0),
279  "Number of CommitLog Fragments to preload")
280 
281  ("gen-compaction-percent", i8(0),
282  "Compaction threshold in % applied over size of either by cellstore or block")
283  ;
284 }
285 
286 
287 } // namespace Config
288 
289 
290 
291 
292 namespace Utils { namespace LoadGenerator {
293 
294 
295 void quit_error(int err) {
296  if(!err)
297  return;
298  SWC_PRINT << "Error " << err << "(" << Error::get_text(err) << ")"
299  << SWC_PRINT_CLOSE;
300  SWC_QUICK_EXIT(EXIT_FAILURE);
301 }
302 
303 
305  FractionState(size_t a_value) : value(a_value) { }
306  virtual ~FractionState() { }
307  virtual void reset() {
308  value = 0;
309  }
310  virtual void set_value() = 0;
311  size_t value;
312 };
313 
315  FractionStateDistSeq(size_t a_ncells, bool a_reverse)
316  : FractionState(a_reverse ? (a_ncells + 1) : 0),
317  ncells(a_ncells), reverse(a_reverse) {
318  }
319 
320  virtual ~FractionStateDistSeq() noexcept { }
321 
322  virtual void set_value() override {
323  if(reverse) {
324  if(!--value) {
325  value = ncells;
326  }
327  } else {
328  if(++value > ncells)
329  value = 1;
330  }
331  }
332  const size_t ncells;
333  const bool reverse;
334 };
335 
337  FractionStateDistStepping(size_t a_ncells, size_t a_step, bool a_reverse)
338  : FractionState(a_reverse ? (a_ncells + 1) : 0),
339  ncells(a_ncells), step(a_step), reverse(a_reverse), offset(0) {
340  }
341 
342  virtual ~FractionStateDistStepping() noexcept { }
343 
344  virtual void reset() override {
346  offset = 0;
347  }
348 
349  virtual void set_value() override {
350  if(reverse) {
351  if(value <= step) {
352  if(offset == ncells)
353  offset = 0;
354  value = ncells - offset;
355  ++offset;
356  } else {
357  value -= step;
358  }
359  } else {
360  value += step;
361  if(value > ncells) {
362  if(++offset > ncells)
363  offset = 1;
364  value = offset;
365  }
366  }
367  }
368  const size_t ncells;
369  const size_t step;
370  const bool reverse;
371  size_t offset;
372 };
373 
375  FractionStateDistUniform(size_t a_ncells, size_t seed)
376  : FractionState(0), gen(seed), distrib(1, a_ncells) {
377  }
378 
379  virtual ~FractionStateDistUniform() noexcept { }
380 
381  virtual void set_value() override {
382  value = distrib(gen);
383  }
384 
385  std::mt19937 gen;
386  std::uniform_int_distribution<size_t> distrib;
387 };
388 
389 
390 
392  public:
393  const size_t ncells;
394  const size_t ncells_onlevel;
399 
400  KeyGenerator(size_t a_ncells, size_t a_ncells_onlevel,
401  uint24_t a_fraction_size, uint24_t a_nfractions,
402  Distrib a_distribution, DistribCourse a_course, size_t seed)
403  : ncells(a_ncells), ncells_onlevel(a_ncells_onlevel),
404  nfractions(a_nfractions), fraction_size(a_fraction_size),
405  distribution(a_distribution), course(a_course),
407  _fractions_state() {
408  if(ncells_onlevel > 1 && (
413  SWC_THROW(
415  "Not supported SINGLE|LEVELS Distribution Course with onlevel > 1");
416 
417  bool reverse = course == DistribCourse::R_STEP ||
420  for(uint24_t n=1; n<=nfractions; ++n) {
421  switch(distribution) {
422  case Distrib::SEQUENTIAL: {
423  if(seed > 1) {
425  "Not supported SEQUENTIAL Distribution with seed > 1");
426  }
427  _fractions_state.emplace_back(
429  ncells * ncells_onlevel, reverse));
430  break;
431  }
432  case Distrib::STEPPING: {
436  "Not supported STEPPING Distribution with LEVELS");
437  }
438  if(ncells_onlevel > 1 && seed > 1 && (
442  "Not supported STEP Distribution Course with"
443  " onlevel > 1 and step > 1");
444  }
445 
446  _fractions_state.emplace_back(
448  ncells * ncells_onlevel, seed, reverse));
449  break;
450  }
451  case Distrib::UNIFORM:
452  _fractions_state.emplace_back(
454  ncells * ncells_onlevel, seed));
455  break;
456  }
457  }
458  }
459 
460  ~KeyGenerator() noexcept { }
461 
463  switch(course) {
466  if(++_ncells > ncells)
467  return false;
468  for(auto& state : _fractions_state)
469  state->set_value();
471  return true;
472  }
473 
474  case DistribCourse::LEVELS: {
475  if(++_ncells > ncells || !_nfractions) {
476  if(++_nfractions > nfractions)
477  return false;
478  _ncells = 1;
479  }
480  for(uint24_t n=0; n<_nfractions;++n)
481  _fractions_state[n]->set_value();
482  return true;
483  }
484 
486  if(!_nfractions)
488  if(++_ncells > ncells) {
489  if(!--_nfractions)
490  return false;
491  _ncells = 1;
492  }
493  for(auto& state : _fractions_state)
494  state->set_value();
495  return true;
496  }
497 
498  case DistribCourse::STEP: {
500  if(!_nfractions || ++_nfractions > nfractions) {
501  ++_ncells;
502  _nfractions = 1;
503  }
504  _ncells_onlevel = 0;
505  }
506  _fractions_state[_nfractions - 1]->set_value();
507  return _ncells <= ncells;
508  }
509 
510  case DistribCourse::R_STEP: {
512  if(!_nfractions || !--_nfractions) {
513  ++_ncells;
515  for(auto& state : _fractions_state)
516  state->set_value();
517  }
518  _ncells_onlevel = 0;
519  } else {
520  _fractions_state[_nfractions - 1]->set_value();
521  }
522  return _ncells <= ncells;
523  }
524  }
525 
526  SWC_THROW(Error::CONFIG_BAD_VALUE, "Unrecognized Distribution Course");
527  }
528 
529  protected:
530  size_t _ncells;
534 };
535 
536 
538  public:
539  KeyGeneratorUpdate(size_t a_ncells, size_t a_ncells_onlevel,
540  uint24_t a_fraction_size, uint24_t a_nfractions,
541  Distrib a_distribution, DistribCourse a_course, size_t seed)
542  : KeyGenerator(
543  a_ncells, a_ncells_onlevel,
544  a_fraction_size, a_nfractions,
545  a_distribution, a_course, seed
546  ),
547  _fractions() {
549  }
550 
551  ~KeyGeneratorUpdate() noexcept { }
552 
553  bool next(DB::Cell::Key& key) {
554  if(!next_n_fraction())
555  return false;
556 
558  size_t fn = 0;
559  for(auto& fraction : _fractions) {
560  fraction = std::to_string(_fractions_state[fn]->value);
561  if(fraction_size > fraction.length())
562  fraction.insert(0, fraction_size - fraction.length(), '0');
563  ++fn;
564  }
565  key.free();
566  key.add(_fractions);
567  _fractions.clear();
568  return true;
569  }
570 
571  private:
573 };
574 
575 
577  public:
578  KeyGeneratorSelect(size_t a_ncells, size_t a_ncells_onlevel,
579  uint24_t a_fraction_size, uint24_t a_nfractions,
580  Distrib a_distribution, DistribCourse a_course, size_t seed)
581  : KeyGenerator(
582  a_ncells, a_ncells_onlevel,
583  a_fraction_size, a_nfractions,
584  a_distribution, a_course, seed) {
585  }
586 
587  ~KeyGeneratorSelect() noexcept { }
588 
589  bool next(DB::Specs::Key& key) {
590  if(!next_n_fraction())
591  return false;
592 
593  key.clear();
594  key.resize(_nfractions);
595  size_t fn = 0;
596  for(auto& fraction : key) {
597  fraction.comp = Condition::EQ;
598  fraction = std::to_string(_fractions_state[fn]->value);
599  if(fraction_size > fraction.length())
600  fraction.insert(0, fraction_size - fraction.length(), '0');
601  ++fn;
602  }
603  return true;
604  }
605 
606 };
607 
608 
609 
610 
611 void update_data(const DB::SchemasVec& schemas, uint8_t flag, size_t seed) {
612  auto settings = Env::Config::settings();
613 
614  uint32_t versions = flag == DB::Cells::INSERT
615  ? settings->get_i32("gen-versions")
616  : 1;
617 
618  uint32_t nfractions = settings->get_i32("gen-fractions");
619  uint32_t fraction_size = settings->get_i32("gen-fraction-size");
620 
621  uint64_t ncells = settings->get_i64("gen-cells");
622  uint64_t ncells_onlevel = settings->get_i64("gen-cells-on-level");
623 
624  Distrib distribution = Distrib(settings->get_enum("gen-distrib"));
625  DistribCourse course = DistribCourse(settings->get_enum("gen-distrib-course"));
626 
627  uint32_t value = flag == DB::Cells::INSERT
628  ? settings->get_i32("gen-value-size")
629  : 1;
630 
631  uint32_t progress = settings->get_i32("gen-progress");
632  bool cellatime = settings->get_bool("gen-cell-a-time");
633 
634  auto cell_encoder = DB::Types::Encoder(settings->get_genum(
635  "gen-cell-encoding"));
636 
638 
641  nullptr,
642  nullptr,
643  settings->get_bool("with-broker")
646  );
647  colms.reserve(schemas.size());
648  for(auto& schema : schemas)
649  colms.push_back(hdlr->create(schema).get());
650 
651  size_t added_count = 0;
652  size_t resend_cells = 0;
653  size_t added_bytes = 0;
654  DB::Cells::Cell cell;
655  cell.flag = flag;
656  cell.set_time_order_desc(true);
657 
658 
659  bool is_counter = DB::Types::is_counter(schemas.front()->col_type);
660  bool is_serial = schemas.front()->col_type == DB::Types::Column::SERIAL;
661  std::string value_data;
662  if(flag == DB::Cells::INSERT && !is_counter) {
663  uint8_t c=122;
664  for(uint32_t n=0; n<value;++n)
665  value_data += char(c == 122 ? c = 97 : ++c);
666  }
667 
668  Time::Measure_ns t_measure;
669  Time::Measure_ns t_progress;
670 
671  for(uint32_t v=0; v<versions; ++v) {
672  for(uint32_t count=is_counter ? value : 1; count > 0; --count) {
673 
674  KeyGeneratorUpdate key_gen(
675  ncells, ncells_onlevel,
676  fraction_size, nfractions,
677  distribution, course, seed
678  );
679  while(key_gen.next(cell.key)) {
680  if(flag == DB::Cells::INSERT) {
681  if(is_counter) {
682  cell.set_counter(0, 1, schemas.front()->col_type);
683 
684  } else if(is_serial) {
685 
687  wfields.ensure(value_data.size() * 10);
689  for(auto it= value_data.cbegin(); it != value_data.cend(); ++it) {
691  wfields.add(int64_t(*it));
693  } else if(t == DB::Cell::Serial::Value::Type::DOUBLE) {
694  long double v_d(*it);
695  wfields.add(v_d);
697  } else if(t == DB::Cell::Serial::Value::Type::BYTES) {
698  const uint8_t c = *it;
699  wfields.add(&c, 1);
701  }
702  }
703 
704  if(cell_encoder == DB::Types::Encoder::PLAIN) {
705  cell.set_value(wfields.base, wfields.fill(), true);
706  } else {
707  cell.set_value(cell_encoder, wfields.base, wfields.fill());
708  }
709 
710  } else if(cell_encoder == DB::Types::Encoder::PLAIN) {
711  cell.set_value(value_data, false);
712  } else {
713  cell.set_value(cell_encoder, value_data);
714  }
715  }
716 
717  for(auto& col : colms) {
718  col->add(cell);
719 
720  ++added_count;
721  added_bytes += cell.encoded_length();
722  if(cellatime) {
723  hdlr->commit(col);
724  hdlr->wait();
725  } else {
726  hdlr->commit_or_wait();
727  }
728  }
729 
730  if(progress && !(added_count % progress)) {
731  SWC_PRINT
732  << "update-progress(time_ns=" << Time::now_ns()
733  << " cells=" << added_count
734  << " bytes=" << added_bytes
735  << " avg=" << t_progress.elapsed()/progress << "ns/cell) ";
736  hdlr->profile.finished();
737  hdlr->profile.print(SWC_LOG_OSTREAM);
739  t_progress.restart();
740  }
741  }
742  resend_cells += hdlr->get_resend_count();
743  }
744  }
745 
746  hdlr->commit_if_need();
747  hdlr->wait();
748 
749  resend_cells += hdlr->get_resend_count();
750  SWC_ASSERT(added_count && added_bytes);
751 
752  Common::Stats::FlowRate::Data rate(added_bytes, t_measure.elapsed());
753  SWC_PRINT << std::endl << std::endl;
754  rate.print_cells_statistics(SWC_LOG_OSTREAM, added_count, resend_cells);
755  hdlr->profile.display(SWC_LOG_OSTREAM);
757 }
758 
759 
760 void select_data(const DB::SchemasVec& schemas, size_t seed) {
761  auto settings = Env::Config::settings();
762 
763  bool expect_empty = settings->get_bool("gen-select-empty");
764 
765  uint32_t versions = settings->get_i32("gen-cell-versions");
766  uint32_t nfractions = settings->get_i32("gen-fractions");
767  uint32_t fraction_size = settings->get_i32("gen-fraction-size");
768 
769  uint64_t ncells = settings->get_i64("gen-cells");
770  uint64_t ncells_onlevel = settings->get_i64("gen-cells-on-level");
771 
772  Distrib distribution = Distrib(settings->get_enum("gen-distrib"));
773  DistribCourse course = DistribCourse(settings->get_enum("gen-distrib-course"));
774 
775  uint32_t progress = settings->get_i32("gen-progress");
776  bool cellatime = settings->get_bool("gen-cell-a-time");
777  bool with_broker = settings->get_bool("with-broker");
778 
779  size_t select_count = 0;
780  size_t select_bytes = 0;
781 
782  if(DB::Types::is_counter(schemas.front()->col_type))
783  versions = 1;
784 
785  Time::Measure_ns t_measure;
786  Time::Measure_ns t_progress;
787 
788  if(cellatime) {
789  client::Query::Profiling profiling;
790  KeyGeneratorSelect key_gen(
791  ncells, ncells_onlevel,
792  fraction_size, nfractions,
793  distribution, course, seed
794  );
795 
796  DB::Specs::Key key_spec;
797  while(key_gen.next(key_spec)) {
798 
799  DB::Specs::Interval intval;
800  intval.key_intervals.add().start.move(key_spec);
801  intval.set_opt__key_equal();
802  intval.flags.limit = versions;
803 
806  nullptr, false, nullptr,
807  with_broker
810  );
811  for(auto& schema : schemas)
812  hdlr->scan(schema, std::move(intval));
813 
814  hdlr->wait();
815  if(expect_empty) {
816  SWC_ASSERT(hdlr->empty());
817  } else {
818  for(auto& schema : schemas)
819  SWC_ASSERT(hdlr->get_size(schema->cid) == versions);
820  }
821 
822  select_bytes += hdlr->get_size_bytes();
823  ++select_count;
824 
825  profiling += hdlr->profile;
826  if(progress && !(select_count % progress)) {
827  SWC_PRINT
828  << "select-progress(time_ns=" << Time::now_ns()
829  << " cells=" << select_count
830  << " avg=" << t_progress.elapsed()/progress << "ns/cell) ";
831  hdlr->profile.print(SWC_LOG_OSTREAM);
833  t_progress.restart();
834  }
835  }
836  if(expect_empty)
837  select_count = 0;
838  profiling.finished();
839 
840  Common::Stats::FlowRate::Data rate(select_bytes, t_measure.elapsed());
841  SWC_PRINT << std::endl << std::endl;
842  rate.print_cells_statistics(SWC_LOG_OSTREAM, select_count, 0);
843  profiling.display(SWC_LOG_OSTREAM);
845 
846  } else {
847  DB::Specs::Scan specs;
848  for(auto& schema : schemas) {
849  specs.columns.emplace_back(schema->cid).add(schema->col_type);
850  }
853  [&select_bytes, &select_count, &schemas]
855  for(auto& schema : schemas) {
856  DB::Cells::Result cells;
857  _hdlr->get_cells(schema->cid, cells);
858  select_count += cells.size();
859  select_bytes += cells.size_bytes();
860  }
861  },
862  true,
863  nullptr,
864  with_broker
867  );
868  int err = Error::OK;
869  hdlr->scan(err, std::move(specs));
870  SWC_ASSERT(!err);
871 
872  hdlr->wait();
873  SWC_ASSERT(
874  expect_empty
875  ? hdlr->empty()
876  : select_count == versions * ncells * ncells_onlevel * schemas.size() * (
877  course == DistribCourse::SINGLE || course == DistribCourse::R_SINGLE
878  ? 1 : nfractions)
879  );
880 
881  Common::Stats::FlowRate::Data rate(select_bytes, t_measure.elapsed());
882  SWC_PRINT << std::endl << std::endl;
883  rate.print_cells_statistics(SWC_LOG_OSTREAM, select_count, 0);
884  hdlr->profile.display(SWC_LOG_OSTREAM);
886  }
887 }
888 
889 
890 void make_work_load(const DB::SchemasVec& schemas) {
891  auto settings = Env::Config::settings();
892 
893  size_t seed = settings->get_i64("gen-distrib-seed");
894 
895  if(settings->get_bool("gen-insert"))
896  update_data(schemas, DB::Cells::INSERT, seed);
897 
898  if(settings->get_bool("gen-select"))
899  select_data(schemas, seed);
900 
901  if(settings->get_bool("gen-delete"))
902  update_data(schemas, DB::Cells::DELETE_LE, seed);
903 
904  if(settings->get_bool("gen-delete-column")) {
905  int err = Error::OK;
906  bool with_broker = Env::Config::settings()->get_bool("with-broker");
907  auto func = Comm::Protocol::Mngr::Params::ColumnMng::Function::REMOVE;
908  for(auto& schema : schemas) {
909  with_broker
911  func, schema, 10000, Env::Clients::get(), err)
913  func, schema, 10000, Env::Clients::get(), err);
914  quit_error(err);
915  }
916  }
917 
918 }
919 
920 
921 void generate() {
922  auto settings = Env::Config::settings();
923 
924  std::string col_name(settings->get_str("gen-col-name"));
925 
926  uint32_t ncolumns(settings->get_i32("gen-col-number"));
927 
929  patterns.names.push_back(DB::Schemas::Pattern(Condition::PF, col_name));
930 
931  DB::SchemasVec schemas;
932  int err = Error::OK;
933  Env::Clients::get()->get_schema(err, patterns, schemas);
934  if(schemas.size() == ncolumns) {
935  quit_error(err);
936  make_work_load(schemas);
937  return;
938  }
939  err = Error::OK;
940 
941  for(uint32_t ncol=1; ncol<=ncolumns; ++ncol) {
942  auto schema = DB::Schema::make();
943  schema->col_name = col_name + std::to_string(ncol);
944  schema->col_seq = DB::Types::KeySeq(
945  settings->get_genum("gen-col-seq"));
946  schema->col_type = DB::Types::Column(
947  settings->get_genum("gen-col-type"));
948  schema->cell_versions = settings->get_i32("gen-cell-versions");
949  schema->cell_ttl = 0;
950  schema->blk_encoding = DB::Types::Encoder(
951  settings->get_genum("gen-blk-encoding"));
952  schema->blk_size = settings->get_i32("gen-blk-size");
953  schema->blk_cells = settings->get_i32("gen-blk-cells");
954  schema->cs_replication = settings->get_i8("gen-cs-replication");
955  schema->cs_size = settings->get_i32("gen-cs-size");
956  schema->cs_max = settings->get_i8("gen-cs-count");
957  schema->log_rollout_ratio = settings->get_i8("gen-log-rollout");
958  schema->log_compact_cointervaling = settings->get_i8(
959  "gen-log-compact-cointervaling");
960  schema->log_fragment_preload = settings->get_i8("gen-log-preload");
961 
962  schema->compact_percent = settings->get_i8("gen-compaction-percent");
963 
964  // CREATE COLUMN
965  auto func = Comm::Protocol::Mngr::Params::ColumnMng::Function::CREATE;
966  Env::Config::settings()->get_bool("with-broker")
968  func, schema, 10000, Env::Clients::get(), err)
970  func, schema, 10000, Env::Clients::get(), err);
971  quit_error(err);
972  }
973 
974  schemas.clear();
975  Env::Clients::get()->get_schema(err, patterns, schemas);
976  if(schemas.size() != ncolumns)
978 
979  make_work_load(schemas);
980 }
981 
982 
983 }}} // namespace SWC::Utils::LoadGenerator
984 
985 
986 
987 int run(int argc, char** argv) {
989 
990  auto settings = SWC::Env::Config::settings();
991 
992  auto io = SWC::Comm::IoContext::make(
993  "LoadGenerator",
994  settings->get_i32("gen-handlers")
995  );
996 
998  (settings->get_bool("with-broker")
1000  *settings,
1001  io,
1002  nullptr // std::make_shared<client::BrokerContext>()
1003  )
1005  *settings,
1006  io,
1007  nullptr, // std::make_shared<client::ManagerContext>()
1008  nullptr // std::make_shared<client::RangerContext>()
1009  )
1010  )->init()
1011  );
1012 
1013  auto period = settings->get<
1014  SWC::Config::Property::Value_int32_g>("swc.cfg.dyn.period");
1015  if(period->get()) {
1016  io->set_periodic_timer(
1017  period,
1018  []() noexcept { SWC::Env::Config::settings()->check_dynamic_files(); }
1019  );
1020  }
1021 
1023 
1024  SWC_CAN_QUICK_EXIT(EXIT_SUCCESS);
1025 
1026 
1027  SWC::Env::Clients::get()->stop();
1028  std::this_thread::sleep_for(std::chrono::seconds(2));
1031  std::this_thread::sleep_for(std::chrono::seconds(1));
1032 
1033  return 0;
1034 }
1035 
1036 int main(int argc, char** argv) {
1037  return run(argc, argv);
1038 }
SWC::DB::Cells::Cell::set_counter
void set_counter(uint8_t op, int64_t v, Types::Column typ=Types::Column::COUNTER_I64, int64_t rev=TIMESTAMP_NULL)
Definition: Cell.h:450
SWC::Config::i32
Property::Value_int32::Ptr i32(const int32_t &v)
Definition: PropertiesParser.cc:33
SWC::Core::Vector::front
constexpr SWC_CAN_INLINE reference front() noexcept
Definition: Vector.h:243
SWC::Utils::LoadGenerator::FractionStateDistUniform::~FractionStateDistUniform
virtual ~FractionStateDistUniform() noexcept
Definition: load_generator.cc:379
SWC::Utils::LoadGenerator::FractionStateDistSeq::reverse
const bool reverse
Definition: load_generator.cc:333
SWC::client::Query::Select::Handlers::Common::make
static SWC_CAN_INLINE Ptr make(const Clients::Ptr &clients, Cb_t &&cb=nullptr, bool rsp_partials=false, const Comm::IoContextPtr &io=nullptr, Clients::Flag executor=Clients::DEFAULT)
Definition: Common.h:26
SWC::Utils::LoadGenerator::FractionStateDistUniform
Definition: load_generator.cc:374
SWC::DB::Cells::Cell::set_value
SWC_CAN_INLINE void set_value(uint8_t *v, uint32_t len, bool owner)
Definition: Cell.h:223
SWC::Utils::LoadGenerator::repr_distrib
std::string repr_distrib(int typ)
Definition: load_generator.cc:78
SWC::Utils::LoadGenerator::FractionStateDistUniform::distrib
std::uniform_int_distribution< size_t > distrib
Definition: load_generator.cc:386
SWC::DB::Specs::Scan
Definition: SpecsScan.h:21
SWC::client::Query::Select::Handlers::Common::Ptr
std::shared_ptr< Common > Ptr
Definition: Common.h:22
SWC::Utils::LoadGenerator::DistribCourse
DistribCourse
Definition: load_generator.cc:91
SWC_LOG_OSTREAM
#define SWC_LOG_OSTREAM
Definition: Logger.h:44
SWC::DB::Specs::Interval::key_intervals
KeyIntervals key_intervals
Definition: SpecsInterval.h:239
SWC::Env::Config::reset
static void reset() noexcept
Definition: Settings.h:133
SWC::Config::g_enum
Property::Value_enum_g::Ptr g_enum(const int32_t &v, Property::Value_enum_g::OnChg_t &&cb, Property::Value_enum_g::FromString_t &&from_string, Property::Value_enum_g::Repr_t &&repr)
Definition: PropertiesParser.cc:89
Clients.h
ColumnMng.h
SWC::Core::Vector::resize
SWC_CAN_INLINE void resize(size_type sz, ArgsT &&... args)
Definition: Vector.h:308
SWC::Comm::Protocol::Bkr::Req::ColumnMng_Sync::request
static SWC_CAN_INLINE void request(const Mngr::Params::ColumnMng &params, const uint32_t timeout, DataArgsT &&... args)
Definition: ColumnMng_Sync.h:32
SWC::Env::Clients::get
static SWC_CAN_INLINE client::Clients::Ptr & get() noexcept
Definition: Clients.h:299
SWC::DB::Specs::KeyInterval::start
Key start
Definition: SpecsKeyIntervals.h:19
SWC::Core::Vector::clear
SWC_CAN_INLINE void clear() noexcept(_NoExceptDestructor)
Definition: Vector.h:120
SWC::Time::now_ns
SWC_CAN_INLINE int64_t now_ns() noexcept
Definition: Time.h:43
SWC::Config::i8
Property::Value_uint8::Ptr i8(const uint8_t &v)
Definition: PropertiesParser.cc:25
Settings.h
SWC::Utils::LoadGenerator::FractionStateDistUniform::gen
std::mt19937 gen
Definition: load_generator.cc:385
SWC::client::Clients::DEFAULT
@ DEFAULT
Definition: Clients.h:61
SWC::Error::get_text
const char * get_text(const int err) noexcept
Definition: Error.cc:173
SWC::DB::Types::repr_col_type
SWC_CAN_INLINE std::string repr_col_type(int typ)
Definition: Column.h:37
SWC::Utils::LoadGenerator::KeyGenerator::_fractions_state
Core::Vector< std::unique_ptr< FractionState > > _fractions_state
Definition: load_generator.cc:533
SWC::Env::Config::settings
static SWC::Config::Settings::Ptr & settings()
Definition: Settings.h:128
SWC::Config::init_app_options
void init_app_options(Settings *settings)
Definition: load_generator.cc:166
SWC::DB::Types::from_string_range_seq
SWC_CAN_INLINE int from_string_range_seq(const std::string &typ) noexcept
Definition: KeySeq.h:34
SWC_THROW
#define SWC_THROW(_code_, _msg_)
Definition: Exception.h:134
SWC::Utils::LoadGenerator::KeyGenerator::next_n_fraction
bool next_n_fraction()
Definition: load_generator.cc:462
SWC::Utils::LoadGenerator::FractionStateDistStepping::set_value
virtual void set_value() override
Definition: load_generator.cc:349
SWC::Core::BufferDyn::ensure
SWC_CAN_INLINE void ensure(size_t len)
Definition: Buffer.h:212
SWC::Utils::LoadGenerator::KeyGeneratorUpdate::KeyGeneratorUpdate
KeyGeneratorUpdate(size_t a_ncells, size_t a_ncells_onlevel, uint24_t a_fraction_size, uint24_t a_nfractions, Distrib a_distribution, DistribCourse a_course, size_t seed)
Definition: load_generator.cc:539
SWC::Env::Config::init
static SWC_SHOULD_NOT_INLINE void init(int argc, char **argv, SWC::Config::Settings::init_option_t init_app_options, SWC::Config::Settings::init_option_t init_post_cmd_args)
Definition: Settings.h:110
SWC::DB::Types::Column
Column
Definition: Column.h:18
SWC::DB::Cells::DELETE_LE
@ DELETE_LE
Definition: Cell.h:63
SWC::Utils::LoadGenerator::update_data
void update_data(const DB::SchemasVec &schemas, uint8_t flag, size_t seed)
Definition: load_generator.cc:611
SWC::Core::Encoder::from_string_encoding
SWC_CAN_INLINE int from_string_encoding(const std::string &typ) noexcept
Definition: Encoder.h:47
SWC::Config::Settings::cmdline_desc
ParserConfig cmdline_desc
Definition: Settings.h:32
SWC_PRINT
#define SWC_PRINT
Definition: Logger.h:167
SWC::Config::boo
Property::Value_bool::Ptr boo(const bool &v)
Definition: PropertiesParser.cc:21
SWC_PRINT_CLOSE
#define SWC_PRINT_CLOSE
Definition: Logger.h:171
SWC::client::Query::Profiling::display
void display(std::ostream &out) const
Definition: Profiling.h:182
SWC::DB::Cells::Cell
Definition: Cell.h:92
SWC::DB::Schemas::SelectorPatterns
Definition: Schemas.h:100
SWC::Utils::LoadGenerator::R_LEVELS
@ R_LEVELS
Definition: load_generator.cc:97
SWC::Utils::LoadGenerator::FractionStateDistStepping::~FractionStateDistStepping
virtual ~FractionStateDistStepping() noexcept
Definition: load_generator.cc:342
SWC::DB::Cell::Key
Definition: CellKey.h:24
SWC::DB::Specs::Key
Definition: SpecsKey.h:136
SWC::Utils::LoadGenerator::FractionState::value
size_t value
Definition: load_generator.cc:311
SWC::DB::Schemas::SelectorPatterns::names
NamePatterns names
Definition: Schemas.h:101
SWC::DB::Cells::Cell::key
DB::Cell::Key key
Definition: Cell.h:357
SWC::Common::Stats::FlowRate::Data
Definition: FlowRate.h:19
SWC::Core::Encoder::Type::DEFAULT
@ DEFAULT
SWC::DB::Cell::Serial::Value::FieldsWriter::add
SWC_CAN_INLINE void add(Field *field)
Definition: CellValueSerialFields.h:42
SWC::Config::init_client_options
void init_client_options(Settings *settings)
Definition: Settings.cc:13
SWC::Env::Clients::init
static void init(const client::Clients::Ptr &clients)
Definition: Clients.cc:182
SWC::Utils::LoadGenerator::KeyGenerator::KeyGenerator
KeyGenerator(size_t a_ncells, size_t a_ncells_onlevel, uint24_t a_fraction_size, uint24_t a_nfractions, Distrib a_distribution, DistribCourse a_course, size_t seed)
Definition: load_generator.cc:400
SWC::Time::Measure::elapsed
SWC_CAN_INLINE uint64_t elapsed() const noexcept
Definition: Time.h:74
SWC::DB::Cells::Result
Definition: Result.h:16
SWC::DB::Cell::Key::add
SWC_CAN_INLINE void add(const std::string_view &fraction)
Definition: CellKey.h:86
ColumnMng_Sync.h
SWC::Utils::LoadGenerator::KeyGeneratorSelect::next
bool next(DB::Specs::Key &key)
Definition: load_generator.cc:589
SWC::Utils::LoadGenerator::FractionState::FractionState
FractionState(size_t a_value)
Definition: load_generator.cc:305
SWC::Utils::LoadGenerator::FractionStateDistStepping
Definition: load_generator.cc:336
SWC::client::Query::Update::Handlers::Common::make
static SWC_CAN_INLINE Ptr make(const Clients::Ptr &clients, Cb_t &&cb=nullptr, const Comm::IoContextPtr &io=nullptr, Clients::Flag executor=Clients::DEFAULT)
Definition: Common.h:24
SWC::Config::init_comm_options
void init_comm_options(Settings *settings)
Definition: Settings.cc:13
main
int main(int argc, char **argv)
Definition: load_generator.cc:1036
SWC::Utils::LoadGenerator::LEVELS
@ LEVELS
Definition: load_generator.cc:96
SWC::DB::Cell::Serial::Value::DOUBLE
@ DOUBLE
Definition: CellValueSerialField.h:36
run
int run(int argc, char **argv)
Definition: load_generator.cc:987
SWC::Utils::LoadGenerator::repr_distrib_course
std::string repr_distrib_course(int typ)
Definition: load_generator.cc:141
SWC::DB::Types::KeySeq
KeySeq
Definition: KeySeq.h:13
SWC::Utils::LoadGenerator::from_string_distrib
int from_string_distrib(const std::string &typ)
Definition: load_generator.cc:50
SWC::DB::Cell::Serial::Value::BYTES
@ BYTES
Definition: CellValueSerialField.h:37
SWC::Utils::LoadGenerator::FractionStateDistStepping::reverse
const bool reverse
Definition: load_generator.cc:370
Settings.h
SWC::Error::OK
@ OK
Definition: Error.h:45
Scanner.h
SWC::Utils::LoadGenerator::generate
void generate()
Definition: load_generator.cc:921
CellValueSerialFields.h
SWC::Utils::LoadGenerator::FractionStateDistUniform::set_value
virtual void set_value() override
Definition: load_generator.cc:381
SWC::DB::Specs::Scan::columns
Columns columns
Definition: SpecsScan.h:101
SWC::Utils::LoadGenerator::FractionStateDistUniform::FractionStateDistUniform
FractionStateDistUniform(size_t a_ncells, size_t seed)
Definition: load_generator.cc:375
SWC::Utils::LoadGenerator::KeyGenerator::distribution
const Distrib distribution
Definition: load_generator.cc:397
SWC::DB::Specs::KeyIntervals::add
KeyInterval & add()
Definition: SpecsKeyIntervals.cc:28
SWC::Utils::LoadGenerator::KeyGenerator::nfractions
const uint24_t nfractions
Definition: load_generator.cc:395
SWC::Utils::LoadGenerator::KeyGenerator::ncells_onlevel
const size_t ncells_onlevel
Definition: load_generator.cc:394
SWC::Core::Buffer::base
value_type * base
Definition: Buffer.h:131
SWC::Config::Settings::usage_str
std::string usage_str(const char *usage=nullptr)
Definition: Settings.cc:371
SWC
The SWC-DB C++ namespace 'SWC'.
Definition: main.cc:12
SWC::Common::Stats::FlowRate::Data::print_cells_statistics
void print_cells_statistics(std::ostream &out, size_t cells_count, size_t resend_cells) const
Definition: FlowRate.h:69
SWC::Utils::LoadGenerator::KeyGenerator::course
const DistribCourse course
Definition: load_generator.cc:398
SWC::Utils::LoadGenerator::R_SINGLE
@ R_SINGLE
Definition: load_generator.cc:95
SWC::Utils::LoadGenerator::KeyGeneratorUpdate::~KeyGeneratorUpdate
~KeyGeneratorUpdate() noexcept
Definition: load_generator.cc:551
SWC::Time::Measure
Definition: Time.h:55
SWC::DB::Cell::Serial::Value::INT64
@ INT64
Definition: CellValueSerialField.h:35
SWC::Utils::LoadGenerator::make_work_load
void make_work_load(const DB::SchemasVec &schemas)
Definition: load_generator.cc:890
SWC::DB::Schema::make
static SWC_CAN_INLINE Ptr make()
Definition: Schema.h:189
SWC::DB::Types::is_counter
bool SWC_CONST_FUNC is_counter(const Column typ) noexcept
Definition: Column.cc:26
SWC::Utils::LoadGenerator::SINGLE
@ SINGLE
Definition: load_generator.cc:94
SWC::Condition::EQ
@ EQ
Definition: Comparators.h:32
SWC::DB::Types::repr_range_seq
SWC_CAN_INLINE std::string repr_range_seq(int typ)
Definition: KeySeq.h:29
ColumnMng_Sync.h
SWC::Condition::PF
@ PF
Definition: Comparators.h:29
SWC_CAN_QUICK_EXIT
#define SWC_CAN_QUICK_EXIT(_CODE_)
Definition: Compat.h:191
SWC::Utils::LoadGenerator::FractionStateDistStepping::FractionStateDistStepping
FractionStateDistStepping(size_t a_ncells, size_t a_step, bool a_reverse)
Definition: load_generator.cc:337
SWC::Utils::LoadGenerator::FractionStateDistStepping::offset
size_t offset
Definition: load_generator.cc:371
SWC::Config::ParserConfig::add_options
ParserConfig &SWC_CONST_FUNC add_options()
Definition: PropertiesParser.cc:223
SWC::DB::Cells::INSERT
@ INSERT
Definition: Cell.h:62
SWC::Config::str
Property::Value_string::Ptr str(std::string &&v)
Definition: PropertiesParser.cc:45
SWC::Time::Measure::restart
SWC_CAN_INLINE void restart() noexcept
Definition: Time.h:68
SWC::Utils::LoadGenerator::KeyGenerator::fraction_size
const uint24_t fraction_size
Definition: load_generator.cc:396
SWC::client::Query::Profiling::finished
SWC_CAN_INLINE void finished() noexcept
Definition: Profiling.h:127
SWC::DB::Cells::Cell::set_time_order_desc
constexpr SWC_CAN_INLINE void set_time_order_desc(bool desc) noexcept
Definition: Cell.h:169
SWC::Utils::LoadGenerator::FractionStateDistStepping::reset
virtual void reset() override
Definition: load_generator.cc:344
SWC::Config::Settings
Definition: Settings.h:25
SWC::Utils::LoadGenerator::Distrib
Distrib
Definition: load_generator.cc:44
SWC::LOG_ERROR
@ LOG_ERROR
Definition: Logger.h:32
SWC::DB::Specs::Interval::flags
Flags flags
Definition: SpecsInterval.h:242
SWC::Utils::LoadGenerator::STEPPING
@ STEPPING
Definition: load_generator.cc:46
SWC::Utils::LoadGenerator::KeyGenerator::ncells
const size_t ncells
Definition: load_generator.cc:393
SWC::DB::Cell::Serial::Value::FieldsWriter
Definition: CellValueSerialFields.h:34
SWC::Error::CONFIG_BAD_VALUE
@ CONFIG_BAD_VALUE
Definition: Error.h:81
SWC::Utils::LoadGenerator::KeyGenerator
Definition: load_generator.cc:391
SWC::Core::Vector
Definition: Vector.h:14
SWC::Utils::LoadGenerator::KeyGenerator::_nfractions
uint24_t _nfractions
Definition: load_generator.cc:532
SWC::DB::Cell::Key::free
SWC_CAN_INLINE void free() noexcept
Definition: CellKey.h:73
SWC_QUICK_EXIT
#define SWC_QUICK_EXIT(_CODE_)
Definition: Compat.h:184
SWC::DB::Types::Encoder
Core::Encoder::Type Encoder
Definition: Encoder.h:15
SWC::Core::BufferDyn::fill
constexpr SWC_CAN_INLINE size_t fill() const noexcept
Definition: Buffer.h:192
SWC::Config::Property::Value::zero_token
Ptr zero_token() noexcept
Definition: Property.cc:94
SWC::Utils::LoadGenerator::R_STEP
@ R_STEP
Definition: load_generator.cc:93
SWC::Utils::LoadGenerator::UNIFORM
@ UNIFORM
Definition: load_generator.cc:47
SWC::DB::Cells::Cell::encoded_length
constexpr SWC_CAN_INLINE size_t encoded_length(bool no_value=false) const noexcept
Definition: Cell.h:285
SWC::DB::Specs::Interval
Definition: SpecsInterval.h:25
SWC::Utils::LoadGenerator::STEP
@ STEP
Definition: load_generator.cc:92
SWC::Utils::LoadGenerator::KeyGeneratorSelect::KeyGeneratorSelect
KeyGeneratorSelect(size_t a_ncells, size_t a_ncells_onlevel, uint24_t a_fraction_size, uint24_t a_nfractions, Distrib a_distribution, DistribCourse a_course, size_t seed)
Definition: load_generator.cc:578
Committer.h
SWC::Utils::LoadGenerator::KeyGeneratorUpdate
Definition: load_generator.cc:537
SWC::client::Query::Profiling
Definition: Profiling.h:24
SWC::uint24_t
Core::uint24_t uint24_t
Definition: BitFieldInt.h:401
SWC::Config::i64
Property::Value_int64::Ptr i64(const int64_t &v)
Definition: PropertiesParser.cc:37
SWC::Comm::Protocol::Mngr::Req::ColumnMng_Sync::request
static SWC_CAN_INLINE void request(const Params::ColumnMng &params, const uint32_t timeout, DataArgsT &&... args)
Definition: ColumnMng_Sync.h:32
SWC::Utils::LoadGenerator::FractionStateDistStepping::ncells
const size_t ncells
Definition: load_generator.cc:368
SWC::client::Clients::BROKER
@ BROKER
Definition: Clients.h:62
SWC::Utils::LoadGenerator::FractionStateDistSeq::set_value
virtual void set_value() override
Definition: load_generator.cc:322
SWC::Env::Clients::reset
static void reset() noexcept
Definition: Clients.h:308
SWC::Utils::LoadGenerator::FractionState::~FractionState
virtual ~FractionState()
Definition: load_generator.cc:306
SWC::Utils::LoadGenerator::FractionState::reset
virtual void reset()
Definition: load_generator.cc:307
SWC::client::Clients::make
static Ptr make(const Config::Settings &settings, const Comm::IoContextPtr &io_ctx, const ContextManager::Ptr &mngr_ctx, const ContextRanger::Ptr &rgr_ctx, const ContextBroker::Ptr &bkr_ctx)
Definition: Clients.cc:13
SWC::Utils::LoadGenerator::KeyGenerator::_ncells
size_t _ncells
Definition: load_generator.cc:530
SWC::Utils::LoadGenerator::FractionState
Definition: load_generator.cc:304
SWC::Utils::LoadGenerator::from_string_distrib_course
int from_string_distrib_course(const std::string &typ)
Definition: load_generator.cc:100
SWC::Utils::LoadGenerator::KeyGenerator::~KeyGenerator
~KeyGenerator() noexcept
Definition: load_generator.cc:460
SWC::Utils::LoadGenerator::FractionStateDistStepping::step
const size_t step
Definition: load_generator.cc:369
SWC::Utils::LoadGenerator::quit_error
void quit_error(int err)
Definition: load_generator.cc:295
SWC::Core::Encoder::repr_encoding
SWC_CAN_INLINE std::string repr_encoding(int typ)
Definition: Encoder.h:42
SWC::Utils::LoadGenerator::KeyGeneratorUpdate::next
bool next(DB::Cell::Key &key)
Definition: load_generator.cc:553
SWC::DB::Specs::Interval::set_opt__key_equal
constexpr SWC_CAN_INLINE void set_opt__key_equal() noexcept
Definition: SpecsInterval.h:148
SWC::Utils::LoadGenerator::select_data
void select_data(const DB::SchemasVec &schemas, size_t seed)
Definition: load_generator.cc:760
SWC::DB::Types::Column::SERIAL
@ SERIAL
SWC::DB::Cells::Result::size_bytes
constexpr SWC_CAN_INLINE size_t size_bytes() const noexcept
Definition: Result.h:64
SWC::Core::Vector::push_back
SWC_CAN_INLINE void push_back(ArgsT &&... args)
Definition: Vector.h:331
SWC_ASSERT
#define SWC_ASSERT(_e_)
Definition: Exception.h:165
SWC::Utils::LoadGenerator::FractionStateDistSeq::FractionStateDistSeq
FractionStateDistSeq(size_t a_ncells, bool a_reverse)
Definition: load_generator.cc:315
SWC::DB::Specs::Flags::limit
uint64_t limit
Definition: SpecsFlags.h:142
SWC::Utils::LoadGenerator::SEQUENTIAL
@ SEQUENTIAL
Definition: load_generator.cc:45
SWC::Core::to_string
SWC_CAN_INLINE std::string to_string(const BitFieldInt< T, SZ > &v)
Definition: BitFieldInt.h:263
SWC::Utils::LoadGenerator::KeyGenerator::_ncells_onlevel
size_t _ncells_onlevel
Definition: load_generator.cc:531
Common.h
SWC::Comm::IoContext::make
static IoContextPtr make(std::string &&_name, int32_t size)
Definition: IoContext.h:41
SWC::Config::ParserConfig::get_default
Property::Value::Ptr get_default(const std::string &name)
Definition: PropertiesParser.cc:290
SWC::Error::INVALID_ARGUMENT
@ INVALID_ARGUMENT
Definition: Error.h:58
SWC::Core::Vector::size
constexpr SWC_CAN_INLINE size_type size() const noexcept
Definition: Vector.h:189
SWC::Config::Property::Value_enum
Definition: Property.h:346
SWC::Condition::str_case_eq
bool str_case_eq(const char *s1, const char *s2, size_t count) noexcept SWC_ATTRIBS((SWC_ATTRIB_O3))
Definition: Comparators_basic.h:257
FlowRate.h
Common.h
SWC::Utils::LoadGenerator::KeyGeneratorSelect
Definition: load_generator.cc:576
SWC::Core::Vector::emplace_back
SWC_CAN_INLINE reference emplace_back(ArgsT &&... args)
Definition: Vector.h:349
SWC::DB::Specs::Key::move
SWC_CAN_INLINE void move(Key &other) noexcept
Definition: SpecsKey.h:175
SWC::Utils::LoadGenerator::FractionStateDistSeq
Definition: load_generator.cc:314
SWC::Utils::LoadGenerator::FractionStateDistSeq::ncells
const size_t ncells
Definition: load_generator.cc:332
SWC::Config::Property::Value_int32_g
Definition: Property.h:586
SWC::Utils::LoadGenerator::KeyGeneratorUpdate::_fractions
Core::Vector< std::string > _fractions
Definition: load_generator.cc:572
SWC::Utils::LoadGenerator::FractionState::set_value
virtual void set_value()=0
SWC::Core::Vector::reserve
SWC_CAN_INLINE void reserve(size_type cap)
Definition: Vector.h:288
SWC::Utils::LoadGenerator::FractionStateDistSeq::~FractionStateDistSeq
virtual ~FractionStateDistSeq() noexcept
Definition: load_generator.cc:320
SWC::DB::Types::from_string_col_type
SWC_CAN_INLINE int from_string_col_type(const std::string &typ) noexcept
Definition: Column.h:42
SWC::DB::Cells::Cell::flag
uint8_t flag
Definition: Cell.h:359
SWC::Utils::LoadGenerator::KeyGeneratorSelect::~KeyGeneratorSelect
~KeyGeneratorSelect() noexcept
Definition: load_generator.cc:587
SWC::Config::ParserConfig::definition
ParserConfig & definition(const char *u)
Definition: PropertiesParser.cc:163
SWC::DB::Schemas::Pattern
Definition: Schemas.h:24