Commit Graph

57 Commits (fad619a43be113ba3792f3215a34d8b8bc44334a)

Author SHA1 Message Date
Philip O'Toole dab100a3b1 Update sample config with topic truncation 2015-04-14 16:35:44 -07:00
Philip O'Toole 2002e64f20 Code review changes 2015-04-14 16:35:41 -07:00
Philip O'Toole f591150699 Update CHANGELOG 2015-04-14 15:56:43 -07:00
Philip O'Toole e9ce592e97 Create tombstone when topic is truncated
If a data node requests a topic index that is earier than is present for
a topic, tombstones allow the broker to know that the data node should
be redirected to another node that has the topic's data already
replicated. If no tombstone exists, then the broker can simply restart
replaying the topic data it has.
2015-04-14 15:56:39 -07:00
Philip O'Toole f6768e500f Don't delete unreplicated segments
A segment must now have been replicated by at least 1 node before it can
be deleted.
2015-04-14 15:15:27 -07:00
Philip O'Toole c9ea5f13de Correct out-of-date comment 2015-04-14 15:15:26 -07:00
Philip O'Toole b0ee5d0a78 Add broker truncation
Unit test same.
2015-04-14 15:15:26 -07:00
Philip O'Toole 9dbef70ff8 Fix typo in comments 2015-04-14 15:15:26 -07:00
Philip O'Toole 8470ee27b6 Make MaxTopicSize and MaxSegmentSize configurable 2015-04-14 15:15:26 -07:00
Ben Johnson eaf4bfca0a Fix term signal.
This commit changes raft so that term changes are made immediately and
term change signals are made afterward. Previously, election timeouts
were invalidated by incoming term changes which caused an election loop.

Stale term was also fixed and http/pprof was added too.
2015-04-10 13:52:20 -06:00
Ben Johnson cc83f2c39b Add checksum to message encoding
This commit changes the binary format of messaging.Message to encode
a 4-byte checksum at the beginning of it. This is used when reading
data back out to verify that it is not corrupt.

Corrupted messages are truncated on recovery so the broker can
restart from the previous message.
2015-04-07 14:24:22 -06:00
Ben Johnson 7aad1a5820 Remove dead code in messaging. 2015-04-07 12:36:07 -06:00
Jason Wilder 0f1fb3a5c3 Fix race on Topic.indexByUrl
applySetTopicMaxIndex() was updating the topics.indexByUrl w/o locking it.

WARNING: DATA RACE
Write by goroutine 1365:
  runtime.mapassign1()
      /usr/local/go/src/runtime/hashmap.go:376 +0x0
  github.com/influxdb/influxdb/messaging.(*Broker).applySetTopicMaxIndex()
      /home/ubuntu/.go_project/src/github.com/influxdb/influxdb/messaging/broker.go:496 +0x198
  github.com/influxdb/influxdb/messaging.(*Broker).Apply()
      /home/ubuntu/.go_project/src/github.com/influxdb/influxdb/messaging/broker.go:542 +0x33a
  github.com/influxdb/influxdb.(*Broker).Apply()
      <autogenerated>:1 +0x78
  github.com/influxdb/influxdb/messaging.(*RaftFSM).Apply()
      /home/ubuntu/.go_project/src/github.com/influxdb/influxdb/messaging/broker.go:614 +0x24f
  github.com/influxdb/influxdb/raft.(*Log).applyNextUnappliedEntry()
      /home/ubuntu/.go_project/src/github.com/influxdb/influxdb/raft/log.go:1431 +0x75c
  github.com/influxdb/influxdb/raft.(*Log).applier()
      /home/ubuntu/.go_project/src/github.com/influxdb/influxdb/raft/log.go:1369 +0x18f

Previous read by goroutine 1540:
  runtime.mapiterinit()
      /usr/local/go/src/runtime/hashmap.go:535 +0x0
  github.com/influxdb/influxdb/messaging.(*Topic).DataURLs()
      /home/ubuntu/.go_project/src/github.com/influxdb/influxdb/messaging/broker.go:681 +0x11d
  github.com/influxdb/influxdb/cmd/influxd.(*Handler).serveMetadata()
      /home/ubuntu/.go_project/src/github.com/influxdb/influxdb/cmd/influxd/handler.go:95 +0x3fd
  github.com/influxdb/influxdb/cmd/influxd.(*Handler).ServeHTTP()
      /home/ubuntu/.go_project/src/github.com/influxdb/influxdb/cmd/influxd/handler.go:45 +0x540
  net/http.serverHandler.ServeHTTP()
      /usr/local/go/src/net/http/server.go:1703 +0x1f6
  net/http.(*conn).serve()
      /usr/local/go/src/net/http/server.go:1204 +0x1087
2015-04-06 21:16:19 -06:00
Ben Johnson fd96e245cb Merge branch 'master' of https://github.com/influxdb/influxdb into broker-recovery
Conflicts:
	CHANGELOG.md
2015-04-04 08:09:06 -06:00
Ben Johnson ba3026f400 Broker log recovery.
This pull request adds recovery to the messaging.Topic when opening. If
any partial messages are found then the file is truncated at that point
and started from there. This can occur when ungracefully shutting down
a server. It can leave half written messages at the end of segments.
2015-04-04 08:06:35 -06:00
Jason Wilder 6d4c7e9cd5 Handle broker and data node endpoints regardless of role
This is a pre-requisite for #1934.  When running separate
broker and data nodes, you currently need to know what role
a host is performing.  This complicates cluster setup in
that you must configure separate broker URLs and data node
URLs.

