Skip to content

Add HA support for the Azure storage backend #8464

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

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog/8464.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
backend: add HA support to the "azure" storage backend
```
17 changes: 17 additions & 0 deletions physical/azure/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const (
// within an Azure blob container.
type AzureBackend struct {
container *azblob.ContainerURL
haEnabled bool
logger log.Logger
permitPool *physical.PermitPool
}
Expand Down Expand Up @@ -165,6 +166,20 @@ func NewAzureBackend(conf map[string]string, logger log.Logger) (physical.Backen
}
}

// HA configuration
haEnabled := false
haEnabledStr := os.Getenv("AZURE_STORAGE_HA_ENABLED")
if haEnabledStr == "" {
haEnabledStr = conf["ha_enabled"]
}
if haEnabledStr != "" {
var err error
haEnabled, err = strconv.ParseBool(haEnabledStr)
if err != nil {
return nil, fmt.Errorf("failed to parse HA enabled: %w", err)
}
}

maxParStr, ok := conf["max_parallel"]
var maxParInt int
if ok {
Expand All @@ -173,13 +188,15 @@ func NewAzureBackend(conf map[string]string, logger log.Logger) (physical.Backen
return nil, fmt.Errorf("failed parsing max_parallel parameter: %w", err)
}
if logger.IsDebug() {
logger.Debug("ha_enabled set", "ha_enabled", haEnabled)
logger.Debug("max_parallel set", "max_parallel", maxParInt)
}
}

a := &AzureBackend{
container: &containerURL,
logger: logger,
haEnabled: haEnabled,
permitPool: physical.NewPermitPool(maxParInt),
}
return a, nil
Expand Down
Loading