Fixes#853. Close#854. Previously, there was an unprotected endpoint in
raft to return the cluster config that would include user hashes. This
endpoint is useful for debugging purposes so I restructured it and moved
it to the API. It ensures the requesting user is a cluster admin.
Cluster config will now return all of the cluster state including
servers, CQs, shards, etc.
This will help users recover from #886. It's dangerous functionality because it only changes the metadata. Will document and tell people to use with caution.
Fix#791 - Removed load database config options from the daemon. Created an API endpoint and updated test.
Fix#745 - Added definition of continuous queries to load database config.
Close#792
Close#644
This commit also include lots of cleanup related to start up and
shutting down as well as logging. Below is an explanation of how the api
starts up and shuts down. It also covers the error conditions and how
they are handled.
networking/goroutine fixes
* break from TCP Accept() loop when connection closed, which was preventing shutdown to proceed
* make sure that UDP functionality doesn't write to writeSeries channel after it has been closed.
* clearer, more specific shutdown message
in particular:
* self.writers allows us to make sure things writing to writeSeries are done
(they do blocking calls to handleMessage()) whether udp or tcp
* self.connClosed lets us break from the Accept() loop,
see http://zhen.org/blog/graceful-shutdown-of-go-net-dot-listeners/ (quit channel)
* shutdown channel is now allCommitted
things can get a little complicated, so here's a little schematic of how the functions and
their logic relate:
indent for a call out or important code within. everything shown as one nested tree
server.go
go ListenAndServe
go committer
reads from self.writeSeries until closed, then writes to self.allCommitted
Serve
for {
Accept, breaks if err + connClosed
self.writers.Add()
go handleClient
for {
handleMessage
reads until err and writes to self.writeSeries until read failed
reads until EOF, ignores other handleMessage errors
}
conn.Close()
self.writers.Done()
}
self.writers.Wait()
close(self.writeSeries)
Close()
close(self.connClosed)
self.conn.Close()
wants confirmation on allCommitted channel; [timeout] returns within 5s