Skip to content

Commit

Permalink
Three data hall enable locking by default (#1885)
Browse files Browse the repository at this point in the history
* Enable locking by default when RedundancyMode is three_data_hall
  • Loading branch information
simenl authored Nov 14, 2023
1 parent 6bc5e06 commit 0d2046a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion api/v1beta2/foundationdbcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1916,7 +1916,8 @@ func (cluster *FoundationDBCluster) ShouldUseLocks() bool {
return !*disabled
}

return cluster.Spec.FaultDomain.ZoneCount > 1 || len(cluster.Spec.DatabaseConfiguration.Regions) > 1
return cluster.Spec.FaultDomain.ZoneCount > 1 || len(cluster.Spec.DatabaseConfiguration.Regions) > 1 ||
cluster.Spec.DatabaseConfiguration.RedundancyMode == RedundancyModeThreeDataHall
}

// GetLockPrefix gets the prefix for the keys where we store locking
Expand Down
8 changes: 8 additions & 0 deletions api/v1beta2/foundationdbcluster_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3499,6 +3499,14 @@ var _ = Describe("[api] FoundationDBCluster", func() {
Expect(cluster.ShouldUseLocks()).To(BeTrue())

cluster.Spec.FaultDomain.ZoneCount = 0
Expect(cluster.ShouldUseLocks()).To(BeFalse())

cluster.Spec.DatabaseConfiguration.RedundancyMode = RedundancyModeThreeDataHall
Expect(cluster.ShouldUseLocks()).To(BeTrue())

cluster.Spec.DatabaseConfiguration.RedundancyMode = RedundancyModeDouble
Expect(cluster.ShouldUseLocks()).To(BeFalse())

cluster.Spec.DatabaseConfiguration.Regions = []Region{
{},
{},
Expand Down
2 changes: 1 addition & 1 deletion docs/manual/fault_domains.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ spec:
## Coordinating Global Operations

When running a FoundationDB cluster that is deployed across multiple Kubernetes clusters, each Kubernetes cluster will have its own instance of the operator working on the processes in its cluster. There will be some operations that cannot be scoped to a single Kubernetes cluster, such as changing the database configuration.
The operator provides a locking system to ensure that only one instance of the operator can perform these operations at a time. You can enable this locking system by setting `lockOptions.disableLocks = false` in the cluster spec. The locking system is automatically enabled by default for any cluster that has multiple regions in its database configuration, or a `zoneCount` greater than 1 in its fault domain configuration.
The operator provides a locking system to ensure that only one instance of the operator can perform these operations at a time. You can enable this locking system by setting `lockOptions.disableLocks = false` in the cluster spec. The locking system is automatically enabled by default for any cluster that has multiple regions in its database configuration, a `zoneCount` greater than 1 in its fault domain configuration, or `redundancyMode` equal to `three_data_hall`.

The locking system uses the `processGroupIDPrefix` from the cluster spec to identify an process group of the operator.
Make sure to set this to a unique value for each Kubernetes cluster, both to support the locking system and to prevent duplicate process group IDs.
Expand Down

0 comments on commit 0d2046a

Please sign in to comment.