-
Notifications
You must be signed in to change notification settings - Fork 37
[Blockstore] blockstore-client: make ignore unknown nbs-client.txt config params #4733
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
base: main
Are you sure you want to change the base?
[Blockstore] blockstore-client: make ignore unknown nbs-client.txt config params #4733
Conversation
|
Note This is an automated comment that will be appended during run. 🔴 linux-x86_64-relwithdebinfo: some tests FAILED for commit c108692.
🟢 linux-x86_64-relwithdebinfo: all tests PASSED for commit c108692.
|
|
Note This is an automated comment that will be appended during run. 🔴 linux-x86_64-relwithdebinfo: some tests FAILED for commit c108692.
🟢 linux-x86_64-relwithdebinfo: all tests PASSED for commit c108692.
|
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.
Точно
| NProto::TClientAppConfig appConfig; | ||
| if (NFs::Exists(ConfigFile)) { | ||
| ParseFromTextFormat(ConfigFile, appConfig); | ||
| ParseFromTextFormat(ConfigFile, appConfig, EParseFromTextFormatOption::AllowUnknownField); |
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.
Completely ignoring unknown fields is a bit dangerous, let's at least log them - you can do it easily via the third ParseFromTextFormat() parameter - warningStream
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.
simple Cerr would suffice
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.
Done
c108692 to
1f4f506
Compare
|
Note This is an automated comment that will be appended during run. 🔴 linux-x86_64-relwithdebinfo: some tests FAILED for commit 1f4f506.
🟢 linux-x86_64-relwithdebinfo: all tests PASSED for commit 1f4f506.
|
| NProto::TClientAppConfig appConfig; | ||
| if (NFs::Exists(ConfigFile)) { | ||
| ParseFromTextFormat(ConfigFile, appConfig); | ||
| ParseFromTextFormat(ConfigFile, appConfig, EParseFromTextFormatOption::AllowUnknownField, &GetOutputStream()); |
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.
GetOutputStream() -> GetErrorStream()
| if (NFs::Exists(ConfigFile)) { | ||
| ParseFromTextFormat(ConfigFile, appConfig); | ||
| ParseFromTextFormat(ConfigFile, appConfig, EParseFromTextFormatOption::AllowUnknownField, &GetOutputStream()); | ||
| GetOutputStream() << Endl; |
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.
if ParseFromTextFormat doesn't print a \n to this stream, then it's better to use TStringStream ss and then do something like
if (ss.Str().Size()) {
GetErrorStream() << ss.Str() << '\n';
}
Now blockstore-client silently ignores unknown params in nbs-client.txt config file.