Skip to content

Commit 7499298

Browse files
authored
Added parameter which sets fixed number of seconds to subtract from c… (#15351)
1 parent b4a15ad commit 7499298

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

ydb/library/workload/log/log.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ class TRandomLogGenerator {
253253
}
254254

255255
TInstant RandomInstant() const {
256-
auto result = TInstant::Now();
256+
auto result = TInstant::Now() - TDuration::Seconds(Params.TimestampSubtract);
257257
i64 millisecondsDiff = 60 * 1000 * NormalRandom<double>(0., Params.TimestampStandardDeviationMinutes);
258258
if (millisecondsDiff >= 0) { // TDuration::MilliSeconds can't be negative for some reason...
259259
result += TDuration::MilliSeconds(millisecondsDiff);
@@ -420,6 +420,8 @@ void TLogWorkloadParams::ConfigureOpts(NLastGetopt::TOpts& opts, const ECommandT
420420
.DefaultValue(RowsCnt).StoreResult(&RowsCnt);
421421
opts.AddLongOption("timestamp_deviation", "Standard deviation. For each timestamp, a random variable with a specified standard deviation in minutes is added.")
422422
.DefaultValue(TimestampStandardDeviationMinutes).StoreResult(&TimestampStandardDeviationMinutes);
423+
opts.AddLongOption("timestamp_subtract", "Value in seconds to subtract from timestamp. For each timestamp, this value in seconds is subtracted")
424+
.DefaultValue(0).StoreResult(&TimestampSubtract);
423425
opts.AddLongOption("null-percent", "Percent of nulls in generated data")
424426
.DefaultValue(NullPercent).StoreResult(&NullPercent);
425427
break;

ydb/library/workload/log/log.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class TLogWorkloadParams : public TWorkloadParams {
2525
ui64 KeyColumnsCnt = 0;
2626
ui64 TimestampStandardDeviationMinutes = 0;
2727
ui64 TimestampTtlMinutes = 0;
28+
ui64 TimestampSubtract = 0;
2829
ui64 RowsCnt = 1;
2930
ui32 NullPercent = 10;
3031
bool PartitionsByLoad = true;

0 commit comments

Comments
 (0)