[ADDED] JetStream: peer (the hash of server name) in statsz/jsz

A request to `$SYS.REQ.SERVER.PING.JSZ` would now return something
like this:
```
...
    "meta_cluster": {
      "name": "local",
      "leader": "A",
      "peer": "NUmM6cRx",
      "replicas": [
        {
          "name": "B",
          "current": true,
          "active": 690369000,
          "peer": "b2oh2L6w"
        },
        {
          "name": "Server name unknown at this time (peerID: jZ6RvVRH)",
          "current": false,
          "offline": true,
          "active": 0,
          "peer": "jZ6RvVRH"
        }
      ],
      "cluster_size": 3
    }
```
Note the "peer" field following the "leader" field that contains
the server name. The new field is the node ID, which is a hash of
the server name.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
This commit is contained in:
Ivan Kozlovic
2022-09-16 11:18:58 -06:00
parent 09cdec793d
commit 170ff49837
15 changed files with 118 additions and 41 deletions

View File

@@ -2770,9 +2770,9 @@ func TestJetStreamSuperClusterMoveCancel(t *testing.T) {
}
expectedPeers := map[string]struct{}{
string(getHash(streamPeerSrv[0])): {},
string(getHash(streamPeerSrv[1])): {},
string(getHash(streamPeerSrv[2])): {},
getHash(streamPeerSrv[0]): {},
getHash(streamPeerSrv[1]): {},
getHash(streamPeerSrv[2]): {},
}
_, err = js.AddConsumer("TEST", &nats.ConsumerConfig{Durable: "DUR", AckPolicy: nats.AckExplicitPolicy})
@@ -2981,7 +2981,7 @@ func TestJetStreamSuperClusterDoubleStreamMove(t *testing.T) {
}
// test list order invariant
js, cc := s.getJetStreamCluster()
sExpHash := string(getHash(sExpected))
sExpHash := getHash(sExpected)
js.mu.Lock()
if sa, ok := cc.streams["$G"]["TEST"]; !ok {
js.mu.Unlock()