summaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/interface/common.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'yt/cpp/mapreduce/interface/common.cpp')
-rw-r--r--yt/cpp/mapreduce/interface/common.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/yt/cpp/mapreduce/interface/common.cpp b/yt/cpp/mapreduce/interface/common.cpp
index fdb3e66b191..7c54fd65d09 100644
--- a/yt/cpp/mapreduce/interface/common.cpp
+++ b/yt/cpp/mapreduce/interface/common.cpp
@@ -13,6 +13,10 @@
#include <util/generic/xrange.h>
+#include <util/datetime/base.h>
+
+#include <util/system/getpid.h>
+
namespace NYT {
using ::google::protobuf::Descriptor;
@@ -762,6 +766,21 @@ TString ToString(EValueType type)
ythrow yexception() << "Invalid value type " << static_cast<int>(type);
}
+TMutationId GenerateMutationId()
+{
+ TGUID guid;
+
+ // Some users use `fork()' with yt wrapper
+ // (actually they use python + multiprocessing)
+ // and CreateGuid is not resistant to `fork()', so spice it a little bit.
+ //
+ // Check IGNIETFERRO-610
+ CreateGuid(&guid);
+ guid.dw[2] = GetPID() ^ MicroSeconds();
+
+ return guid;
+}
+
////////////////////////////////////////////////////////////////////////////////
} // namespace NDetail