Data structure for managing captaincy qualification for search heads
The provides solutions for determining an elected search head captain is unqualified for the position, identifying a more qualified search head, and transferring the captain position to the more qualified search head. A method is provided that includes referencing qualification parameters in an elected search head captain, determining whether the newly elected search head captain is qualified for the position based on the parameters, identifying a more qualified search head to be the search head captain if the newly elected search head captain is determined to be unqualified for the position, and transferring the position of captain to the more qualified search head. The qualification parameters may include, for example, a pre-determined static flag set by an administrator of the search environment, and configuration replication status that corresponds to the most recent configuration state of the search head as recorded by the previous search head captain.
1 . A method for managing captaincy qualification for search heads, the method comprising:
in a search head cluster comprising a search head captain and a plurality of search heads of a search environment, receiving, at the search head captain, a periodic communication from each search head of the plurality of search heads in the search environment, wherein the periodic communication comprises a configuration replication status corresponding to a respective search head of the plurality of search heads, and wherein the configuration replication status indicates whether the respective search head qualifies to be the search head captain based on a comparison of a first timestamp of a last configuration replication in the search head captain with a second timestamp of a most recent configuration replication in at least the respective search head, wherein each search head of the plurality of search heads in the search head cluster coordinates with other search heads in the search head cluster to execute searches on one or more indexers comprised within a data intake and query system;
determining a timestamp corresponding to the configuration replication status from the respective search head; and
updating a data structure with the timestamp and the configuration replication status from the respective search head, wherein each of the plurality of search heads is configured to access the data structure to determine if the respective search head is qualified to be the search head captain.
2 . The method of claim 1 , wherein the configuration replication status corresponds to a most recent configuration state of the respective search head.
3 . The method of claim 1 , wherein a first search head of the plurality of search heads that becomes the search head captain of the search head cluster references the data structure to determine if the first search head is qualified to become the search head captain based on the respective configuration replication status as updated by a previous search head captain.
4 . The method of claim 1 , wherein the data structure is implemented as a lookup table.
5 . The method of claim 1 , wherein the data structure is implemented as a key-value structure.
6 . The method of claim 1 , wherein the timestamp corresponding to the configuration replication status is based on a timing associated with a receipt of the periodic communication from the respective search head.
7 . The method of claim 1 , further comprising:
maintaining a persistent communication channel between the search head captain and each of the plurality of search heads for receiving periodic communications, at the search head captain, from each of the plurality of search heads.
8 . The method of claim 7 , wherein the persistent communication channel comprises a heartbeat monitoring thread.
9 . The method of claim 1 , wherein the periodic communication further comprises a preferred captain flag which comprises a static indication of whether the respective search head has been pre-selected by an administrator of the search environment as a preferred search head to be the search head captain for the search head cluster.
10 . The method of claim 1 , wherein the periodic communication further comprises a preferred captain flag, wherein the preferred captain flag comprises a Boolean indication of whether the respective search head has been pre-selected as a preferred search head to be the search head captain for the search head cluster.
11 . The method of claim 1 , wherein the periodic communication further comprises a preferred captain flag, wherein the preferred captain flag comprises a static indication of whether the respective search head has been pre-selected as a preferred search head to be the search head captain for the search head cluster based on at least one of: a physical locality of the preferred search head, and a computing capability of the preferred search head.
12 . The method of claim 1 , wherein the configuration replication status is based on a last interaction between the respective search head and the search head captain of the search head cluster.
13 . The method of claim 1 , wherein the configuration replication status is based on a first timestamp of a last interaction between the respective search head and the search head captain of the search head cluster.
14 . The method of claim 1 , wherein the configuration replication status is indicative of whether a last interaction between the respective search head and the search head captain of the search head cluster exceeds a pre-determined threshold duration.
15 . The method of claim 1 , wherein the configuration replication status is indicative of whether a first timestamp of a last interaction between the respective search head and the search head captain of the search head cluster exceeds a pre-determined threshold duration relative to timestamps of last interactions between other search heads of the search head cluster and the search head captain.
16 . A non-transitory computer-readable medium having computer-readable program code embodied therein for causing a computer system to perform a method for managing captaincy qualification for search heads, the method comprising:
in a search head cluster comprising a search head captain and a plurality of search heads of a search environment, receiving, at the search head captain, a periodic communication from each search head of the plurality of search heads in the search environment, wherein the periodic communication comprises a configuration replication status corresponding to a respective search head of the plurality of search heads, and wherein the configuration replication status indicates whether the respective search head qualifies to be the search head captain based on a comparison of a first timestamp of a last configuration replication in the search head captain with a second timestamp of a most recent configuration replication in at least the respective search head, wherein each search head of the plurality of search heads in the search head cluster coordinates with other search heads in the search head cluster to execute searches on one or more indexers comprised within a data intake and query system;
determining a timestamp corresponding to the configuration replication status from the respective search head; and
updating a data structure with the timestamp and the configuration replication status from the respective search head, wherein each of the plurality of search heads is configured to access the data structure to determine if the respective search head is qualified to be the search head captain.
17 . The non-transitory computer-readable medium of claim 16 , wherein the configuration replication status corresponds to a most recent configuration state of the respective search head.
18 . The non-transitory computer-readable medium of claim 16 , wherein the periodic communication further comprises a preferred captain flag which comprises a static indication of whether the respective search head has been pre-selected by an administrator of the search environment as a preferred search head to be the search head captain for the search head cluster.
19 . The non-transitory computer-readable medium of claim 16 , wherein the data structure is implemented as a lookup table.
20 . A system comprising:
a processing device comprised in a search head captain of a search head cluster of a search environment, wherein the search head cluster comprises a search head captain and a plurality of search heads, the processing device being configured to:
receive a periodic communication from each search head of the plurality of search heads in the search environment, wherein the periodic communication comprises a configuration replication status corresponding to a respective search head of the plurality of search heads, and wherein the configuration replication status indicates whether the respective search head qualifies to be the search head captain based on a comparison of a first timestamp of a last configuration replication in the search head captain with a second timestamp of a most recent configuration replication in at least the respective search head, wherein each search head of the plurality of search heads in the search head cluster coordinates with other search heads in the search head cluster to execute searches on one or more indexers comprised within a data intake and query system;
determine a timestamp corresponding to the configuration replication status from the respective search head; and
update a data structure with the timestamp and the configuration replication status from the respective search head, wherein each of the plurality of search heads is configured to access the data structure to determine if the respective search head is qualified to be the search head captain.