elodina / datastax-enterprise-mesos

DataStax Enterprise on Mesos
http://www.elodina.net
15 stars 4 forks source link

Progress for restart #83

Closed olegkovalenko closed 8 years ago

olegkovalenko commented 8 years ago

MOTIVATION Node restart takes significant amount of time.

Default timeout is 5m per node and it is unclear for the user what is the current overall progress of the operation (consider we are restarting 10 nodes, for instance).

It would be good to print some progress in CLI like:

#./dse-mesos.sh node restart 0..9
stopping node 0 ... done
starting node 0 ... done
...
stopping node 9 ... done
starting node 9 ... done

PROPOSED CHANGE

Definition of stopping node for progress is transition of node state from starting, running, stopping to starting.

Definition of starting node for progress is transition of node state from starting to running.

Use streaming (transfer-encoding chunked) to display progress, however it requires fundamental backward compatible changes for:

when HTTP Server handle request for /node/restart and parameter progress presents, server writes "stopping node $id ... " before stopping node and when it has been stopped writes "done", before starting node it writes "starting node $id ... " and when it is running writes "done", on client side CLI, handles lines as they arrive and passes them to callback function, when chunk starts with "{" it parses it and returns control to caller (accumulating everything after "{" into single string and return it). Some how easier implementation on CLI side and deadlock due to ordering of starting/stopping nodes impossible however requires backward compatible changes on HTTP Server and CLI part.

CLI changes:

HTTP Server changes:

NEW OR CHANGED PUBLIC INTERFACES:

    private[dse] def sendRequest(uri: String, params: Map[String, String], urlPathPrefix: String = "api", parseJson: Boolean = true, onChunk: String => Unit = null): Any

MIGRATION PLAN AND COMPATIBILITY:

REJECTED ALTERNATIVES:

RESULT: having better user experience, ability to view progress of restart

dmitrypekar commented 8 years ago

Great PR. Everything works perfectly, except 3 small points, which I have commented. Please fix them for merge.

dmitrypekar commented 8 years ago

Merged. Thank you for great addition.

olegkovalenko commented 8 years ago

@dmitrypekar thanks for review and valuable feedback!