fix bug where cluster goes into RESIZING instead of NORMAL

running
"make clustertests
DOCKER_COMPOSE=internal/clustertests/docker-compose-replication2.yml"

shows this issue (just remove the change in cluster.go).

Also removed two unrelated lines of code that appear to be doing absolutely nothing.
This commit is contained in:
Matt Jaffee 2018-12-10 14:53:06 -06:00
parent 01e520d9ea
commit 7e6c406212
No known key found for this signature in database
GPG key ID: 08A3DFFF987B11BF
3 changed files with 68 additions and 6 deletions

View file

@ -68,20 +68,24 @@ release: check-clean
$(MAKE) release-build GOOS=linux GOARCH=386
$(MAKE) release-build GOOS=linux GOARCH=386 ENTERPRISE=1
# try (e.g.) internal/clustertests/docker-compose-replication2.yml
DOCKER_COMPOSE=internal/clustertests/docker-compose.yml
# Run cluster integration tests using docker. Requires docker daemon to be
# running. This will catch changes to internal/clustertests/*.go, but if you
# make changes to Pilosa, you'll want to run clustertests-build to rebuild the
# pilosa image.
clustertests:
docker-compose -f internal/clustertests/docker-compose.yml down
docker-compose -f internal/clustertests/docker-compose.yml build client1
docker-compose -f internal/clustertests/docker-compose.yml up --exit-code-from=client1
docker-compose -f $(DOCKER_COMPOSE) down
docker-compose -f $(DOCKER_COMPOSE) build client1
docker-compose -f $(DOCKER_COMPOSE) up --exit-code-from=client1
# Like clustertests, but rebuilds all images.
clustertests-build:
docker-compose -f internal/clustertests/docker-compose.yml down
docker-compose -f internal/clustertests/docker-compose.yml up --exit-code-from=client1 --build
docker-compose -f $(DOCKER_COMPOSE) down
docker-compose -f $(DOCKER_COMPOSE) up --exit-code-from=client1 --build
# Create prerelease builds
prerelease: vendor

View file

@ -983,7 +983,7 @@ func (c *cluster) markAsJoined() {
// needTopologyAgreement is unprotected.
func (c *cluster) needTopologyAgreement() bool {
return c.state == ClusterStateStarting && !stringSlicesAreEqual(c.Topology.nodeIDs, c.nodeIDs())
return (c.state == ClusterStateStarting || c.state == ClusterStateDegraded) && !stringSlicesAreEqual(c.Topology.nodeIDs, c.nodeIDs())
}
// haveTopologyAgreement is unprotected.

View file

@ -0,0 +1,58 @@
version: '2'
services:
pilosa1:
build:
context: ../..
dockerfile: Dockerfile-clustertests
image: ptest
ports:
- "33455:10101"
environment:
- PILOSA_CLUSTER_COORDINATOR=true
- PILOSA_GOSSIP_SEEDS=pilosa1:14000
- PILOSA_CLUSTER_REPLICAS=2
networks:
- pilosanet
command:
- "/pilosa server --bind pilosa1:10101"
pilosa2:
build:
context: ../..
dockerfile: Dockerfile-clustertests
image: ptest
ports:
- "33456:10101"
environment:
- PILOSA_GOSSIP_SEEDS=pilosa1:14000
- PILOSA_CLUSTER_REPLICAS=2
networks:
- pilosanet
command:
- "/pilosa server --bind pilosa2:10101"
pilosa3:
build:
context: ../..
dockerfile: Dockerfile-clustertests
image: ptest
ports:
- "33457:10101"
environment:
- PILOSA_GOSSIP_SEEDS=pilosa1:14000,pilosa2:14000
- PILOSA_CLUSTER_REPLICAS=2
networks:
- pilosanet
command:
- "/pilosa server --bind pilosa3:10101"
client1:
build:
context: .
environment:
- ENABLE_PILOSA_CLUSTER_TESTS=1
networks:
- pilosanet
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command:
- "go test -v -count=1 github.com/pilosa/pilosa/internal/clustertests"
networks:
pilosanet: