Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

We propose to change the LeaderAndIsrRequest to include an additional containsAllReplicas field, denoting whether the request contains the full replica list hosted by the target broker.

...


diff --git a/clients/src/main/resources/common/message/LeaderAndIsrRequest.json b/clients/src/main/resources/common/message/LeaderAndIsrRequest.json

...


index 852968801..7ddca80b9 100644

...


--- a/clients/src/main/resources/common/message/LeaderAndIsrRequest.json

...


+++ b/clients/src/main/resources/common/message/LeaderAndIsrRequest.json

...


@@ -22,7 +22,9 @@

...


// Version 2 adds broker epoch and reorganizes the partitions by topic.

...


//

...


// Version 3 adds AddingReplicas and RemovingReplicas

...


-

...

 "validVersions": "0-4",

...


+

...

// Version 4 adds flexible versions

...


+

...

// Version 5 adds ContainsAllReplicas

...


+

...

 "validVersions": "0-5",

...


"flexibleVersions": "4+",

...


"fields": [

...


{ "name": "ControllerId", "type": "int32", "versions": "0+", "entityType": "brokerId",

...


@@ -51,7 +53,9 @@

...


"about": "The leader's hostname." },

...


{ "name": "Port", "type": "int32", "versions": "0+",

...


"about": "The leader's port." }

...


-

...

 ]}

...


+

...

]},

...


+

...

 { "name": "ContainsAllReplicas", "type": "bool", "versions": "5+",

...


+

...

 "about": "Whether the request contains all replicas hosted by the target broker." }

...


],

...


"commonStructs": [

...


{ "name": "LeaderAndIsrPartitionState", "versions": "0+", "fields": [

...

Proposed Changes

Today, when a new broker starts up, the controller sends a full list of replicas the broker hosts in the LeaderAndIsrRequest. We will formalize this contract by adding the `containsAllReplicas` field to the request. On a new broker startup or on controller failover, the controller will send LeaderAndIsrRequest containing the full set of replicas and will also set `containsAllReplicas` to `true`. When a broker receives a LeaderAndIsrRequest with `containsAllReplicas` set to `true`, it can safely use the replica list in this request as the source-of-truth for the partitions it must host. Any partitions the broker hosts that are not present in the LeaderAndIsrRequest will then be scheduled for deletion, as those would constitute stray partitions.

...