-
Notifications
You must be signed in to change notification settings - Fork 143
Refactor aligned printer #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
base: main
Are you sure you want to change the base?
Conversation
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.
- Added a review notes
- CI DCO check fails for the second commit in the PR. All commits need to be DCO-signed to pass this. The instructions how it can be simply fixed are here: https://github.com/bloomberg/blazingmq/blob/main/CONTRIBUTING.md#dco-check
- CI formatter check fails, need to run clang-format on source files before commiting, or alternatively you can use CI output to make fixes: https://github.com/bloomberg/blazingmq/actions/runs/13254786590/job/37026607247?pr=605
- Build fails, might be related to review notes
.gitignore
Outdated
docker/sanitizers/ | ||
lib64/ | ||
src/groups/mqb/mqbc/mqbc_clusterutil.t.cpp | ||
src/groups/mqb/mqbc/mqbc_clusterutil.t.cpp |
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.
Among these newly added items:
- Some are not expected in a normal workflow:
.bash_history
.bde_tools/
lib64/
- Some are legit project-related files or folders and there is no reason to ignore them:
docker/sanitizers/
src/groups/mqb/mqbc/mqbc_clusterutil.t.cpp
src/groups/mqb/mqbc/mqbc_clusterutil.t.cpp
Let's revert changes in this file
@@ -1219,7 +1219,7 @@ static void test14_summaryTest() | |||
fields.push_back("Number of partially confirmed messages"); | |||
fields.push_back("Number of confirmed messages"); | |||
fields.push_back("Number of outstanding messages"); | |||
bmqu::AlignedPrinter printer(expectedStream, &fields); | |||
bmqu::AlignedPrinter printer(expectedStream, fields); |
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.
Also need to change type a few lines above:
bsl::vector<const char*> fields
-> bsl::vector<bsl::string> fields
@@ -2108,7 +2108,7 @@ static void test24_summaryWithQueueDetailsTest() | |||
fields.push_back("Number of partially confirmed messages"); | |||
fields.push_back("Number of confirmed messages"); | |||
fields.push_back("Number of outstanding messages"); | |||
bmqu::AlignedPrinter printer(expectedStream, &fields); | |||
bmqu::AlignedPrinter printer(expectedStream, fields); |
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.
Also need to change type a few lines above:
bsl::vector<const char*> fields
-> bsl::vector<bsl::string> fields
@@ -71,7 +71,7 @@ void printRecord(bsl::ostream& stream, | |||
fields.push_back("GUID"); | |||
fields.push_back("Crc32c"); | |||
|
|||
bmqu::AlignedPrinter printer(stream, &fields); | |||
bmqu::AlignedPrinter printer(stream, fields); |
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.
Also need to change type, and do the same in other places in this file:
bsl::vector<const char*> fields
-> bsl::vector<bsl::string> fields
@@ -155,7 +155,7 @@ void printRecord(bsl::ostream& stream, | |||
} | |||
} | |||
|
|||
bmqu::AlignedPrinter printer(stream, &fields); | |||
bmqu::AlignedPrinter printer(stream, fields); |
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.
Also need to change type above:
bsl::vector<const char*> fields
-> bsl::vector<bsl::string> fields
@@ -81,7 +81,7 @@ void printJournalFileMeta(bsl::ostream& ostream, | |||
fields.push_back("SyncPoint DataFileOffset (DWORDS)"); | |||
fields.push_back("SyncPoint QlistFileOffset (WORDS)"); | |||
|
|||
bmqu::AlignedPrinter printer(ostream, &fields); | |||
bmqu::AlignedPrinter printer(ostream, fields); |
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.
Also need to change type, and do the same in other places in this file:
bsl::vector<const char*> fields
-> bsl::vector<bsl::string> fields
@@ -474,7 +474,7 @@ void StorageInspector::processCommand( | |||
fields.push_back("SyncPoint DataFileOffset (DWORDS)"); | |||
fields.push_back("SyncPoint QlistFileOffset (WORDS)"); | |||
|
|||
bmqu::AlignedPrinter printer(BALL_LOG_OUTPUT_STREAM, &fields); | |||
bmqu::AlignedPrinter printer(BALL_LOG_OUTPUT_STREAM, fields); |
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.
Also need to change type above, and do the same in other places in this file:
bsl::vector<const char*> fields
-> bsl::vector<bsl::string> fields
it.loadAppIds(&appIdLenPairs); | ||
it.loadAppIdHashes(&appIdHashes); |
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.
Also need to updates methods loadAppIds
and loadAppIdHashes
to use bsl::string
:
void loadAppIds(bsl::vector<AppIdLengthPair>* appIds) const; |
void loadAppIdHashes(bsl::vector<const char*>* appIdHashes) const; |
And this typedef:
typedef bsl::pair<const char*, unsigned int> AppIdLengthPair; |
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.
Hi Evgeny. Do you agree with the below?
typedef bsl::pair<bsl::string, unsigned int> AppIdLengthPair;
void loadAppIds(bsl::vector<AppIdLengthPair>& appIds) const;
void loadAppIdHashes(bsl::vector<bsl::string>& appIdHashes) const;
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.
Hi @ariraein
typedef bsl::pair<bsl::string, unsigned int> AppIdLengthPair;
This change is good.
void loadAppIds(bsl::vector& appIds) const;
void loadAppIdHashes(bsl::vectorbsl::string& appIdHashes) const;
For these 2 cases, we still have to pass output argument by pointer according to BDE coding standard we use:
https://bloomberg.github.io/bde/knowledge_base/coding_standards.html
So it should be:
void loadAppIds(bsl::vector<AppIdLengthPair> *appIds) const;
void loadAppIdHashes(bsl::vector<bsl::string> *appIdHashes) const;
Hi Evgeny. Sorry for the delay. The code changes/updates are done. The only problem is I'm trying to build locally before committing, so to cause no issues here, but so far having issues building on MacOS. Will take care of it by tomorrow. Thanks, Ari. |
c7e40fc
to
b1a7de7
Compare
Hi @ariraein, thank you for fixing DCO. It seems that the files that you modify in this PR were modified by other people, and it causes merge conflicts. Can you solve them? To start solving merge conflicts, you need to have the latest branch you want to merge to, in this case it's the base repository's
After this, you can start rebasing:
You can also check that the resolved version builds and after this you can continue
Hope these notes will be helpful. If you have any problems, don't hesitate to reach out |
b1a7de7
to
bce40cf
Compare
Hi @678098 Thank you so much for the explanation and help. |
bce40cf
to
66c46e9
Compare
Hi @ariraein, I am busy this week and can review or help on the next. For now, I can launch the CI to check if the PR builds |
Hi @678098 Thank you. I tried building locally and it was successful. If the PR fails, I will try my best to take care of it. |
01f226e
to
4604e20
Compare
hi @678098 when you have a chance can you please let me know know what am I doing wrong in the process? 1 - built successfully locally
|
Hi @ariraein
|
" Num Delete Records : 5"; | ||
|
||
bsl::string res(resultStream.str(), bmqtst::TestHelperUtil::allocator()); | ||
ASSERT(res.starts_with(expectedStream.str())); |
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.
A general comment, in the PR's description there are much more additions than deletions: +662 −72
It looks suspicious because you can expect the numbers to be pretty close if you are doing code refactor. If you look closely at the changed files, many of them have additions only. This means that the PR is adding new code rather than changing the existing one. I think the reason for this is the conflict resolution process when the code moved to another places in the main branch. You should probably search for the place where the code moved and apply changes there.
If you see places where the code was just added without modification of other code, it's probably a place where the conflict resolution went wrong
…pdate usage Signed-off-by: Ari Raein <[email protected]>
4604e20
to
86a7a1a
Compare
Issue number of the reported bug or feature request: #
Describe your changes
A clear and concise description of the changes you have made.
Testing performed
Describe the testing you have performed to ensure that the bug has been addressed, or that the new feature works as planned.
Additional context
Add any other context about your contribution here.