Skip to content

Commit

Permalink
storage: require enterprise license for WAL failover
Browse files Browse the repository at this point in the history
If WAL failover is configured but the user has not provided an enterprise
license, WAL failover will refuse to failover and log a warning message every
10 minutes.

Epic: none
Release note: none
  • Loading branch information
jbowens committed Mar 27, 2024
1 parent 2cf36f7 commit a90eb16
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/storage/open.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/settings/cluster"
"github.com/cockroachdb/cockroach/pkg/storage/fs"
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/errors"
"github.com/cockroachdb/pebble"
"github.com/cockroachdb/pebble/vfs"
Expand Down Expand Up @@ -394,6 +395,7 @@ func WALFailover(walCfg base.WALFailoverConfig, storeEnvs fs.Envs) ConfigOption
func makePebbleWALFailoverOptsForDir(
settings *cluster.Settings, dir wal.Dir,
) *pebble.WALFailoverOptions {
cclWALFailoverLogEvery := log.Every(10 * time.Minute)
return &pebble.WALFailoverOptions{
Secondary: dir,
FailoverOptions: wal.FailoverOptions{
Expand All @@ -408,8 +410,13 @@ func makePebbleWALFailoverOptsForDir(
//
// NB: We do not use settings.Version.IsActive because we do not have a
// guarantee that the cluster version has been initialized.
failoverOK := settings.Version.ActiveVersionOrEmpty(context.TODO()).IsActive(clusterversion.V24_1Start)
return walFailoverUnhealthyOpThreshold.Get(&settings.SV), failoverOK
versionOK := settings.Version.ActiveVersionOrEmpty(context.TODO()).IsActive(clusterversion.V24_1Start)
// WAL failover is a licensed feature.
licenseOK := base.CCLDistributionAndEnterpriseEnabled(settings)
if !licenseOK && cclWALFailoverLogEvery.ShouldLog() {
log.Warningf(context.Background(), "Ignoring WAL failover configuration because it requires an enterprise license.")
}
return walFailoverUnhealthyOpThreshold.Get(&settings.SV), versionOK && licenseOK
},
},
}
Expand Down

0 comments on commit a90eb16

Please sign in to comment.