Skip to content

HDDS-15730. Support more StatefulService types in DBScanner#10654

Open
adoroszlai wants to merge 4 commits into
apache:masterfrom
adoroszlai:HDDS-15730
Open

HDDS-15730. Support more StatefulService types in DBScanner#10654
adoroszlai wants to merge 4 commits into
apache:masterfrom
adoroszlai:HDDS-15730

Conversation

@adoroszlai

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Refactor SCM StatefulService to allow using its static metadata (name, parser) without instantiating the service or duplicating code in DBScanner.

Add support for Container Balancer and Root CA Rotation Manager services in DBScanner.

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

How was this patch tested?

$ ozone admin containerbalancer start
Container Balancer started successfully.

$ ozone debug ldb --db=/data/metadata/scm.db scan --cf=statefulServiceConfig
{ "ContainerBalancer": {
  "memoizedHashCode" : 0,
  "memoizedSize" : -1,
  "unknownFields" : {
    "fields" : { }
  },
  "bitField0_" : 262143,
  "utilizationThreshold_" : {
    "hash" : 0,
    "bytes" : "MTA="
  },
  "datanodesInvolvedMaxPercentagePerIteration_" : 20,
  "sizeMovedMaxPerIteration_" : 536870912000,
  "sizeEnteringTargetMax_" : 27917287424,
  "sizeLeavingSourceMax_" : 27917287424,
  "iterations_" : 10,
  "excludeContainers_" : {
    "hash" : 0,
    "bytes" : ""
  },
  "moveTimeout_" : 3900000,
  "balancingIterationInterval_" : 4200000,
  "includeDatanodes_" : {
    "hash" : 0,
    "bytes" : ""
  },
  "excludeDatanodes_" : {
    "hash" : 0,
    "bytes" : ""
  },
  "moveNetworkTopologyEnable_" : false,
  "triggerDuBeforeMoveEnable_" : false,
  "shouldRun_" : false,
  "nextIterationIndex_" : 0,
  "moveReplicationTimeout_" : 3000000,
  "includeContainers_" : {
    "hash" : 0,
    "bytes" : ""
  },
  "includeNonStandardContainers_" : false,
  "memoizedIsInitialized" : 1
}
 }

https://github.com/adoroszlai/ozone/actions/runs/28643243287

@jojochuang

Copy link
Copy Markdown
Contributor

@sreejasahithi

@sreejasahithi sreejasahithi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @adoroszlai for the PR.

Comment on lines +58 to +60
public static final StatefulServiceDefinition<DeletedBlocksTransaction> SERVICE_DEFINITION =
new StatefulServiceDefinition<>(SERVICE_NAME, DeletedBlocksTransaction.parser());

@sreejasahithi sreejasahithi Jul 6, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

SERVICE_DEFINITION here should use DeletedBlocksTransactionSummary, not DeletedBlocksTransaction:

Suggested change
public static final StatefulServiceDefinition<DeletedBlocksTransaction> SERVICE_DEFINITION =
new StatefulServiceDefinition<>(SERVICE_NAME, DeletedBlocksTransaction.parser());
public static final StatefulServiceDefinition<DeletedBlocksTransactionSummary> SERVICE_DEFINITION =
new StatefulServiceDefinition<>(SERVICE_NAME, DeletedBlocksTransactionSummary.parser());

The old DBScanner also parsed it as DeletedBlocksTransactionSummary.

Copy link
Copy Markdown
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 this. The other two definitions are used with subclasses of StatefulService, which ensures type safety. I don't know why this one is different, but now made some further change: use the definition in loadDeletedBlocksSummary(), which returns DeletedBlocksTransactionSummary, so that type mismatch is caught at compile time.

@adoroszlai adoroszlai requested a review from sreejasahithi July 7, 2026 06:33

@sreejasahithi sreejasahithi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scm tools Tools that helps with debugging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants