Skip to content

Make shuffling of cluster urls work in tests #133

@kjk

Description

@kjk

When setting SHUFFLE_CLUSTER_NODES to true, we get e.g. TestLoad to fail.

I start 3 server processes locally:

Started server 'C:\Users\kjk\src\ravendb-go-client\RavenDB\Server\Raven.Server.exe --ServerUrl=http://127.0.0.1:0 --ServerUrl.Tcp=tcp://127.0.0.1:38881 --RunInMemory=true --License.Eula.Accepted=true --Setup.Mode=None --Testing.ParentProcessId=21296' on port 'http://127.0.0.1:8048' pid: 19484
Started server 'C:\Users\kjk\src\ravendb-go-client\RavenDB\Server\Raven.Server.exe --ServerUrl=http://127.0.0.1:0 --ServerUrl.Tcp=tcp://127.0.0.1:38882 --RunInMemory=true --License.Eula.Accepted=true --Setup.Mode=None --Testing.ParentProcessId=21296' on port 'http://127.0.0.1:8051' pid: 19780
Started server 'C:\Users\kjk\src\ravendb-go-client\RavenDB\Server\Raven.Server.exe --ServerUrl=http://127.0.0.1:0 --ServerUrl.Tcp=tcp://127.0.0.1:38883 --RunInMemory=true --License.Eula.Accepted=true --Setup.Mode=None --Testing.ParentProcessId=21296' on port 'http://127.0.0.1:8053' pid: 20096

I create a cluster by adding 2nd and 3rd server via /admin/cluster/node as per https://ravendb.net/docs/article-page/4.1/csharp/server/clustering/cluster-api#bootstrap-cluster

PUT http://127.0.0.1:8048/admin/cluster/node?url=http%3A%2F%2F127.0.0.1%3A8051
Added node to cluster with 'http://127.0.0.1:8048/admin/cluster/node?url=http%3A%2F%2F127.0.0.1%3A8051', status code: 204
PUT http://127.0.0.1:8048/admin/cluster/node?url=http%3A%2F%2F127.0.0.1%3A8053
Added node to cluster with 'http://127.0.0.1:8048/admin/cluster/node?url=http%3A%2F%2F127.0.0.1%3A8053', status code: 204

Not sure if that's enough. What is /admin/cluster/bootstrap ? Do I need to wait for raft consensu to emerge before executing things against the cluster?

I then create a database, with replication factor 1 always on the first node, which should be the leader.

PUT http://127.0.0.1:8048/admin/databases?name=test_db_1&replicationFactor=1

Should I bump replication factor?

But when I shuffle urls for the new store / database, when I try to get topology for the database, it fails if executed against a server different than the first:

GET http://127.0.0.1:8053/topology?name=test_db_1
=========== 4:
GET /topology?name=test_db_1 HTTP/1.1
Host: 127.0.0.1:8053
Client-Configuration-Etag: "0"
Raven-Client-Version: 4.0.0
Topology-Etag: "0"
User-Agent: ravendb-go-client/4.0.0

--------
HTTP/1.1 503 Service Unavailable
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
Database-Missing: test_db_1
Date: Wed, 20 Feb 2019 23:25:49 GMT
Raven-Server-Version: 4.1.5.41
Server: Kestrel
Vary: Accept-Encoding

Response body 60 bytes:
{
  "Message": "Database test_db_1 wasn't found",
  "Type": "Error"
}

At which point I don't know:

  • should this work and my cluster setup is incorrect? Do I need to wait somehow for "create database" command to finish replicating?
  • is the problem that the code should then pick a different server and re-issue the command?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions