Commit Graph

3 Commits (4bc2bf492be728f017d93c3fea8879301b9b3883)

Author SHA1 Message Date
Dieter Plaetinck 856a94cc78 graphite ingest write data in batches to coordinator
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
2014-07-28 14:40:21 -04:00
John Shahid 39ea797dcd Fix #690. Use idiomatic go project structure
Conflicts:
	cluster/cluster_configuration.go
	cluster/shard.go
	coordinator/command.go
	coordinator/coordinator_test.go
	coordinator/raft_server.go
	daemon/influxd.go
	datastore/shard.go
	integration/single_server_test.go
	parser/query_spec.go
	server/server.go
2014-07-14 18:47:37 -04:00
John Shahid e5276112c1 Restructure the codebase to be more idiomatic 2014-06-30 11:31:08 -04:00