[
https://issues.apache.org/jira/browse/CASSANDRA-19902?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18009518#comment-18009518
]
Stefan Miklosovic edited comment on CASSANDRA-19902 at 7/24/25 10:38 AM:
-------------------------------------------------------------------------
Actually it is quite suspicious behaviour, if I enrich operationMode() like this
{code}
public Mode operationMode()
{
NodeId nodeId = ClusterMetadata.current().myNodeId();
NodeState nodeState1 = ClusterMetadata.current().myNodeState();
boolean bootstrapMode = isBootstrapMode();
if (!isInitialized())
return Mode.STARTING;
{code}
and I put breakpoints while a node starts, it might happen that nodeState1 will
be "JOINED" while it will return StorageService.Mode.STARTING just because it
was not fully initialized (isInitialized() will return false) which is set to
true by StorageService.completeInitialization() at the very end of
StorageService.initServer(). Basically operationMode will return STARTING as
long as initServer is not at the end. I guess that operationMode() should
reflect the mode while initServer() is still running. I am not sure why we
would wait so long until the end of initServer to start to return the true mode
as is seen via NodeState.
When I remove
{code}
if (!isInitialized())
return Mode.STARTING;
{code}
from operationMode() then your test in trunk just passes as node's state will
be BOOTSTRAPPING which will translate to Mode.JOINING which your test asserts.
I believe this is the correct behavior.
I will run CI to see where it breaks if I remove it like that.
was (Author: smiklosovic):
Actually it is quite suspicious behaviour, if I enrich operationMode() like this
{code}
public Mode operationMode()
{
NodeId nodeId = ClusterMetadata.current().myNodeId();
NodeState nodeState1 = ClusterMetadata.current().myNodeState();
boolean bootstrapMode = isBootstrapMode();
if (!isInitialized())
return Mode.STARTING;
{code}
and I put breakpoints while a node starts, it might happen that nodeState1 will
be "JOINED" while it will return StorageService.Mode.STARTING just because it
was not fully initialized (isInitialized() will return false) which is set to
true by StorageService.completeInitialization() at the very end of
StorageService.initServer(). Basically operationMode will return STARTING as
long as initServer is not at the end. I guess that operationMode() should
reflect the mode while initServer() is still running. I am not sure why we
would wait so long until the end of initServer to start to return the true mode
as is seen via NodeState.
> StorageService JMX mbean is not available during bootstrap
> ----------------------------------------------------------
>
> Key: CASSANDRA-19902
> URL: https://issues.apache.org/jira/browse/CASSANDRA-19902
> Project: Apache Cassandra
> Issue Type: Bug
> Components: Tool/nodetool
> Reporter: Paulo Motta
> Assignee: Paulo Motta
> Priority: Normal
> Fix For: 5.0.x, 5.x
>
> Time Spent: 1h 50m
> Remaining Estimate: 0h
>
> Looks like the seemingly harmless cosmetic patch from CASSANDRA-11537 causes
> the StorageServiceMBean to not be available during bootstrap. This causes
> commands like "nodetool nestats/status/etc" to not be available on the
> boostrapping node with the following error:
> {code:none}
> - StackTrace --
> javax.management.InstanceNotFoundException:
> org.apache.cassandra.db:type=StorageService
> at
> java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1083)
> at
> java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:637)
> {code}
> This ticket is just to revert CASSANDRA-11537, we can re-add the improvement
> of that ticket later.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]