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

HDDS-11866. Remove code paths for non-Ratis OM #7778

Merged
merged 8 commits into from
Feb 6, 2025

Conversation

adoroszlai
Copy link
Contributor

What changes were proposed in this pull request?

Remove production code for non-Ratis case in Ozone Manager, except request/response classes (to be done in HDDS-12161 to keep patch size smaller).

Real change is easier to see with --ignore-space-change:

git diff --ignore-space-change fc89ba6aef..

https://issues.apache.org/jira/browse/HDDS-11866

How was this patch tested?

CI:
https://github.com/adoroszlai/ozone/actions/runs/13038347046

@adoroszlai adoroszlai added the code-cleanup Changes that aim to make code better, without changing functionality. label Jan 29, 2025
@adoroszlai adoroszlai self-assigned this Jan 29, 2025
@@ -260,9 +254,6 @@ public OMPrefixAclOpResult addAcl(OzoneObj ozoneObj, OzoneAcl ozoneAcl,
// update the in-memory prefix tree
prefixTree.insert(ozoneObj.getPath(), prefixInfo);

if (!isRatisEnabled) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure about this one. This code path (isRatisEnabled=false) is used by OmSnapshotManager. Are we sure it doesn't break the Snapshot feature?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Restored.

Copy link
Contributor

Choose a reason for hiding this comment

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

@hemantk-12 or @smengcl do you know why Snapshot creates PrefixManagerImpl assuming ratis not enabled?

@@ -4289,8 +4249,9 @@ public void checkLeaderStatus() throws OMNotLeaderException,
/**
* Return if Ratis is enabled or not.
*/
// FIXME remove
Copy link
Contributor

Choose a reason for hiding this comment

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

TODO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is for HDDS-12161, added issue number in the comment.

@@ -384,8 +384,7 @@ public OmSnapshot load(@Nonnull UUID snapshotId) throws IOException {
try {
// create the other manager instances based on snapshot
// metadataManager
PrefixManagerImpl pm = new PrefixManagerImpl(ozoneManager, snapshotMetadataManager,
false);
Copy link
Contributor

Choose a reason for hiding this comment

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

isRatisEnabled = false

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, restored.

@jojochuang
Copy link
Contributor

jojochuang commented Feb 4, 2025

Would an upgrade from non-HA OM to HA OM work properly? Not sure if the upgrade path is tested properly

@adoroszlai
Copy link
Contributor Author

Thanks @jojochuang for the review.

Would an upgrade from non-HA OM to HA OM work properly? Not sure if the upgrade path is tested properly

I thought the idea is to only support upgrade with OM Ratis already enabled (i.e. have to enabled it before upgrade).

Copy link
Contributor

@jojochuang jojochuang left a comment

Choose a reason for hiding this comment

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

Apart from PrefixManagerImpl this is looking almost ready to go

Comment on lines 71 to 73
* Only used to handle write requests when ratis is disabled.
* When ratis is enabled, write requests are handled by the state machine.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this comment

Suggested change
* Only used to handle write requests when ratis is disabled.
* When ratis is enabled, write requests are handled by the state machine.
*/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for spotting it, the variable is also leftover.

public PrefixManagerImpl(OzoneManager ozoneManager, OMMetadataManager metadataManager,
boolean isRatisEnabled) {
this.isRatisEnabled = isRatisEnabled;
public PrefixManagerImpl(OzoneManager ozoneManager, OMMetadataManager metadataManager) {
Copy link
Contributor

Choose a reason for hiding this comment

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

OzoneManager instantiates a PrefixManagerImpl with isRatisEnabled = true and
OmSnapshotManager instantiates a PrefixManagerImpl with isRatisEnabled = false.

I would suggest to restore PrefixManagerImpl, and rename isRatisEnabled to persistentToRocksDB, because it looks like OmSnapshotManager repurposed it and which is unrelated to Ratis.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Restored, now the tests are unchanged compared to master. However, I kept the name isRatisEnabled, someone more familiar with snapshots can rename it separately.

Copy link
Contributor

@jojochuang jojochuang left a comment

Choose a reason for hiding this comment

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

+1

@jojochuang jojochuang merged commit 334ad8c into apache:master Feb 6, 2025
42 checks passed
@jojochuang
Copy link
Contributor

Merged. Thanks @adoroszlai

@adoroszlai
Copy link
Contributor Author

Thanks @jojochuang for reviewing and merging this.

@adoroszlai adoroszlai deleted the HDDS-11866 branch February 7, 2025 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-cleanup Changes that aim to make code better, without changing functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants