New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds resiliency to read-only filesystems #45286 #52680
Changes from 3 commits
569e8cc
64815f1
b598944
d4fb892
38f1a4e
f3ac906
79948f3
20d9ba2
fa3ed38
1646319
5305ebb
26fbce7
8a86051
c9dd1a7
c99a68e
545eaf5
86fa7c9
8102c81
043db93
bbf5517
1459937
8eb5e20
2095d82
39a0565
136bc44
1ab13b2
4143f8f
1d9a7ab
f222529
befd822
061dd33
cda2179
4d83de0
e41392f
67d49bb
fa3cc69
89035fb
adbe670
fdcdf45
deafeca
1120428
23bc4e5
06b14b8
56fb9b3
0d7b72f
f390ed8
f44cf0d
97a4c02
54d7c98
aae5142
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -30,6 +30,7 @@ | |||||
import org.elasticsearch.cluster.ClusterStateTaskConfig; | ||||||
import org.elasticsearch.cluster.ClusterStateUpdateTask; | ||||||
import org.elasticsearch.cluster.LocalClusterUpdateTask; | ||||||
import org.elasticsearch.cluster.ClusterInfoService; | ||||||
import org.elasticsearch.cluster.block.ClusterBlocks; | ||||||
import org.elasticsearch.cluster.coordination.ClusterFormationFailureHelper.ClusterFormationState; | ||||||
import org.elasticsearch.cluster.coordination.CoordinationMetaData.VotingConfigExclusion; | ||||||
|
@@ -67,6 +68,8 @@ | |||||
import org.elasticsearch.discovery.PeerFinder; | ||||||
import org.elasticsearch.discovery.SeedHostsProvider; | ||||||
import org.elasticsearch.discovery.SeedHostsResolver; | ||||||
import org.elasticsearch.monitor.fs.FsReadOnlyMonitor; | ||||||
import org.elasticsearch.monitor.fs.FsService; | ||||||
import org.elasticsearch.threadpool.Scheduler; | ||||||
import org.elasticsearch.threadpool.ThreadPool.Names; | ||||||
import org.elasticsearch.transport.TransportResponse.Empty; | ||||||
|
@@ -149,6 +152,8 @@ public class Coordinator extends AbstractLifecycleComponent implements Discovery | |||||
private Optional<Join> lastJoin; | ||||||
private JoinHelper.JoinAccumulator joinAccumulator; | ||||||
private Optional<CoordinatorPublication> currentPublication = Optional.empty(); | ||||||
private final FsService fsService; | ||||||
private final FsReadOnlyMonitor fsReadOnlyMonitor; | ||||||
|
||||||
/** | ||||||
* @param nodeName The name of the node, used to name the {@link java.util.concurrent.ExecutorService} of the {@link SeedHostsResolver}. | ||||||
|
@@ -158,7 +163,8 @@ public Coordinator(String nodeName, Settings settings, ClusterSettings clusterSe | |||||
NamedWriteableRegistry namedWriteableRegistry, AllocationService allocationService, MasterService masterService, | ||||||
Supplier<CoordinationState.PersistedState> persistedStateSupplier, SeedHostsProvider seedHostsProvider, | ||||||
ClusterApplier clusterApplier, Collection<BiConsumer<DiscoveryNode, ClusterState>> onJoinValidators, Random random, | ||||||
RerouteService rerouteService, ElectionStrategy electionStrategy) { | ||||||
RerouteService rerouteService, ElectionStrategy electionStrategy, FsService fsService, | ||||||
ClusterInfoService clusterInfoService) { | ||||||
this.settings = settings; | ||||||
this.transportService = transportService; | ||||||
this.masterService = masterService; | ||||||
|
@@ -168,7 +174,7 @@ public Coordinator(String nodeName, Settings settings, ClusterSettings clusterSe | |||||
this.electionStrategy = electionStrategy; | ||||||
this.joinHelper = new JoinHelper(settings, allocationService, masterService, transportService, | ||||||
this::getCurrentTerm, this::getStateForMasterService, this::handleJoinRequest, this::joinLeaderInTerm, this.onJoinValidators, | ||||||
rerouteService); | ||||||
rerouteService, fsService); | ||||||
this.persistedStateSupplier = persistedStateSupplier; | ||||||
this.noMasterBlockService = new NoMasterBlockService(settings, clusterSettings); | ||||||
this.lastKnownLeader = Optional.empty(); | ||||||
|
@@ -178,7 +184,7 @@ public Coordinator(String nodeName, Settings settings, ClusterSettings clusterSe | |||||
this.publishInfoTimeout = PUBLISH_INFO_TIMEOUT_SETTING.get(settings); | ||||||
this.random = random; | ||||||
this.electionSchedulerFactory = new ElectionSchedulerFactory(settings, random, transportService.getThreadPool()); | ||||||
this.preVoteCollector = new PreVoteCollector(transportService, this::startElection, this::updateMaxTermSeen, electionStrategy); | ||||||
this.preVoteCollector = new PreVoteCollector(transportService, this::startElection, this::updateMaxTermSeen, electionStrategy, fsService); | ||||||
configuredHostsResolver = new SeedHostsResolver(nodeName, settings, transportService, seedHostsProvider); | ||||||
this.peerFinder = new CoordinatorPeerFinder(settings, transportService, | ||||||
new HandshakingTransportAddressConnector(settings, transportService), configuredHostsResolver); | ||||||
|
@@ -196,6 +202,10 @@ public Coordinator(String nodeName, Settings settings, ClusterSettings clusterSe | |||||
transportService::getLocalNode); | ||||||
this.clusterFormationFailureHelper = new ClusterFormationFailureHelper(settings, this::getClusterFormationState, | ||||||
transportService.getThreadPool(), joinHelper::logLastFailedJoinAttempt); | ||||||
//TODO check if FsReadOnlyMonitor and LagDetector can be implemented as a part of a common interface | ||||||
this.fsReadOnlyMonitor = new FsReadOnlyMonitor(settings, clusterSettings, this::getStateForMasterService, transportService::getLocalNode, | ||||||
this::removeNode, clusterInfoService); | ||||||
this.fsService = fsService; | ||||||
} | ||||||
|
||||||
private ClusterFormationState getClusterFormationState() { | ||||||
|
@@ -1171,6 +1181,12 @@ public void run() { | |||||
return; | ||||||
} | ||||||
|
||||||
if(fsService.stats().getTotal().isWritable() == Boolean.FALSE){ | ||||||
logger.warn("skip prevoting as local node is not writable: {}", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A warning here isn't helpful, we should be logging the failure elsewhere so this will simply result in confusion.
Suggested change
Also, we have this generic |
||||||
lastAcceptedState.coordinationMetaData()); | ||||||
return; | ||||||
} | ||||||
|
||||||
if (prevotingRound != null) { | ||||||
prevotingRound.close(); | ||||||
} | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have left out spaces assuming
checkStyles
would catch. But unfortunate. I'll fix white spacing