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 1 commit 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

.gitignore Outdated
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 709
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;

Copy link
Collaborator

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

Screenshot 2025-02-13 at 18 00 07

So it should be:

void loadAppIds(bsl::vector<AppIdLengthPair> *appIds) const;

void loadAppIdHashes(bsl::vector<bsl::string> *appIdHashes) const;

@ariraein
Copy link
Author

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.

@ariraein ariraein force-pushed the refactor-aligned-printer branch from c7e40fc to b1a7de7 Compare February 21, 2025 04:37
@678098
Copy link
Collaborator

678098 commented Feb 21, 2025

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 main. You can update metadata for this version of main with these commands:

# probably you have your fork of the repo configured, you can also add the base repo as a remote:
git remote add upstream https://github.com/bloomberg/blazingmq.git
git fetch upstream

After this, you can start rebasing:

# make sure you are in the feature branch
git checkout refactor-aligned-printer

# you can make a backup of your branch before resolving conflicts just to be safe
git checkout -b refactor-aligned-printer-backup

# you have created a backup and also switched branch, now you can go back to the branch you want to fix:
git checkout refactor-aligned-printer

# this command will try to move commits in your branch so it starts from the latest main from the base repo:
git rebase upstream/main

git rebase will complain that it cannot perform rebase because there are conflicts. It will also output the list of files with conflicts. You will need to go to these files and apply changes to resolve them.

You can also check that the resolved version builds and after this you can continue git rebase:

# add files that had conflicts fixed
git add .

# check that you haven't added files that are not needed
git status

# finish rebase, the command should complete
git rebase --continue

# now you can update the version of the branch in remote (this PR)
git push -f origin refactor-aligned-printer

Hope these notes will be helpful. If you have any problems, don't hesitate to reach out

Signed-off-by: Ari Raein <aliraein1@gmail.com>
@ariraein ariraein force-pushed the refactor-aligned-printer branch from b1a7de7 to bce40cf Compare February 22, 2025 04:04
@ariraein
Copy link
Author

Hi @678098 Thank you so much for the explanation and help.

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