diff options
author | chertus <azuikov@ydb.tech> | 2023-02-02 12:59:45 +0300 |
---|---|---|
committer | chertus <azuikov@ydb.tech> | 2023-02-02 12:59:45 +0300 |
commit | 2073fdf239e9c35938d584718c71fb12fe6afb7d (patch) | |
tree | c62892d8f41f4827e42cc01c45b7a0c1c67380f7 | |
parent | 77c5a24c763f28d1a8a5164b1e1d2ed0a5d35604 (diff) | |
download | ydb-2073fdf239e9c35938d584718c71fb12fe6afb7d.tar.gz |
fix verify and s3_actor data loss
-rw-r--r-- | ydb/core/tx/columnshard/blob_cache.cpp | 5 | ||||
-rw-r--r-- | ydb/core/tx/tiering/s3_actor.cpp | 38 |
2 files changed, 25 insertions, 18 deletions
diff --git a/ydb/core/tx/columnshard/blob_cache.cpp b/ydb/core/tx/columnshard/blob_cache.cpp index d2f9f639a8e..1c2e520c006 100644 --- a/ydb/core/tx/columnshard/blob_cache.cpp +++ b/ydb/core/tx/columnshard/blob_cache.cpp @@ -39,7 +39,9 @@ private: TReadItem(const TReadBlobRangeOptions& opts, const TBlobRange& blobRange) : TReadBlobRangeOptions(opts) , BlobRange(blobRange) - {} + { + Y_VERIFY(blobRange.BlobId.IsValid()); + } bool PromoteInCache() const { return CacheAfterRead; @@ -550,7 +552,6 @@ private: CookieToRange.erase(readCookie); for (size_t i = 0; i < blobRanges.size(); ++i) { - Y_VERIFY(blobRanges[i].BlobId.IsSmallBlob()); Y_VERIFY(blobRanges[i].BlobId.GetTabletId() == tabletId); ProcessSingleRangeResult(blobRanges[i], readCookie, NKikimrProto::EReplyStatus::NOTREADY, {}, ctx); } diff --git a/ydb/core/tx/tiering/s3_actor.cpp b/ydb/core/tx/tiering/s3_actor.cpp index 5dd253607e3..80277426652 100644 --- a/ydb/core/tx/tiering/s3_actor.cpp +++ b/ydb/core/tx/tiering/s3_actor.cpp @@ -25,7 +25,10 @@ public: TS3Export() = default; explicit TS3Export(TAutoPtr<TEvPrivate::TEvExport> ev) - : Event(ev.Release()) { + : Event(ev.Release()) + { + Y_VERIFY(Event); + Y_VERIFY(Event->Status == NKikimrProto::UNKNOWN); } TEvPrivate::TEvExport::TBlobDataMap& Blobs() { @@ -125,7 +128,7 @@ public: ex.RegisterKey(key); ExportingKeys[key] = exportNo; - + if (blob.Evicting) { SendPutObjectIfNotExists(key, std::move(blob.Data)); } else { @@ -185,7 +188,7 @@ public: const bool hasError = !resultOutcome.IsSuccess(); TString errStr; if (hasError) { - errStr = LogError("PutObjectResponse", resultOutcome.GetError(), !!msg.Key); + errStr = LogError("PutObjectResponse", resultOutcome.GetError(), msg.Key); } Y_VERIFY(msg.Key); // FIXME @@ -225,7 +228,7 @@ public: const auto& resultOutcome = msg.Result; if (!resultOutcome.IsSuccess()) { - KeyFinished(context->GetKey(), true, LogError("CheckObjectExistsResponse", resultOutcome.GetError(), !!context->GetKey())); + KeyFinished(context->GetKey(), true, LogError("CheckObjectExistsResponse", resultOutcome.GetError(), context->GetKey())); } else if (!msg.IsExists()) { SendPutObject(context->GetKey(), std::move(context->DetachData())); } else { @@ -241,7 +244,7 @@ public: TString errStr; if (!resultOutcome.IsSuccess()) { - errStr = LogError("DeleteObjectResponse", resultOutcome.GetError(), !!msg.Key); + errStr = LogError("DeleteObjectResponse", resultOutcome.GetError(), msg.Key); } Y_VERIFY(msg.Key); // FIXME @@ -287,7 +290,7 @@ public: TString errStr; if (!resultOutcome.IsSuccess()) { - errStr = LogError("GetObjectResponse", resultOutcome.GetError(), !!key); + errStr = LogError("GetObjectResponse", resultOutcome.GetError(), key); } if (!key || key->empty()) { @@ -357,12 +360,12 @@ public: if (hasError) { ex.Event->Status = NKikimrProto::ERROR; Y_VERIFY(ex.Event->ErrorStrings.emplace(key, errStr).second, "%s", key.data()); - if (ex.ExtractionFinished()) { - Send(ShardActor, ex.Event.release()); - Exports.erase(exportNo); + } + + if (ex.ExtractionFinished()) { + if (ex.Event->Status == NKikimrProto::UNKNOWN) { + ex.Event->Status = NKikimrProto::OK; } - } else if (ex.ExtractionFinished()) { - ex.Event->Status = NKikimrProto::OK; Send(ShardActor, ex.Event.release()); Exports.erase(exportNo); } @@ -392,7 +395,7 @@ private: hFunc(TEvExternalStorage::TEvDeleteObjectResponse, Handle); hFunc(TEvExternalStorage::TEvGetObjectResponse, Handle); hFunc(TEvExternalStorage::TEvCheckObjectExistsResponse, Handle); - + #if 0 hFunc(TEvExternalStorage::TEvHeadObjectResponse, Handle); #endif @@ -460,13 +463,16 @@ private: Send(ExternalStorageActorId, new TEvExternalStorage::TEvDeleteObjectRequest(request)); } - TString LogError(const TString& responseType, const Aws::S3::S3Error& error, bool hasKey) const { + TString LogError(const TString& responseType, const Aws::S3::S3Error& error, + const std::optional<TString>& key) const { TString errStr = TString(error.GetExceptionName()) + " " + error.GetMessage(); - if (errStr.empty() && !hasKey) { + + LOG_S_NOTICE("[S3] Error in " << responseType << " for key '" << (key ? *key : TString()) + << "' at tablet " << TabletId << ": " << errStr); + + if (errStr.empty() && !key) { errStr = responseType + " with no key"; } - - LOG_S_NOTICE("[S3] Error in " << responseType << " at tablet " << TabletId << ": " << errStr); return errStr; } }; |