[ 
https://issues.apache.org/jira/browse/CASSANDRA-14754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17066591#comment-17066591
 ] 

Benjamin Lerer commented on CASSANDRA-14754:
--------------------------------------------

My understanding of the possible states transition is the following:
{code}
 
      +-------------+----------> FAILED <---------+
      |             |              ^              |              
      |             |              |              |                
INITIALIZED --> PREPARING --> STREAMING --> WAIT_COMPLETE ---> COMPLETED    
      |             |                             ^                ^
      |             |     if preview              |                |
      |             +-----------------------------+                |
      |           nothing to request or to transfer                |
      +------------------------------------------------------------+ 
                  nothing to request or to transfer 

{code}

It should not be possible for example to go from {{INITIALIZED}} to 
{{STREAMING}}.
The current patch does not check that type of state transitions and it might be 
good if it does.

Otherwise, the patch is firing an `IllegalStateException` in case of invalid 
state transition. It seems fine to me but I am not an expert in this part of 
the code.
[~jasobrown], [~djoshi] do you have any concerns with the approach?

> Add verification of state machine in StreamSession
> --------------------------------------------------
>
>                 Key: CASSANDRA-14754
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-14754
>             Project: Cassandra
>          Issue Type: Task
>          Components: Legacy/Streaming and Messaging
>            Reporter: Jason Brown
>            Assignee: ZhaoYang
>            Priority: Normal
>             Fix For: 4.0
>
>
> {{StreamSession}} contains an implicit state machine, but we have no 
> verification of the safety of the transitions between states. For example, we 
> have no checks to ensure we cannot leave the final states (COMPLETED, FAILED).
> I propose we add some program logic in {{StreamSession}}, tests, and 
> documentation to ensure the correctness of the state transitions.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to