[ 
https://issues.apache.org/jira/browse/HDDS-17843?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

rajesh updated HDDS-17843:
--------------------------
    Description: 
{{OzoneManagerRatisServer}} keeps and exposes the concrete 
{{OzoneManagerStateMachine}}, and callers depend on the class instead of an 
abstraction. Same kind of refactor as HDDS-17842 for SCM.

*Problems*
# {{OzoneManagerRatisServer.getOmStateMachine()}} returns the concrete class.
** Callers in {{OzoneManager}} use class-only methods: {{awaitApplied(...)}}, 
{{pause()}}, {{unpause(...)}} and {{awaitDoubleBufferFlush()}}.
** Callers cannot use the Ratis {{StateMachine}} interface, and the state 
machine cannot be wrapped (for example by a tracing proxy) or substituted 
without a raw-instance workaround.
# The state machine is built with a constructor flag, {{new 
OzoneManagerStateMachine(this, TracingUtil.isTracingEnabled(conf))}}, which 
only switches on tracing for the double buffer. A cross-cutting concern is 
passed through the constructor.
# OM lifecycle operations are driven through the state machine: pause and 
unpause around a DB checkpoint install, and waiting for the double buffer 
flush. These are OM operations and not Ratis state machine behaviour.

*Proposal (to be refined)*
* Define a narrow interface, extending Ratis {{StateMachine}}, for what OM 
needs from it (await applied index, pause and unpause, double buffer flush). 
Make {{OzoneManagerRatisServer}} and {{OzoneManager}} depend on it.
* Look at moving pause, unpause and the double buffer flush behind an OM-owned 
component, so the state machine only handles Ratis concerns.
* Create the state machine through {{TracingUtil.createInternalProxy}} so every 
Ratis call can be traced without manual spans, and drop the 
{{isTracingEnabled}} constructor flag if nothing else needs it.

*Benefits*
* Easy proxying and decoration, with no raw-instance workaround.
* OM code can be tested against the interface without a full state machine.
* The state machine shrinks to Ratis concerns, and tracing no longer has to be 
passed through the constructor.

*Out of scope:* any behaviour change, and any change to the Ratis log or the OM 
protocol.

  was:
{{OzoneManagerRatisServer}} keeps and exposes the concrete 
{{OzoneManagerStateMachine}}, and callers depend on the class instead of an 
abstraction. Same kind of refactor as HDDS-17842 for SCM.

_Problems_

h1. {{OzoneManagerRatisServer.getOmStateMachine()}} returns the concrete class.
#* Callers in {{OzoneManager}} use class-only methods: {{awaitApplied(...)}}, 
{{pause()}}, {{unpause(...)}} and {{awaitDoubleBufferFlush()}}.
#* Callers cannot use the Ratis {{StateMachine}} interface, and the state 
machine cannot be wrapped (for example by a tracing proxy) or substituted 
without a raw-instance workaround.
h1. The state machine is built with a constructor flag, {{new 
OzoneManagerStateMachine(this, TracingUtil.isTracingEnabled(conf))}}, which 
only switches on tracing for the double buffer. A cross-cutting concern is 
passed through the constructor.
h1. OM lifecycle operations are driven through the state machine: pause and 
unpause around a DB checkpoint install, and waiting for the double buffer 
flush. These are OM operations and not Ratis state machine behaviour.

_Proposal (to be refined)_
* Define a narrow interface, extending Ratis {{StateMachine}}, for what OM 
needs from it (await applied index, pause and unpause, double buffer flush). 
Make {{OzoneManagerRatisServer}} and {{OzoneManager}} depend on it.
* Look at moving pause, unpause and the double buffer flush behind an OM-owned 
component, so the state machine only handles Ratis concerns.
* Create the state machine through {{TracingUtil.createInternalProxy}} so every 
Ratis call can be traced without manual spans, and drop the 
{{isTracingEnabled}} constructor flag if nothing else needs it.

_Benefits_
* Easy proxying and decoration, with no raw-instance workaround.
* OM code can be tested against the interface without a full state machine.
* The state machine shrinks to Ratis concerns, and tracing no longer has to be 
passed through the constructor.

_Out of scope:_ any behaviour change, and any change to the Ratis log or the OM 
protocol.


> Refactor OzoneManagerStateMachine: stop exposing the concrete class from 
> OzoneManagerRatisServer
> ------------------------------------------------------------------------------------------------
>
>                 Key: HDDS-17843
>                 URL: https://issues.apache.org/jira/browse/HDDS-17843
>             Project: Apache Ozone
>          Issue Type: Task
>          Components: Ozone Manager
>            Reporter: rajesh
>            Priority: Major
>
> {{OzoneManagerRatisServer}} keeps and exposes the concrete 
> {{OzoneManagerStateMachine}}, and callers depend on the class instead of an 
> abstraction. Same kind of refactor as HDDS-17842 for SCM.
> *Problems*
> # {{OzoneManagerRatisServer.getOmStateMachine()}} returns the concrete class.
> ** Callers in {{OzoneManager}} use class-only methods: {{awaitApplied(...)}}, 
> {{pause()}}, {{unpause(...)}} and {{awaitDoubleBufferFlush()}}.
> ** Callers cannot use the Ratis {{StateMachine}} interface, and the state 
> machine cannot be wrapped (for example by a tracing proxy) or substituted 
> without a raw-instance workaround.
> # The state machine is built with a constructor flag, {{new 
> OzoneManagerStateMachine(this, TracingUtil.isTracingEnabled(conf))}}, which 
> only switches on tracing for the double buffer. A cross-cutting concern is 
> passed through the constructor.
> # OM lifecycle operations are driven through the state machine: pause and 
> unpause around a DB checkpoint install, and waiting for the double buffer 
> flush. These are OM operations and not Ratis state machine behaviour.
> *Proposal (to be refined)*
> * Define a narrow interface, extending Ratis {{StateMachine}}, for what OM 
> needs from it (await applied index, pause and unpause, double buffer flush). 
> Make {{OzoneManagerRatisServer}} and {{OzoneManager}} depend on it.
> * Look at moving pause, unpause and the double buffer flush behind an 
> OM-owned component, so the state machine only handles Ratis concerns.
> * Create the state machine through {{TracingUtil.createInternalProxy}} so 
> every Ratis call can be traced without manual spans, and drop the 
> {{isTracingEnabled}} constructor flag if nothing else needs it.
> *Benefits*
> * Easy proxying and decoration, with no raw-instance workaround.
> * OM code can be tested against the interface without a full state machine.
> * The state machine shrinks to Ratis concerns, and tracing no longer has to 
> be passed through the constructor.
> *Out of scope:* any behaviour change, and any change to the Ratis log or the 
> OM protocol.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to