Skip to content
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

Refactor aligned printer #605

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ariraein
Copy link

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.

@ariraein ariraein requested a review from a team as a code owner February 11, 2025 02:42
Copy link
Collaborator

@678098 678098 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Added a review notes
  2. 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
  3. 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
  4. Build fails, might be related to review notes

docker/sanitizers/
lib64/
src/groups/mqb/mqbc/mqbc_clusterutil.t.cpp
src/groups/mqb/mqbc/mqbc_clusterutil.t.cpp
Copy link
Collaborator

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:

  1. Some are not expected in a normal workflow:
.bash_history
.bde_tools/
lib64/
  1. 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);
Copy link
Collaborator

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);
Copy link
Collaborator

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);
Copy link
Collaborator

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);
Copy link
Collaborator

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);
Copy link
Collaborator

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);
Copy link
Collaborator

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

Comment on lines 686 to 687
it.loadAppIds(&appIdLenPairs);
it.loadAppIdHashes(&appIdHashes);
Copy link
Collaborator

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;

Copy link
Author

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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants