From 8c2e87b8a24b2a4ae1625a26d12be5aed6c4aa21 Mon Sep 17 00:00:00 2001 From: Marin Tomic Date: Fri, 19 Oct 2018 13:29:43 +0200 Subject: [PATCH] Fix stream creation failure handling Summary: Stream was created although transform script couldn't be downloaded. Reviewers: mferencevic, msantl, teon.banek Reviewed By: mferencevic, msantl, teon.banek Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1683 --- src/integrations/kafka/streams.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/integrations/kafka/streams.cpp b/src/integrations/kafka/streams.cpp index da4d694d2..7bb948926 100644 --- a/src/integrations/kafka/streams.cpp +++ b/src/integrations/kafka/streams.cpp @@ -134,11 +134,6 @@ void Streams::Create(const StreamInfo &info, bool download_transform_script) { if (consumers_.find(info.stream_name) != consumers_.end()) throw StreamExistsException(info.stream_name); - // Store stream_info in metadata_store_. - if (!metadata_store_.Put(info.stream_name, Serialize(info).dump())) { - throw StreamMetadataCouldNotBeStored(info.stream_name); - } - // Make sure transform directory exists or we can create it. if (!utils::EnsureDir(GetTransformScriptDir())) { throw TransformScriptCouldNotBeCreatedException(info.stream_name); @@ -152,6 +147,11 @@ void Streams::Create(const StreamInfo &info, bool download_transform_script) { throw TransformScriptDownloadException(info.transform_uri); } + // Store stream_info in metadata_store_. + if (!metadata_store_.Put(info.stream_name, Serialize(info).dump())) { + throw StreamMetadataCouldNotBeStored(info.stream_name); + } + try { consumers_.emplace( std::piecewise_construct, std::forward_as_tuple(info.stream_name),