-
Notifications
You must be signed in to change notification settings - Fork 697
DataShard and SchemeShard: handle borrowed parts in data erasure #15451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "storage_helpers.h" | ||
|
||
#include <ydb/core/blobstorage/dsproxy/mock/model.h> | ||
|
||
namespace NKikimr { | ||
int CountBlobsWithSubstring(ui64 tabletId, const TVector<TIntrusivePtr<NFake::TProxyDS>>& proxyDSs, const TString& substring) { | ||
int res = 0; | ||
for (const auto& proxyDS : proxyDSs) { | ||
for (const auto& [id, blob] : proxyDS->AllMyBlobs()) { | ||
if (id.TabletID() == tabletId && !blob.DoNotKeep && blob.Buffer.ConvertToString().Contains(substring)) { | ||
++res; | ||
} | ||
} | ||
} | ||
return res; | ||
} | ||
|
||
bool BlobStorageContains(const TVector<TIntrusivePtr<NFake::TProxyDS>>& proxyDSs, const TString& value) { | ||
for (const auto& proxyDS : proxyDSs) { | ||
for (const auto& [id, blob] : proxyDS->AllMyBlobs()) { | ||
if (!blob.DoNotKeep && blob.Buffer.ConvertToString().Contains(value)) { | ||
return true; | ||
} | ||
} | ||
} | ||
return false; | ||
} | ||
} // namespace NKikimr |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#pragma once | ||
|
||
#include <ydb/core/blobstorage/dsproxy/mock/dsproxy_mock.h> | ||
|
||
namespace NKikimr { | ||
int CountBlobsWithSubstring(ui64 tabletId, const TVector<TIntrusivePtr<NFake::TProxyDS>>& proxyDSs, const TString& substring); | ||
bool BlobStorageContains(const TVector<TIntrusivePtr<NFake::TProxyDS>>& proxyDSs, const TString& value); | ||
} // namespace NKikimr |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7106,32 +7106,27 @@ void TSchemeShard::SetPartitioning(TPathId pathId, TTableInfo::TPtr tableInfo, T | |
newPartitioningSet.reserve(newPartitioning.size()); | ||
const auto& oldPartitioning = tableInfo->GetPartitions(); | ||
|
||
std::vector<TShardIdx> dataErasureShards; | ||
for (const auto& p: newPartitioning) { | ||
if (!oldPartitioning.empty()) | ||
newPartitioningSet.insert(p.ShardIdx); | ||
|
||
const auto& partitionStats = tableInfo->GetStats().PartitionStats; | ||
auto it = partitionStats.find(p.ShardIdx); | ||
std::vector<TShardIdx> dataErasureShards; | ||
if (it != partitionStats.end()) { | ||
EnqueueBackgroundCompaction(p.ShardIdx, it->second); | ||
UpdateShardMetrics(p.ShardIdx, it->second); | ||
dataErasureShards.push_back(p.ShardIdx); | ||
} | ||
if (DataErasureManager->GetStatus() == EDataErasureStatus::IN_PROGRESS) { | ||
Execute(CreateTxAddEntryToDataErasure(dataErasureShards), this->ActorContext()); | ||
} | ||
} | ||
if (DataErasureManager->GetStatus() == EDataErasureStatus::IN_PROGRESS) { | ||
Execute(CreateTxAddEntryToDataErasure(dataErasureShards), this->ActorContext()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. А насколько это вообще безопасно тут делать? Ведь SetPartitioning вызывается из операции split/merge в транзакции, а здесь шедулится какая-то другая транзакция. И завершение split/merge может успешно закоммититься, а до этой транзакции даже очередь не дойдёт. В итоге шарды окажутся просто потерянными? Ну и ещё смущает, что SetPartitioning вызывается в рамках загрузки schemeshard'а, вообще тут кажется никогда не предполагалось какой-то такой сложной логики/действий. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Да, главное, что смущает -- что От вызова
Это если schemeshard перезапустится? |
||
} | ||
|
||
std::vector<TShardIdx> cancelDataErasureShards; | ||
for (const auto& p: oldPartitioning) { | ||
if (!newPartitioningSet.contains(p.ShardIdx)) { | ||
// note that queues might not contain the shard | ||
OnShardRemoved(p.ShardIdx); | ||
cancelDataErasureShards.push_back(p.ShardIdx); | ||
} | ||
if (DataErasureManager->GetStatus() == EDataErasureStatus::IN_PROGRESS) { | ||
Execute(CreateTxCancelDataErasureShards(cancelDataErasureShards), this->ActorContext()); | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Почему потребовалось переносить запуск
CancelDataErasureShards
сюда?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В прошлом месте таблетка ещё не была удалена, и очистка могла успешно завершится до удаления этой таблетки, что плохо и нарушает гарантии удаления. Сюда же попадаем уже после того, как хайв ответил, что таблетка удалена.
(Да, ещё остаётся проблема, что хайв на самом деле отвечает до того, как удалил данные в блобсторадже, но это собираемся отдельно доделывать).