aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorachulkov2 <achulkov2@yandex-team.com>2023-10-24 23:10:17 +0300
committerachulkov2 <achulkov2@yandex-team.com>2023-10-24 23:30:25 +0300
commit58fc30125015d9e913d6ecc1f1a89007541ede1b (patch)
treea9b4780f44c8bf33106bc38929d64be44d03b725
parentad68a058431fc177c5df5528111d43a270988bec (diff)
downloadydb-58fc30125015d9e913d6ecc1f1a89007541ede1b.tar.gz
YT-19517: Support custom output table names in queue static exports
-rw-r--r--yt/yt/client/queue_client/config.cpp2
-rw-r--r--yt/yt/client/queue_client/config.h11
2 files changed, 13 insertions, 0 deletions
diff --git a/yt/yt/client/queue_client/config.cpp b/yt/yt/client/queue_client/config.cpp
index 67ac0f394b..14b3fdb7fe 100644
--- a/yt/yt/client/queue_client/config.cpp
+++ b/yt/yt/client/queue_client/config.cpp
@@ -55,6 +55,8 @@ void TQueueStaticExportConfig::Register(TRegistrar registrar)
registrar.Parameter("export_period", &TThis::ExportPeriod)
.GreaterThan(TDuration::Zero());
registrar.Parameter("export_directory", &TThis::ExportDirectory);
+ registrar.Parameter("output_table_name_pattern", &TThis::OutputTableNamePattern)
+ .Default("%UNIX_TS-%PERIOD");
registrar.Postprocessor([] (TThis* config) {
if (config->ExportPeriod.GetValue() % TDuration::Seconds(1).GetValue() != 0) {
diff --git a/yt/yt/client/queue_client/config.h b/yt/yt/client/queue_client/config.h
index bd52433fbc..f3b5d9d176 100644
--- a/yt/yt/client/queue_client/config.h
+++ b/yt/yt/client/queue_client/config.h
@@ -74,6 +74,17 @@ public:
//! Path to directory that will contain resulting static tables with exported data.
NYPath::TYPath ExportDirectory;
+ //! A format-string supporting the following specifiers:
+ //! - %UNIX_TS: the unix timestamp corresponding to the exported table
+ //! - %PERIOD: the length of the export period in seconds
+ //! - %ISO: unix timestamp formatted as an ISO time string
+ //! - all specifiers supported by the strftime function (e.g. %H, %M, %S, etc.), used to format the table's unix timestamp
+ //! NB: It is your responsibility to guarantee that these names will be unique across export iterations (given that the
+ //! unix timestamps corresponding to the output tables are guaranteed to be unique by the export algorithm).
+ //! An attempt to produce a table which already exists will lead to an error, in which case the data will be exported
+ //! on the next iteration.
+ TString OutputTableNamePattern;
+
REGISTER_YSON_STRUCT_LITE(TQueueStaticExportConfig);
static void Register(TRegistrar registrar);