This change allows a broker only node to redirect data nodes endpoints
to a valid data node and a data only node to redirect broker
endpoints to a valid broker.
2015-04-03 21:00:43 -06:00
Jason Wilder 91fb7e3756 Track data node urls on brokers
This sends data node urls via the broker heartbeat from each data
node.  The urls are tracked on the broker to support simpler
cluster setup as well as distributed queries.
2015-04-02 11:27:53 -06:00
Ben Johnson 057309fc8e Simplify raft snapshotting, entry apply. 2015-03-26 20:32:39 -06:00
Philip O'Toole c461c7e7b4 Remove logging to specific file 2015-03-25 17:41:39 -07:00
Ben Johnson 11c808f55f Add restore and bootstrap.
This commit adds the "influxd restore" command to the CLI. This allows
a snapshot that has been produced by "influxd backup" to be restored
to a config location and the broker and raft directories will be
bootstrapped based on the state of the snapshot.
2015-03-22 15:31:49 -06:00
Ben Johnson 41d357ac04 Fixes based on code review comments. 2015-03-14 14:07:09 -06:00
Ben Johnson b045ad5d92 Wrap open logic in anonymous functions. 2015-03-14 13:55:19 -06:00
Ben Johnson 96748cb217 Update file permissions. 2015-03-14 13:49:25 -06:00
Ben Johnson 53dbec8232 Add config notifications and increased test coverage. 2015-03-14 13:36:06 -06:00
Ben Johnson 5f6bcf523f Fix broker integration bugs. 2015-03-11 12:00:45 -06:00
Ben Johnson 27e9132796 Integrate stateless broker into remaining packages. 2015-03-10 14:53:45 -06:00
Ben Johnson 4160d0b785 Add continuously streaming topic readers. 2015-03-09 22:32:12 -06:00
Ben Johnson ef8658e0fc Continuing stateless broker refactor. 2015-03-08 15:28:43 -06:00
Ben Johnson b937f06c1f Implementing stateless broker. 2015-03-05 19:32:20 -07:00
Ben Johnson 1bbf154f2a Removing replicas and subscriptions from broker. 2015-03-01 22:32:20 -07:00
Ben Johnson 16dbe8ba2f Add Broker.Truncate(). 2015-03-01 07:06:25 -07:00
Ben Johnson 39ae8e6406 Add topic segmentation. 2015-02-24 20:32:20 -07:00
Todd Persen e45611cde3 Pull in cluster ID for reporting. 2015-02-23 10:42:39 -08:00
Ben Johnson 7107d4b0ac Start replica subscription from index zero. 2015-02-21 15:01:32 -08:00
Ben Johnson 408cf37e5a Fix broker reopen test, docs. 2015-02-21 15:25:11 -07:00
Ben Johnson a5692b71ee Add proper broker recovery.
This commit fixes the broker recovery so that it determines the last index
from the various topic logs instead of persisting the snapshot on every
message that comes in.
2015-02-21 08:21:51 -07:00
Paul Dix 36d16a3172 Update broker to have URLs for replicas
* Update the infludb broker to not need a server so that it'll work on non-data node servers
* Update messaging broker to keep track of connect urls for replicas
2015-02-17 21:02:53 -05:00
Ben Johnson 43e27680a4 Partial CQ structure.
Conflicts:
	cmd/influxd/run.go
2015-02-17 20:59:57 -05:00
Ben Johnson 6c14371df4 Refactor raft package.
This commit refactors the raft package to more loosely couple the individual parts. The clock is now broken into
an interface that signals individual actions in the log. The transport has been mocked to allow more control over
the log tests. The handler's log has been mocked to separate its testing from the log itself.
2015-02-04 18:59:06 -07:00
Philip O'Toole 9943f86cf4 Enable module-level logging 2015-01-29 15:07:58 -08:00
Ben Johnson cc025f3e74 Fix broker metadata persistence. 2015-01-28 03:21:00 -05:00
Ben Johnson 3601c3c79f Fix restarts and broker redirection. 2015-01-28 01:09:50 -05:00
Cory LaNou b815cb5689 go vet without arguments will now pass cleanly 2015-01-13 11:15:45 -07:00
Ben Johnson c20746ffa6 Code review fixes. 2015-01-10 09:08:00 -07:00
Ben Johnson 50a0826026 Add broker snapshot/restore and CLI join. 2015-01-06 17:21:32 -07:00
Ben Johnson dbb089488f Create cluster on initial run. 2014-12-31 12:42:53 -07:00
Ben Johnson 7a1de8a459 Use replica id instead of replica name. 2014-12-23 17:01:06 -07:00
Philip O'Toole 66016e10ff Check for connection URL on Broker Open()
Update unit tests suitably.
2014-12-19 17:09:39 -05:00
Philip O'Toole b8c04f96c4 connectionAddr -> addr
This is more line with existing Go packages.
2014-12-19 16:18:48 -05:00
Philip O'Toole 021604a6de Add connection URL to Broker 2014-12-19 16:18:01 -05:00