Merge pull request #359 from influxdb/fix-359-log-compaction

Influxdb isn't functional after restarting the entire cluster
pull/342/head
John Shahid 2014-03-24 19:47:50 -04:00
commit 549eff33de
5 changed files with 32 additions and 2 deletions

2
.gitignore vendored
View File

@ -31,6 +31,7 @@ build/
/main
godef
gosym
gocode
# dependencies
src/code.google.com/p/log4go
@ -42,6 +43,7 @@ src/code.google.com/p/go.crypto/
src/launchpad.net/gocheck/
/src/github.com/nsf/gocode/
/src/github.com/*
!/src/github.com/goraft/
out_rpm/
packages/

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "src/github.com/goraft/raft"]
path = src/github.com/goraft/raft
url = git@github.com:goraft/raft.git

View File

@ -20,7 +20,7 @@ endif
export GOARCH
export CGO_ENABLED
.PHONY: all valgrind parser package replace_version_string build binary_package
.PHONY: all valgrind parser package replace_version_string build binary_package dependencies
all: | parser valgrind build test integration_test
@ -124,6 +124,7 @@ $(dependencies_paths):
for i in $(dependencies); do $(GO) get -d $$i; done
dependencies: src/$(levigo_dependency) $(dependencies_paths) $(leveldb_deps) $(snappy_deps)
git submodule update --init
test_dependencies: dependencies
$(GO) get launchpad.net/gocheck

@ -0,0 +1 @@
Subproject commit d660352794fc8ed9af25e74bd92598eeb4611ef6

View File

@ -84,7 +84,7 @@ func (self *ServerSuite) precreateShards(server *ServerProcess, c *C) {
time.Sleep(time.Second)
go self.createShards(server, int64(3600), "false", c)
go self.createShards(server, int64(86400), "true", c)
time.Sleep(2 * time.Second)
time.Sleep(3 * time.Second)
}
func (self ServerSuite) createShards(server *ServerProcess, bucketSize int64, longTerm string, c *C) {
@ -641,6 +641,29 @@ func (self *ServerSuite) TestRestartAfterCompaction(c *C) {
c.Assert(series.Points, HasLen, 1)
}
func (self *ServerSuite) TestEntireClusterRestartAfterCompaction(c *C) {
for i := 0; i < 3; i++ {
resp := self.serverProcesses[i].Post("/raft/force_compaction?u=root&p=root", "", c)
c.Assert(resp.StatusCode, Equals, http.StatusOK)
}
for i := 0; i < 3; i++ {
self.serverProcesses[i].Stop()
}
time.Sleep(3 * time.Second)
for i := 0; i < 3; i++ {
self.serverProcesses[i].Start()
}
time.Sleep(time.Second * 3)
for i := 0; i < 3; i++ {
self.serverProcesses[i].Get("/ping", c)
}
}
// For issue #140 https://github.com/influxdb/influxdb/issues/140
func (self *ServerSuite) TestRestartServers(c *C) {
data := `