-
Notifications
You must be signed in to change notification settings - Fork 605
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
YQ-3697 Add partition count to dqrun #9837
base: main
Are you sure you want to change the base?
YQ-3697 Add partition count to dqrun #9837
Conversation
⚪ |
⚪
🟢 |
⚪ ⚪
⚪
🟢 |
⚪
🟢 |
⚪
🟢 |
return 1; | ||
} | ||
fileGateway->AddDummyTopic(TDummyTopic("pq", TString(topicName), TString(filePath))); | ||
size_t partitionCount = !partitionCountStr.empty() ? partitionCount = FromString<size_t>(partitionCountStr) : 1; |
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.
перемудрил
@@ -214,18 +215,26 @@ struct TDummyPartitionSession: public NYdb::NTopic::TPartitionSession { | |||
std::shared_ptr<NYdb::NTopic::IReadSession> TFileTopicClient::CreateReadSession(const NYdb::NTopic::TReadSessionSettings& settings) { | |||
Y_ENSURE(!settings.Topics_.empty()); | |||
TString topicPath = settings.Topics_.front().Path_; |
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.
чтобы уменьшить копипасту положи settings.Topics_.front() в переменную
Y_ENSURE(topicsIt->second.Path); | ||
|
||
TString filePath; | ||
if (TFsPath(*topicsIt->second.Path).IsDirectory()) { |
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.
предлагаю положить TFsPath(*topicsIt->second.Path) в отдельную переменную, у тебя этот объект строится в двух местах
Y_ENSURE(topicsIt->second.Path); | ||
|
||
TString filePath; | ||
if (TFsPath(*topicsIt->second.Path).IsDirectory()) { |
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.
рекомендую *topicsIt->second.Path положить в отдельную переменную, это выражение много где встречается
if (TFsPath(*topicsIt->second.Path).Exists() && topicsIt->second.PartitionsCount == 1) { | ||
filePath = *topicsIt->second.Path; | ||
} else { | ||
filePath = TString(*topicsIt->second.Path) + "_" + ToString(partitionId); |
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.
тут подошел бы TStringBuilder
⚪
🟢 |
⚪
🟢 |
struct stat stats; | ||
if (fstat(file, &stats) != 0) { | ||
return false; | ||
} |
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.
- leaks
file
fd (why not juststat
? but...) - racing (between check and actual open);
... and I'm not sure, why pipe should be special-cased at all?
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.
желательно не использовать ifdef в нашем коде. нельзя ли заюзать какую-нибудь функцию из util | library/cpp ?
@@ -211,21 +212,51 @@ struct TDummyPartitionSession: public NYdb::NTopic::TPartitionSession { | |||
} | |||
}; | |||
|
|||
static bool IsPipe(const TString& filePath) { |
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.
используем анонимные неймспейсы вместо static
⚪ Test history | Ya make output | Test bloat
🟢 |
⚪ Test history | Ya make output | Test bloat
🟢 |
if (fsPath.Exists() && topicsIt->second.PartitionsCount == 1) { | ||
filePath = *path; | ||
} else { | ||
filePath = TStringBuilder() << *path << "_" << ToString(partitionId); |
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.
ToString избыточен
⚪ Test history | Ya make output | Test bloat
🟢 |
⚪ Test history | Ya make output | Test bloat
🟢 |
⚪ Test history | Ya make output | Test bloat
🟢 |
⚪ Test history | Ya make output | Test bloat
🟢 |
⚪ Test history | Ya make output | Test bloat
🟢 |
⚪ Test history | Ya make output | Test bloat
🟢 |
⚪ Test history | Ya make output | Test bloat
🟢 |
⚪ Test history | Ya make output | Test bloat
🟢 |
|
||
const auto& topic = settings.Topics_.front(); | ||
TString topicPath = topic.Path_; | ||
Y_ENSURE(topic.PartitionIds_.size() == 1); |
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.
read_actor же сессию в несколько партиций может открыть. Тут точно нету ошибки?
TFsPath fsPath(*path); | ||
if (fsPath.IsDirectory()) { | ||
filePath = TStringBuilder() << *path << "/" << ToString(partitionId); | ||
} else { |
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.
А точно столько режимом нужно? Может с директорией достаточно будет?
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.
Скорее достаточно читать всеми партициями из одного файла.
⚪ |
⚪ |
⚪ Test history | Ya make output | Test bloat
🟢 |
⚪ Test history | Ya make output | Test bloat
🟢 |
Конфликты появились |
Changelog entry
...
Changelog category
Additional information
...