@mark1russell7/machines 0.3.14 → 0.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -1
- package/build/index.d.ts +41 -0
- package/build/index.js +593 -2
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,8 +50,10 @@ The algebra reads these documents. It gives the closed form of each timer, the f
|
|
|
50
50
|
| `SUPAVISOR_SERVER` | `supavisor-server` | Supavisor 2.9.13 in transaction mode: one server connection of the pool of a tenant | proxy | 10 implemented, 1 observed |
|
|
51
51
|
| `AMQPLIB` | `amqplib` | amqplib 2.2.0: one connection to an AMQP 0-9-1 broker, its heartbeat and an RPC of its channel | driver | 18 implemented, 1 documented |
|
|
52
52
|
| `RABBITMQ_CONNECTION` | `rabbitmq-connection` | RabbitMQ 4.3.6: one connection of AMQP 0-9-1 on the broker | server | 14 implemented, 1 documented |
|
|
53
|
+
| `ATEN_DETECTOR` | `aten` | aten 0.6.0: one node that the failure detector of another node of RabbitMQ watches | server | 7 implemented |
|
|
54
|
+
| `RA_MEMBER` | `ra-member` | ra 3.1.10: one member of the Raft cluster of a quorum queue of RabbitMQ 4.3.6 | server | 25 implemented |
|
|
53
55
|
|
|
54
|
-
Twenty-one documents operate on Linux TCP (`over`). Linux TCP, conntrack, the Sentinel
|
|
56
|
+
Twenty-one documents operate on Linux TCP (`over`). Linux TCP, conntrack, the Sentinel, the replication of mongod, aten and the member of Ra operate on no other document. The `conditions` of each document give the range where it holds, for example a range of kernels.
|
|
55
57
|
|
|
56
58
|
The package also gives these parts:
|
|
57
59
|
|
|
@@ -97,6 +99,12 @@ A change to the version of a system changes its sources too. Each fact of the do
|
|
|
97
99
|
|
|
98
100
|
In this repository, a snapshot of the predictions of the cells (`packages/cells/src/__snapshots__/predictions.json`) shows each prediction that a change to a document moves.
|
|
99
101
|
|
|
102
|
+
### 0.3.15
|
|
103
|
+
|
|
104
|
+
- **The cluster of a quorum queue of RabbitMQ 4.3.6.** Two new documents, each from the source in the release of RabbitMQ:
|
|
105
|
+
- `aten`: the failure detector between the nodes, aten 0.6.0. Each node sends a heartbeat to each other node each 100 ms. The detector polls each 5 s in RabbitMQ (1 s at the defaults of aten). It reports a node down when the time since its last heartbeat is 1.5 times its gaps. Thus a silent node is down 150 ms to approximately 5.2 s after its last heartbeat.
|
|
106
|
+
- `ra-member`: one member of the Raft cluster of a quorum queue, ra 3.1.10. When aten reports the node of the leader down, a follower waits 5 s to 6 s, and then it asks for pre-votes. A majority makes a candidate, and the votes of a majority make the leader. A leader ignores aten, thus it stays the leader in a minority and commits nothing.
|
|
107
|
+
|
|
100
108
|
### 0.3.14
|
|
101
109
|
|
|
102
110
|
- **amqplib 2.2.0 and RabbitMQ 4.3.6.** Two new documents, each from the source at its tag:
|
package/build/index.d.ts
CHANGED
|
@@ -355,6 +355,47 @@ export declare const PROCEDURES_WS_SERVER: Machine;
|
|
|
355
355
|
*/
|
|
356
356
|
export declare const AMQPLIB: Machine;
|
|
357
357
|
//#endregion
|
|
358
|
+
//#region src/rabbit/aten.d.ts
|
|
359
|
+
/**
|
|
360
|
+
* This document is aten 0.6.0, the failure detector between the nodes of RabbitMQ 4.3.6. It gives one
|
|
361
|
+
* node that another node watches: up or down, as the detector of the watching node sees it.
|
|
362
|
+
*
|
|
363
|
+
* Each node sends a heartbeat to each connected node each 100 ms. The sink of the watching node keeps
|
|
364
|
+
* the gaps between the heartbeats of each node. Its detector polls each 5000 ms: aten polls each 1000 ms
|
|
365
|
+
* by its own default, and RabbitMQ sets 5000 ms, for fewer false elections.
|
|
366
|
+
*
|
|
367
|
+
* At a poll, the probability of a failure is a share of the gaps. A gap counts when 1.5 times the gap
|
|
368
|
+
* is not longer than the time since the last heartbeat. The node is down when that share reaches 0.99.
|
|
369
|
+
* With gaps of approximately 100 ms, that is approximately 150 ms after the last heartbeat, at the first
|
|
370
|
+
* poll after it. Thus a silent node is down 150 ms to approximately 5.2 s after its last heartbeat,
|
|
371
|
+
* long before the tick of the distribution.
|
|
372
|
+
*
|
|
373
|
+
* A closed connection of the distribution (a stopped node) removes the data of the node from the
|
|
374
|
+
* sink. The next poll then reports the node down.
|
|
375
|
+
*/
|
|
376
|
+
export declare const ATEN_DETECTOR: Machine;
|
|
377
|
+
//#endregion
|
|
378
|
+
//#region src/rabbit/ra-member.d.ts
|
|
379
|
+
/**
|
|
380
|
+
* This document is ra 3.1.10, for one member of the Raft cluster of a quorum queue of RabbitMQ 4.3.6.
|
|
381
|
+
* It gives the roles of the member, the election timers, and the change of leader.
|
|
382
|
+
*
|
|
383
|
+
* A follower watches the node of its leader with aten. When aten reports that node down, the follower
|
|
384
|
+
* arms a long election timeout. The timeout is the poll interval of aten, 5 s in RabbitMQ, and a random
|
|
385
|
+
* part up to 1 s. A valid message of the leader cancels it. When the timeout fires, the follower asks for pre-votes in
|
|
386
|
+
* its term.
|
|
387
|
+
*
|
|
388
|
+
* A member grants a pre-vote when the log of the candidate is not behind its own. A member that is
|
|
389
|
+
* still a follower of a live leader grants it too. A majority of pre-votes makes a candidate. The
|
|
390
|
+
* candidate starts a new term and asks for votes, and a majority makes it the leader. The new leader
|
|
391
|
+
* of the queue tells each publisher of the queue. Then the channel of each publisher sends its pending
|
|
392
|
+
* publishes again to the new leader.
|
|
393
|
+
*
|
|
394
|
+
* A leader ignores the events of aten. Thus a leader that loses the majority stays the leader in its
|
|
395
|
+
* minority, and it commits nothing, until it sees a higher term.
|
|
396
|
+
*/
|
|
397
|
+
export declare const RA_MEMBER: Machine;
|
|
398
|
+
//#endregion
|
|
358
399
|
//#region src/rabbit/rabbitmq-connection.d.ts
|
|
359
400
|
/**
|
|
360
401
|
* This document is RabbitMQ 4.3.6, for one connection of AMQP 0-9-1 on the broker. It gives the reader of
|
package/build/index.js
CHANGED
|
@@ -11489,6 +11489,595 @@ const AMQPLIB = machineSchema.parse({
|
|
|
11489
11489
|
}
|
|
11490
11490
|
});
|
|
11491
11491
|
//#endregion
|
|
11492
|
+
//#region src/rabbit/aten.ts
|
|
11493
|
+
const ATEN = "aten 0.6.0";
|
|
11494
|
+
/**
|
|
11495
|
+
* This document is aten 0.6.0, the failure detector between the nodes of RabbitMQ 4.3.6. It gives one
|
|
11496
|
+
* node that another node watches: up or down, as the detector of the watching node sees it.
|
|
11497
|
+
*
|
|
11498
|
+
* Each node sends a heartbeat to each connected node each 100 ms. The sink of the watching node keeps
|
|
11499
|
+
* the gaps between the heartbeats of each node. Its detector polls each 5000 ms: aten polls each 1000 ms
|
|
11500
|
+
* by its own default, and RabbitMQ sets 5000 ms, for fewer false elections.
|
|
11501
|
+
*
|
|
11502
|
+
* At a poll, the probability of a failure is a share of the gaps. A gap counts when 1.5 times the gap
|
|
11503
|
+
* is not longer than the time since the last heartbeat. The node is down when that share reaches 0.99.
|
|
11504
|
+
* With gaps of approximately 100 ms, that is approximately 150 ms after the last heartbeat, at the first
|
|
11505
|
+
* poll after it. Thus a silent node is down 150 ms to approximately 5.2 s after its last heartbeat,
|
|
11506
|
+
* long before the tick of the distribution.
|
|
11507
|
+
*
|
|
11508
|
+
* A closed connection of the distribution (a stopped node) removes the data of the node from the
|
|
11509
|
+
* sink. The next poll then reports the node down.
|
|
11510
|
+
*/
|
|
11511
|
+
const ATEN_DETECTOR = machineSchema.parse({
|
|
11512
|
+
format: "mark1russell7.machine/1",
|
|
11513
|
+
id: "aten",
|
|
11514
|
+
title: "aten 0.6.0: one node that the failure detector of another node of RabbitMQ watches, up or down",
|
|
11515
|
+
layer: "server",
|
|
11516
|
+
version: "0.6.0",
|
|
11517
|
+
conditions: {
|
|
11518
|
+
aten: "0.6.0",
|
|
11519
|
+
ra: "3.1.10",
|
|
11520
|
+
rabbitmq: "4.3.6",
|
|
11521
|
+
nodes: "two nodes of one cluster, connected by the Erlang distribution"
|
|
11522
|
+
},
|
|
11523
|
+
sources: [
|
|
11524
|
+
{
|
|
11525
|
+
ref: `${ATEN} src/aten.app.src: the defaults poll_interval 1000, scaling_factor 1.5, heartbeat_interval 100, detection_threshold 0.99`,
|
|
11526
|
+
rung: "implemented"
|
|
11527
|
+
},
|
|
11528
|
+
{
|
|
11529
|
+
ref: "rabbitmq v4.3.6 deps/rabbitmq_prelaunch/src/rabbit_prelaunch_conf.erl:112-120 RabbitMQ sets the poll interval of aten to 5000 ms, for fewer false elections of quorum queues",
|
|
11530
|
+
rung: "implemented"
|
|
11531
|
+
},
|
|
11532
|
+
{
|
|
11533
|
+
ref: "run 39218896659 of github.com/mark1russell7/systems: after a freeze and a black hole of the node of the leader, the new leader came 6.1 s to 10.4 s later, and not 1 s to 4 s",
|
|
11534
|
+
rung: "observed"
|
|
11535
|
+
},
|
|
11536
|
+
{
|
|
11537
|
+
ref: `${ATEN} src/aten_emitter.erl:49-54 and :95-98 the emitter arms its next send heartbeat_interval after it sends to each node, :63-82 it sends to each node in nodes() with noconnect and nosuspend`,
|
|
11538
|
+
rung: "implemented"
|
|
11539
|
+
},
|
|
11540
|
+
{
|
|
11541
|
+
ref: `${ATEN} src/aten_sink.erl:69-79 a heartbeat adds a sample to the state of its node, :81-87 nodedown removes the state of the node`,
|
|
11542
|
+
rung: "implemented"
|
|
11543
|
+
},
|
|
11544
|
+
{
|
|
11545
|
+
ref: `${ATEN} src/aten_detect.erl:17 a window of 1000 samples, :44-52 a sample is the gap since the heartbeat before it, :54-68 the probability is the share of the gaps S with S × factor ≤ the time since the last heartbeat`,
|
|
11546
|
+
rung: "implemented"
|
|
11547
|
+
},
|
|
11548
|
+
{
|
|
11549
|
+
ref: `${ATEN} src/aten_detector.erl:53-59 the threshold and the poll interval, :105-113 each poll arms the next poll first, then reads the probabilities, :148-186 a node goes down when its probability crosses the threshold between two polls, or when it leaves the sink`,
|
|
11550
|
+
rung: "implemented"
|
|
11551
|
+
},
|
|
11552
|
+
{
|
|
11553
|
+
ref: `${ATEN} src/aten_detector.erl:134-146 the detector sends {node_event, Node, down} or up to each process that watches the node`,
|
|
11554
|
+
rung: "implemented"
|
|
11555
|
+
},
|
|
11556
|
+
{
|
|
11557
|
+
ref: "rabbitmq v4.3.6 deps/rabbit/priv/schema/rabbit.schema:2540-2589 raft.adaptive_failure_detector.poll_interval, scaling_factor, heartbeat_interval and detection_threshold map to aten",
|
|
11558
|
+
rung: "implemented"
|
|
11559
|
+
}
|
|
11560
|
+
],
|
|
11561
|
+
states: {
|
|
11562
|
+
up: {
|
|
11563
|
+
initial: true,
|
|
11564
|
+
note: "the probability of the node is below the threshold at the last poll"
|
|
11565
|
+
},
|
|
11566
|
+
down: { note: "{node_event, Node, down}: the probability crossed the threshold, or the node left the sink" }
|
|
11567
|
+
},
|
|
11568
|
+
events: {
|
|
11569
|
+
"rx.heartbeat": {
|
|
11570
|
+
kind: "rx",
|
|
11571
|
+
note: "a heartbeat of the node reaches the sink of the watching node"
|
|
11572
|
+
},
|
|
11573
|
+
"rx.nodedown": {
|
|
11574
|
+
kind: "rx",
|
|
11575
|
+
note: "the connection of the distribution to the node closed: the sink removes the node"
|
|
11576
|
+
},
|
|
11577
|
+
"timer.detect": {
|
|
11578
|
+
kind: "timer",
|
|
11579
|
+
note: "the first poll at which the share of the gaps reaches the threshold"
|
|
11580
|
+
},
|
|
11581
|
+
"timer.left": {
|
|
11582
|
+
kind: "timer",
|
|
11583
|
+
note: "the first poll after the node left the sink"
|
|
11584
|
+
}
|
|
11585
|
+
},
|
|
11586
|
+
knobs: {
|
|
11587
|
+
heartbeat_interval: {
|
|
11588
|
+
key: "raft.adaptive_failure_detector.heartbeat_interval (aten heartbeat_interval)",
|
|
11589
|
+
scope: "node",
|
|
11590
|
+
unit: "ms",
|
|
11591
|
+
default: 100,
|
|
11592
|
+
note: "aten.app.src"
|
|
11593
|
+
},
|
|
11594
|
+
poll_interval: {
|
|
11595
|
+
key: "raft.adaptive_failure_detector.poll_interval (aten poll_interval)",
|
|
11596
|
+
scope: "node",
|
|
11597
|
+
unit: "ms",
|
|
11598
|
+
default: 5e3,
|
|
11599
|
+
note: "RabbitMQ sets 5000 (rabbit_prelaunch_conf.erl:112-120). The default of aten itself is 1000 (aten.app.src)"
|
|
11600
|
+
},
|
|
11601
|
+
scaling_factor: {
|
|
11602
|
+
key: "raft.adaptive_failure_detector.scaling_factor (aten scaling_factor)",
|
|
11603
|
+
scope: "node",
|
|
11604
|
+
unit: "count",
|
|
11605
|
+
default: 1.5,
|
|
11606
|
+
note: "aten.app.src"
|
|
11607
|
+
},
|
|
11608
|
+
detection_threshold: {
|
|
11609
|
+
key: "raft.adaptive_failure_detector.detection_threshold (aten detection_threshold)",
|
|
11610
|
+
scope: "node",
|
|
11611
|
+
unit: "count",
|
|
11612
|
+
default: .99,
|
|
11613
|
+
note: "aten.app.src: the share of the gaps that the time since the last heartbeat must reach"
|
|
11614
|
+
},
|
|
11615
|
+
gap_slack: {
|
|
11616
|
+
key: "how much longer than heartbeat_interval the 99th percentile gap is",
|
|
11617
|
+
scope: "node",
|
|
11618
|
+
unit: "ms",
|
|
11619
|
+
default: 10,
|
|
11620
|
+
note: "an assumption of this document, not a value of aten: the emitter arms its next send after its sends (aten_emitter.erl:95-98), and the BEAM schedules it a little late"
|
|
11621
|
+
},
|
|
11622
|
+
slack: {
|
|
11623
|
+
key: "the lateness of a timer of the BEAM for one step",
|
|
11624
|
+
scope: "node",
|
|
11625
|
+
unit: "ms",
|
|
11626
|
+
default: 10,
|
|
11627
|
+
note: "an assumption of this document, not a value of aten: a send_after that fires late"
|
|
11628
|
+
}
|
|
11629
|
+
},
|
|
11630
|
+
timers: {
|
|
11631
|
+
detect: {
|
|
11632
|
+
duration: {
|
|
11633
|
+
expr: "scaling_factor * heartbeat_interval",
|
|
11634
|
+
unit: "ms"
|
|
11635
|
+
},
|
|
11636
|
+
lateness: {
|
|
11637
|
+
expr: "scaling_factor * gap_slack + poll_interval + slack",
|
|
11638
|
+
unit: "ms"
|
|
11639
|
+
},
|
|
11640
|
+
arms: ["rx.heartbeat"],
|
|
11641
|
+
fires: "timer.detect",
|
|
11642
|
+
note: "150 ms after the last heartbeat at the defaults, and up to one poll of 5 s later"
|
|
11643
|
+
},
|
|
11644
|
+
nodedown_poll: {
|
|
11645
|
+
duration: {
|
|
11646
|
+
const: 0,
|
|
11647
|
+
unit: "ms"
|
|
11648
|
+
},
|
|
11649
|
+
lateness: {
|
|
11650
|
+
expr: "poll_interval + slack",
|
|
11651
|
+
unit: "ms"
|
|
11652
|
+
},
|
|
11653
|
+
arms: ["rx.nodedown"],
|
|
11654
|
+
fires: "timer.left"
|
|
11655
|
+
}
|
|
11656
|
+
},
|
|
11657
|
+
realizes: {
|
|
11658
|
+
"systems.mechanism.heartbeat-detection-time": { timer: "detect" },
|
|
11659
|
+
"systems.mechanism.heartbeat-interval": {
|
|
11660
|
+
duration: {
|
|
11661
|
+
knob: "heartbeat_interval",
|
|
11662
|
+
unit: "ms"
|
|
11663
|
+
},
|
|
11664
|
+
lateness: {
|
|
11665
|
+
knob: "gap_slack",
|
|
11666
|
+
unit: "ms"
|
|
11667
|
+
},
|
|
11668
|
+
note: "each node sends a heartbeat to each connected node at this interval (aten_emitter.erl:95-98)"
|
|
11669
|
+
}
|
|
11670
|
+
},
|
|
11671
|
+
transitions: [
|
|
11672
|
+
{
|
|
11673
|
+
id: "aten.heartbeat",
|
|
11674
|
+
from: "up",
|
|
11675
|
+
to: "up",
|
|
11676
|
+
on: "rx.heartbeat",
|
|
11677
|
+
note: "a new sample of the gap",
|
|
11678
|
+
source: "aten_sink.erl:69-79"
|
|
11679
|
+
},
|
|
11680
|
+
{
|
|
11681
|
+
id: "aten.down",
|
|
11682
|
+
from: "up",
|
|
11683
|
+
to: "down",
|
|
11684
|
+
on: "timer.detect",
|
|
11685
|
+
timer: "detect",
|
|
11686
|
+
emits: ["node_event down"],
|
|
11687
|
+
source: "aten_detector.erl:148-186"
|
|
11688
|
+
},
|
|
11689
|
+
{
|
|
11690
|
+
id: "aten.left",
|
|
11691
|
+
from: "up",
|
|
11692
|
+
to: "down",
|
|
11693
|
+
on: "timer.left",
|
|
11694
|
+
timer: "nodedown_poll",
|
|
11695
|
+
emits: ["node_event down"],
|
|
11696
|
+
source: "aten_detector.erl:159-175"
|
|
11697
|
+
},
|
|
11698
|
+
{
|
|
11699
|
+
id: "aten.up",
|
|
11700
|
+
from: "down",
|
|
11701
|
+
to: "up",
|
|
11702
|
+
on: "rx.heartbeat",
|
|
11703
|
+
emits: ["node_event up"],
|
|
11704
|
+
note: "at the next poll the share is below the threshold again",
|
|
11705
|
+
source: "aten_detector.erl:153-155"
|
|
11706
|
+
}
|
|
11707
|
+
]
|
|
11708
|
+
});
|
|
11709
|
+
//#endregion
|
|
11710
|
+
//#region src/rabbit/ra-member.ts
|
|
11711
|
+
const RA = "ra 3.1.10 src";
|
|
11712
|
+
const RMQ$1 = "rabbitmq v4.3.6 deps/rabbit/src";
|
|
11713
|
+
/**
|
|
11714
|
+
* This document is ra 3.1.10, for one member of the Raft cluster of a quorum queue of RabbitMQ 4.3.6.
|
|
11715
|
+
* It gives the roles of the member, the election timers, and the change of leader.
|
|
11716
|
+
*
|
|
11717
|
+
* A follower watches the node of its leader with aten. When aten reports that node down, the follower
|
|
11718
|
+
* arms a long election timeout. The timeout is the poll interval of aten, 5 s in RabbitMQ, and a random
|
|
11719
|
+
* part up to 1 s. A valid message of the leader cancels it. When the timeout fires, the follower asks for pre-votes in
|
|
11720
|
+
* its term.
|
|
11721
|
+
*
|
|
11722
|
+
* A member grants a pre-vote when the log of the candidate is not behind its own. A member that is
|
|
11723
|
+
* still a follower of a live leader grants it too. A majority of pre-votes makes a candidate. The
|
|
11724
|
+
* candidate starts a new term and asks for votes, and a majority makes it the leader. The new leader
|
|
11725
|
+
* of the queue tells each publisher of the queue. Then the channel of each publisher sends its pending
|
|
11726
|
+
* publishes again to the new leader.
|
|
11727
|
+
*
|
|
11728
|
+
* A leader ignores the events of aten. Thus a leader that loses the majority stays the leader in its
|
|
11729
|
+
* minority, and it commits nothing, until it sees a higher term.
|
|
11730
|
+
*/
|
|
11731
|
+
const RA_MEMBER = machineSchema.parse({
|
|
11732
|
+
format: "mark1russell7.machine/1",
|
|
11733
|
+
id: "ra-member",
|
|
11734
|
+
title: "ra 3.1.10: one member of the Raft cluster of a quorum queue of RabbitMQ 4.3.6, its elections and its leader",
|
|
11735
|
+
layer: "server",
|
|
11736
|
+
version: "3.1.10",
|
|
11737
|
+
conditions: {
|
|
11738
|
+
ra: "3.1.10",
|
|
11739
|
+
aten: "0.6.0",
|
|
11740
|
+
rabbitmq: "4.3.6",
|
|
11741
|
+
queue: "a quorum queue of three members, one on each node of the cluster, each one a voter"
|
|
11742
|
+
},
|
|
11743
|
+
sources: [
|
|
11744
|
+
{
|
|
11745
|
+
ref: "rabbitmq v4.3.6 rabbitmq-components.mk:58 dep_ra = hex 3.1.10",
|
|
11746
|
+
rung: "implemented"
|
|
11747
|
+
},
|
|
11748
|
+
{
|
|
11749
|
+
ref: `${RA}/ra_server_proc.erl:66-68 DEFAULT_BROADCAST_TIME 100, DEFAULT_ELECTION_MULT 5, TICK_INTERVAL_MS 1000`,
|
|
11750
|
+
rung: "implemented"
|
|
11751
|
+
},
|
|
11752
|
+
{
|
|
11753
|
+
ref: `${RA}/ra_server_proc.erl:384 the member reads the poll interval of aten: 1000 ms by default, and 5000 ms in RabbitMQ (rabbit_prelaunch_conf.erl:112-120)`,
|
|
11754
|
+
rung: "implemented"
|
|
11755
|
+
},
|
|
11756
|
+
{
|
|
11757
|
+
ref: `${RA}/ra_server_proc.erl:1931-1950 the election timeouts: really_short rand(broadcast), short rand(5 × broadcast) + broadcast, medium rand(poll) + broadcast, long rand(10 × broadcast) + poll`,
|
|
11758
|
+
rung: "implemented"
|
|
11759
|
+
},
|
|
11760
|
+
{
|
|
11761
|
+
ref: `${RA}/ra_server_proc.erl:2350-2357 an election timeout that is set is not set again, and :2359-2367 each change of role cancels it`,
|
|
11762
|
+
rung: "implemented"
|
|
11763
|
+
},
|
|
11764
|
+
{
|
|
11765
|
+
ref: `${RA}/ra_server_proc.erl:802-825 a follower that is not new arms a long timeout when it enters the role`,
|
|
11766
|
+
rung: "implemented"
|
|
11767
|
+
},
|
|
11768
|
+
{
|
|
11769
|
+
ref: `${RA}/ra_server_proc.erl:1844-1851 a valid message of the leader cancels the election timeout of a follower`,
|
|
11770
|
+
rung: "implemented"
|
|
11771
|
+
},
|
|
11772
|
+
{
|
|
11773
|
+
ref: `${RA}/ra_server_proc.erl:899-919 aten reports the node of the leader down: a long timeout; up again: the timeout stops`,
|
|
11774
|
+
rung: "implemented"
|
|
11775
|
+
},
|
|
11776
|
+
{
|
|
11777
|
+
ref: `${RA}/ra_server_proc.erl:869-896 the monitor of the leader goes down: short for noconnection, really_short for each other reason`,
|
|
11778
|
+
rung: "implemented"
|
|
11779
|
+
},
|
|
11780
|
+
{
|
|
11781
|
+
ref: `${RA}/ra_server_proc.erl:1958-1981 a follower watches the node of a new leader with aten, and logs the new leader`,
|
|
11782
|
+
rung: "implemented"
|
|
11783
|
+
},
|
|
11784
|
+
{
|
|
11785
|
+
ref: `${RA}/ra_server.erl:1625-1626 the election timeout of a follower asks for pre-votes, and :2900-2923 a pre-vote round is in the current term`,
|
|
11786
|
+
rung: "implemented"
|
|
11787
|
+
},
|
|
11788
|
+
{
|
|
11789
|
+
ref: `${RA}/ra_server_proc.erl:739-743 a member in pre-vote arms a long timeout, and ra_server.erl:1255-1256 its timeout asks again`,
|
|
11790
|
+
rung: "implemented"
|
|
11791
|
+
},
|
|
11792
|
+
{
|
|
11793
|
+
ref: `${RA}/ra_server.erl:2925-2985 a member grants a pre-vote when the term is not lower and the log of the candidate is not behind; a follower that declines arms its own long timeout`,
|
|
11794
|
+
rung: "implemented"
|
|
11795
|
+
},
|
|
11796
|
+
{
|
|
11797
|
+
ref: `${RA}/ra_server.erl:1229-1245 a majority of pre-votes makes a candidate, and :2880-2899 the candidate starts a new term and asks for votes`,
|
|
11798
|
+
rung: "implemented"
|
|
11799
|
+
},
|
|
11800
|
+
{
|
|
11801
|
+
ref: `${RA}/ra_server_proc.erl:674-677 a candidate arms a short timeout, and ra_server.erl:1161-1162 its timeout starts a new election`,
|
|
11802
|
+
rung: "implemented"
|
|
11803
|
+
},
|
|
11804
|
+
{
|
|
11805
|
+
ref: `${RA}/ra_server.erl:1045-1061 a majority of votes makes the leader`,
|
|
11806
|
+
rung: "implemented"
|
|
11807
|
+
},
|
|
11808
|
+
{
|
|
11809
|
+
ref: `${RA}/ra_server_proc.erl:1742-1755 each vote request is a call with the poll interval of aten as its timeout`,
|
|
11810
|
+
rung: "implemented"
|
|
11811
|
+
},
|
|
11812
|
+
{
|
|
11813
|
+
ref: `${RA}/ra_server_proc.erl:597-598 a leader ignores the events of aten`,
|
|
11814
|
+
rung: "implemented"
|
|
11815
|
+
},
|
|
11816
|
+
{
|
|
11817
|
+
ref: `${RA}/ra_server.erl:928-942 and :946-960 a leader that sees a vote request or a pre-vote request of a higher term becomes a follower`,
|
|
11818
|
+
rung: "implemented"
|
|
11819
|
+
},
|
|
11820
|
+
{
|
|
11821
|
+
ref: `${RA}/ra_server.erl:1008-1032 a transfer of leadership: the leader waits, and it sends an election timeout to the member that gets the leadership`,
|
|
11822
|
+
rung: "implemented"
|
|
11823
|
+
},
|
|
11824
|
+
{
|
|
11825
|
+
ref: `${RA}/ra_server_proc.erl:683-687 and :749-753 a candidate and a member in pre-vote reject a command`,
|
|
11826
|
+
rung: "implemented"
|
|
11827
|
+
},
|
|
11828
|
+
{
|
|
11829
|
+
ref: `${RA}/ra_server_proc.erl:1336-1345 each change from or to leader is a NOTICE in the log, and each other change is DEBUG`,
|
|
11830
|
+
rung: "implemented"
|
|
11831
|
+
},
|
|
11832
|
+
{
|
|
11833
|
+
ref: `${RMQ$1}/rabbit_fifo.erl:1111-1123 a new leader of the queue sends leader_change to each publisher`,
|
|
11834
|
+
rung: "implemented"
|
|
11835
|
+
},
|
|
11836
|
+
{
|
|
11837
|
+
ref: `${RMQ$1}/rabbit_fifo_client.erl:738-760 the channel sends each pending publish again to the new leader, on leader_change or on a rejection`,
|
|
11838
|
+
rung: "implemented"
|
|
11839
|
+
},
|
|
11840
|
+
{
|
|
11841
|
+
ref: `${RMQ$1}/rabbit_quorum_queue.erl:175 and :2427-2441 the tick of a member is quorum_tick_interval, 5000 ms; RabbitMQ sets no broadcast time`,
|
|
11842
|
+
rung: "implemented"
|
|
11843
|
+
}
|
|
11844
|
+
],
|
|
11845
|
+
states: {
|
|
11846
|
+
follower: {
|
|
11847
|
+
initial: true,
|
|
11848
|
+
note: "it follows the leader, and its election timeout runs when no valid message of the leader cancels it"
|
|
11849
|
+
},
|
|
11850
|
+
pre_vote: { note: "it asks for pre-votes in its term, and it rejects each command" },
|
|
11851
|
+
candidate: { note: "a new term, its vote for itself, and a vote request to each member. A round with no majority before the timeout starts a new election after a medium timeout (101 ms to 1.1 s)" },
|
|
11852
|
+
leader: { note: "it commits with a majority. It ignores aten: without a majority it stays the leader and commits nothing" }
|
|
11853
|
+
},
|
|
11854
|
+
events: {
|
|
11855
|
+
"local.leader-node-down": {
|
|
11856
|
+
kind: "local",
|
|
11857
|
+
note: "{node_event, Node, down}: aten reports the node of the leader down"
|
|
11858
|
+
},
|
|
11859
|
+
"local.leader-node-up": {
|
|
11860
|
+
kind: "local",
|
|
11861
|
+
note: "{node_event, Node, up}: aten reports the node of the leader up again"
|
|
11862
|
+
},
|
|
11863
|
+
"rx.leader-noconnection": {
|
|
11864
|
+
kind: "rx",
|
|
11865
|
+
note: "the monitor of the leader goes down with noconnection: the distribution to its node closed"
|
|
11866
|
+
},
|
|
11867
|
+
"rx.leader-exit": {
|
|
11868
|
+
kind: "rx",
|
|
11869
|
+
note: "the monitor of the leader goes down with another reason: the process of the leader is gone"
|
|
11870
|
+
},
|
|
11871
|
+
"rx.leader-message": {
|
|
11872
|
+
kind: "rx",
|
|
11873
|
+
note: "a valid append_entries or heartbeat of the leader (record_leader_msg)"
|
|
11874
|
+
},
|
|
11875
|
+
"timer.election": {
|
|
11876
|
+
kind: "timer",
|
|
11877
|
+
note: "the state timeout election_timeout"
|
|
11878
|
+
},
|
|
11879
|
+
"rx.pre-votes": {
|
|
11880
|
+
kind: "rx",
|
|
11881
|
+
note: "a majority of granted pre-votes, its own one too"
|
|
11882
|
+
},
|
|
11883
|
+
"rx.pre-vote-declined": {
|
|
11884
|
+
kind: "rx",
|
|
11885
|
+
note: "a pre-vote request whose candidate has a log behind this member: it declines and arms its own timeout"
|
|
11886
|
+
},
|
|
11887
|
+
"rx.votes": {
|
|
11888
|
+
kind: "rx",
|
|
11889
|
+
note: "a majority of votes, its own one too"
|
|
11890
|
+
},
|
|
11891
|
+
"rx.higher-term": {
|
|
11892
|
+
kind: "rx",
|
|
11893
|
+
note: "a message of a term that is not lower: a leader of that term, or a vote request of a higher term"
|
|
11894
|
+
},
|
|
11895
|
+
"app.transfer": {
|
|
11896
|
+
kind: "app",
|
|
11897
|
+
note: "the leader sends election_timeout to the member that gets the leadership (rabbitmq-queues transfer_leadership)"
|
|
11898
|
+
}
|
|
11899
|
+
},
|
|
11900
|
+
knobs: {
|
|
11901
|
+
broadcast_time: {
|
|
11902
|
+
key: "broadcast_time of the ra server",
|
|
11903
|
+
scope: "queue",
|
|
11904
|
+
unit: "ms",
|
|
11905
|
+
default: 100,
|
|
11906
|
+
note: "ra_server_proc.erl:66: RabbitMQ sets none"
|
|
11907
|
+
},
|
|
11908
|
+
election_mult: {
|
|
11909
|
+
key: "DEFAULT_ELECTION_MULT",
|
|
11910
|
+
scope: "build",
|
|
11911
|
+
unit: "count",
|
|
11912
|
+
default: 5,
|
|
11913
|
+
note: "ra_server_proc.erl:67"
|
|
11914
|
+
},
|
|
11915
|
+
aten_poll_interval: {
|
|
11916
|
+
key: "raft.adaptive_failure_detector.poll_interval (aten poll_interval)",
|
|
11917
|
+
scope: "node",
|
|
11918
|
+
unit: "ms",
|
|
11919
|
+
default: 5e3,
|
|
11920
|
+
note: "ra_server_proc.erl:384 reads it. RabbitMQ sets 5000 (rabbit_prelaunch_conf.erl:112-120)"
|
|
11921
|
+
},
|
|
11922
|
+
tick_timeout: {
|
|
11923
|
+
key: "quorum_tick_interval",
|
|
11924
|
+
scope: "node",
|
|
11925
|
+
unit: "ms",
|
|
11926
|
+
default: 5e3,
|
|
11927
|
+
note: "rabbit_quorum_queue.erl:175, :2435-2441"
|
|
11928
|
+
},
|
|
11929
|
+
slack: {
|
|
11930
|
+
key: "the lateness of a timer of the BEAM for one step",
|
|
11931
|
+
scope: "node",
|
|
11932
|
+
unit: "ms",
|
|
11933
|
+
default: 10,
|
|
11934
|
+
note: "an assumption of this document, not a value of ra: a state timeout that fires late"
|
|
11935
|
+
},
|
|
11936
|
+
commit_work: {
|
|
11937
|
+
key: "the local work of one command: the writes and the fsyncs of the logs of a leader and a follower, and the apply",
|
|
11938
|
+
scope: "node",
|
|
11939
|
+
unit: "ms",
|
|
11940
|
+
default: 50,
|
|
11941
|
+
note: "an assumption of this document, not a value of ra: the WAL writes each batch and syncs it with fdatasync before the commit (ra_log_wal.erl:89, :772-798)"
|
|
11942
|
+
},
|
|
11943
|
+
rtt: {
|
|
11944
|
+
key: "the round trip between members",
|
|
11945
|
+
scope: "path",
|
|
11946
|
+
unit: "ms",
|
|
11947
|
+
default: null
|
|
11948
|
+
}
|
|
11949
|
+
},
|
|
11950
|
+
timers: {
|
|
11951
|
+
election_long: {
|
|
11952
|
+
duration: {
|
|
11953
|
+
expr: "aten_poll_interval + 1",
|
|
11954
|
+
unit: "ms"
|
|
11955
|
+
},
|
|
11956
|
+
lateness: {
|
|
11957
|
+
expr: "broadcast_time * election_mult * 2 - 1 + slack",
|
|
11958
|
+
unit: "ms"
|
|
11959
|
+
},
|
|
11960
|
+
arms: [
|
|
11961
|
+
"enter:follower",
|
|
11962
|
+
"enter:pre_vote",
|
|
11963
|
+
"local.leader-node-down",
|
|
11964
|
+
"rx.pre-vote-declined"
|
|
11965
|
+
],
|
|
11966
|
+
cancels: ["rx.leader-message", "local.leader-node-up"],
|
|
11967
|
+
fires: "timer.election",
|
|
11968
|
+
note: "longer than one poll of aten, thus a false report of aten can end before an election (ra_server_proc.erl:1944-1949)"
|
|
11969
|
+
},
|
|
11970
|
+
election_short: {
|
|
11971
|
+
duration: {
|
|
11972
|
+
expr: "broadcast_time + 1",
|
|
11973
|
+
unit: "ms"
|
|
11974
|
+
},
|
|
11975
|
+
lateness: {
|
|
11976
|
+
expr: "broadcast_time * election_mult - 1 + slack",
|
|
11977
|
+
unit: "ms"
|
|
11978
|
+
},
|
|
11979
|
+
arms: ["enter:candidate", "rx.leader-noconnection"],
|
|
11980
|
+
cancels: ["rx.leader-message"],
|
|
11981
|
+
fires: "timer.election"
|
|
11982
|
+
},
|
|
11983
|
+
election_really_short: {
|
|
11984
|
+
duration: {
|
|
11985
|
+
const: 1,
|
|
11986
|
+
unit: "ms"
|
|
11987
|
+
},
|
|
11988
|
+
lateness: {
|
|
11989
|
+
expr: "broadcast_time - 1 + slack",
|
|
11990
|
+
unit: "ms"
|
|
11991
|
+
},
|
|
11992
|
+
arms: ["rx.leader-exit"],
|
|
11993
|
+
cancels: ["rx.leader-message"],
|
|
11994
|
+
fires: "timer.election"
|
|
11995
|
+
}
|
|
11996
|
+
},
|
|
11997
|
+
realizes: { "systems.mechanism.election-timeout": { timer: "election_long" } },
|
|
11998
|
+
transitions: [
|
|
11999
|
+
{
|
|
12000
|
+
id: "ra.leader-message",
|
|
12001
|
+
from: "follower",
|
|
12002
|
+
to: "follower",
|
|
12003
|
+
on: "rx.leader-message",
|
|
12004
|
+
note: "the election timeout stops",
|
|
12005
|
+
source: "ra_server_proc.erl:1844-1851"
|
|
12006
|
+
},
|
|
12007
|
+
{
|
|
12008
|
+
id: "ra.leader-node-down",
|
|
12009
|
+
from: "follower",
|
|
12010
|
+
to: "follower",
|
|
12011
|
+
on: "local.leader-node-down",
|
|
12012
|
+
note: "the long election timeout starts",
|
|
12013
|
+
source: "ra_server_proc.erl:899-908"
|
|
12014
|
+
},
|
|
12015
|
+
{
|
|
12016
|
+
id: "ra.pre-vote",
|
|
12017
|
+
from: "follower",
|
|
12018
|
+
to: "pre_vote",
|
|
12019
|
+
on: ["timer.election", "app.transfer"],
|
|
12020
|
+
source: "ra_server.erl:1625-1626, :2900-2923"
|
|
12021
|
+
},
|
|
12022
|
+
{
|
|
12023
|
+
id: "ra.pre-vote-again",
|
|
12024
|
+
from: "pre_vote",
|
|
12025
|
+
to: "pre_vote",
|
|
12026
|
+
on: "timer.election",
|
|
12027
|
+
timer: "election_long",
|
|
12028
|
+
source: "ra_server.erl:1255-1256"
|
|
12029
|
+
},
|
|
12030
|
+
{
|
|
12031
|
+
id: "ra.candidate",
|
|
12032
|
+
from: "pre_vote",
|
|
12033
|
+
to: "candidate",
|
|
12034
|
+
on: "rx.pre-votes",
|
|
12035
|
+
source: "ra_server.erl:1229-1245, :2880-2899"
|
|
12036
|
+
},
|
|
12037
|
+
{
|
|
12038
|
+
id: "ra.election-again",
|
|
12039
|
+
from: "candidate",
|
|
12040
|
+
to: "candidate",
|
|
12041
|
+
on: "timer.election",
|
|
12042
|
+
timer: "election_short",
|
|
12043
|
+
source: "ra_server.erl:1161-1162"
|
|
12044
|
+
},
|
|
12045
|
+
{
|
|
12046
|
+
id: "ra.leader",
|
|
12047
|
+
from: "candidate",
|
|
12048
|
+
to: "leader",
|
|
12049
|
+
on: "rx.votes",
|
|
12050
|
+
emits: ["candidate -> leader", "leader_change"],
|
|
12051
|
+
note: "the NOTICE of the change, and leader_change to each publisher of the queue",
|
|
12052
|
+
source: "ra_server.erl:1045-1061, ra_server_proc.erl:1336-1345, rabbit_fifo.erl:1111-1123"
|
|
12053
|
+
},
|
|
12054
|
+
{
|
|
12055
|
+
id: "ra.follow",
|
|
12056
|
+
from: ["pre_vote", "candidate"],
|
|
12057
|
+
to: "follower",
|
|
12058
|
+
on: "rx.higher-term",
|
|
12059
|
+
source: "ra_server.erl:1062-1084"
|
|
12060
|
+
},
|
|
12061
|
+
{
|
|
12062
|
+
id: "ra.abdicate",
|
|
12063
|
+
from: "leader",
|
|
12064
|
+
to: "follower",
|
|
12065
|
+
on: "rx.higher-term",
|
|
12066
|
+
emits: ["leader -> follower"],
|
|
12067
|
+
source: "ra_server.erl:928-942, :946-960"
|
|
12068
|
+
}
|
|
12069
|
+
],
|
|
12070
|
+
observe: { "rabbitmq-log": {
|
|
12071
|
+
fidelity: "lossy",
|
|
12072
|
+
states: {
|
|
12073
|
+
leader: "leader",
|
|
12074
|
+
follower: "follower"
|
|
12075
|
+
},
|
|
12076
|
+
hides: ["pre_vote", "candidate"],
|
|
12077
|
+
note: "at the default level the log has each change from or to leader (NOTICE), and the new leader that a follower detects (INFO). The elections are DEBUG"
|
|
12078
|
+
} }
|
|
12079
|
+
});
|
|
12080
|
+
//#endregion
|
|
11492
12081
|
//#region src/rabbit/rabbitmq-connection.ts
|
|
11493
12082
|
const RMQ = "v4.3.6";
|
|
11494
12083
|
/**
|
|
@@ -12512,9 +13101,11 @@ const MACHINES = byId([
|
|
|
12512
13101
|
SUPAVISOR_CLIENT,
|
|
12513
13102
|
SUPAVISOR_SERVER,
|
|
12514
13103
|
AMQPLIB,
|
|
12515
|
-
RABBITMQ_CONNECTION
|
|
13104
|
+
RABBITMQ_CONNECTION,
|
|
13105
|
+
ATEN_DETECTOR,
|
|
13106
|
+
RA_MEMBER
|
|
12516
13107
|
]);
|
|
12517
13108
|
//#endregion
|
|
12518
|
-
export { AMQPLIB, GO_TRANSPORT, HIKARICP_PGJDBC, IOREDIS_SENTINEL, IOREDIS_STATUS, LINUX_TCP, MACHINES, MANIFESTATIONS, MONGODB_NODE, MONGOD_REPL, MONGOD_SESSION, NF_CONNTRACK_TCP, NODE_HTTP_AGENT, NODE_HTTP_SERVER, NODE_POSTGRES, NODE_TIMER_EARLY, PGBOUNCER_CLIENT, PGBOUNCER_SERVER, PGPOOL_SESSION, POSTGRES_SESSION, PROCEDURES_WS_CLIENT, PROCEDURES_WS_SERVER, RABBITMQ_CONNECTION, REDIS_CLIENT, SENTINEL, SUPAVISOR_CLIENT, SUPAVISOR_SERVER, UNDICI_CLIENT, UNDICI_TICK_MS, goLateSeconds, goTimerLateness, nodeEarlySeconds, nodeLateSeconds, nodeTimerLateness, undiciFastEarly, undiciFastLateness };
|
|
13109
|
+
export { AMQPLIB, ATEN_DETECTOR, GO_TRANSPORT, HIKARICP_PGJDBC, IOREDIS_SENTINEL, IOREDIS_STATUS, LINUX_TCP, MACHINES, MANIFESTATIONS, MONGODB_NODE, MONGOD_REPL, MONGOD_SESSION, NF_CONNTRACK_TCP, NODE_HTTP_AGENT, NODE_HTTP_SERVER, NODE_POSTGRES, NODE_TIMER_EARLY, PGBOUNCER_CLIENT, PGBOUNCER_SERVER, PGPOOL_SESSION, POSTGRES_SESSION, PROCEDURES_WS_CLIENT, PROCEDURES_WS_SERVER, RABBITMQ_CONNECTION, RA_MEMBER, REDIS_CLIENT, SENTINEL, SUPAVISOR_CLIENT, SUPAVISOR_SERVER, UNDICI_CLIENT, UNDICI_TICK_MS, goLateSeconds, goTimerLateness, nodeEarlySeconds, nodeLateSeconds, nodeTimerLateness, undiciFastEarly, undiciFastLateness };
|
|
12519
13110
|
|
|
12520
13111
|
//# sourceMappingURL=index.js.map
|