Skip to content

Commit

Permalink
remove unclean_leader_election_enable
Browse files Browse the repository at this point in the history
  • Loading branch information
dweinshenker committed Nov 14, 2023
1 parent a7f163a commit 7e953d4
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 34 deletions.
2 changes: 0 additions & 2 deletions args.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,6 @@ const (
ArgDatabaseTopicSegmentJitterMS = "segment-jitter-ms"
// ArgDatabaseTopicSegmentMS is the period of time, in ms, after which the log will be forced to roll if the segment file isn't full
ArgDatabaseTopicSegmentMS = "segment-ms"
// ArgDatabaseTopicUncleanLeaderElectionEnable determines whether to allow replicas that are not insync to be elected as leaders as last resort
ArgDatabaseTopicUncleanLeaderElectionEnable = "unclean-leader-election-enable"

// ArgPrivateNetworkUUID is the flag for VPC UUID
ArgPrivateNetworkUUID = "private-network-uuid"
Expand Down
27 changes: 1 addition & 26 deletions commands/databases.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,13 @@ func Databases() *Command {

nodeSizeDetails := "The size of the nodes in the database cluster, e.g. `db-s-1vcpu-1gb`` for a 1 CPU, 1GB node. For a list of available size slugs, visit: https://docs.digitalocean.com/reference/api/api-reference/#tag/Databases"
nodeNumberDetails := "The number of nodes in the database cluster. Valid values are 1-3. In addition to the primary node, up to two standby nodes may be added for high availability."
storageSizeMiBDetails := "The amount of disk space allocated to the cluster. Applicable for PostgreSQL and MySQL clusters. This will be set to a default level based on the plan size selected, but can be increased in increments up to a maximum amount. For ranges, visit: https://www.digitalocean.com/pricing/managed-databases"
cmdDatabaseCreate := CmdBuilder(cmd, RunDatabaseCreate, "create <name>", "Create a database cluster", `This command creates a database cluster with the specified name.
There are a number of flags that customize the configuration, all of which are optional. Without any flags set, a single-node, single-CPU PostgreSQL database cluster will be created.`, Writer,
aliasOpt("c"))
AddIntFlag(cmdDatabaseCreate, doctl.ArgDatabaseNumNodes, "", defaultDatabaseNodeCount, nodeNumberDetails)
AddStringFlag(cmdDatabaseCreate, doctl.ArgRegionSlug, "", defaultDatabaseRegion, "The region where the database cluster will be created, e.g. `nyc1` or `sfo2`")
AddStringFlag(cmdDatabaseCreate, doctl.ArgSizeSlug, "", defaultDatabaseNodeSize, nodeSizeDetails)
AddIntFlag(cmdDatabaseCreate, doctl.ArgDatabaseStorageSizeMib, "", 0, storageSizeMiBDetails)
AddStringFlag(cmdDatabaseCreate, doctl.ArgDatabaseEngine, "", defaultDatabaseEngine, "The database engine to be used for the cluster. Possible values are: `pg` for PostgreSQL, `mysql`, `redis`, `mongodb`, and `kafka`.")
AddStringFlag(cmdDatabaseCreate, doctl.ArgVersion, "", "", "The database engine version, e.g. 14 for PostgreSQL version 14")
AddStringFlag(cmdDatabaseCreate, doctl.ArgPrivateNetworkUUID, "", "", "The UUID of a VPC to create the database cluster in; the default VPC for the region will be used if excluded")
Expand Down Expand Up @@ -118,15 +116,10 @@ You must specify the desired number of nodes and size of the nodes. For example:
doctl databases resize ca9f591d-9999-5555-a0ef-1c02d1d1e352 --num-nodes 2 --size db-s-16vcpu-64gb
Database nodes cannot be resized to smaller sizes due to the risk of data loss.
In addition, for PostgreSQL and MySQL clusters, you can provide a disk size in MiB, which will set the total storage (up to a certain range) to the cluster independently. Storage cannot be reduced from its current levels. For example:
doctl databases resize ca9f591d-9999-5555-a0ef-1c02d1d1e352 --num-nodes 2 --size db-s-16vcpu-64gb --storage-size-mib 2048000`, Writer,
Database nodes cannot be resized to smaller sizes due to the risk of data loss.`, Writer,
aliasOpt("rs"))
AddIntFlag(cmdDatabaseResize, doctl.ArgDatabaseNumNodes, "", 0, nodeNumberDetails, requiredOpt())
AddStringFlag(cmdDatabaseResize, doctl.ArgSizeSlug, "", "", nodeSizeDetails, requiredOpt())
AddIntFlag(cmdDatabaseResize, doctl.ArgDatabaseStorageSizeMib, "", 0, storageSizeMiBDetails)

cmdDatabaseMigrate := CmdBuilder(cmd, RunDatabaseMigrate, "migrate <database-id>", "Migrate a database cluster to a new region", `This command migrates the specified database cluster to a new region`, Writer,
aliasOpt("m"))
Expand Down Expand Up @@ -301,12 +294,6 @@ func buildDatabaseCreateRequestFromArgs(c *CmdConfig) (*godo.DatabaseCreateReque

r.PrivateNetworkUUID = privateNetworkUUID

storageSizeMibInt, err := c.Doit.GetInt(c.NS, doctl.ArgDatabaseStorageSizeMib)
if err != nil {
return nil, err
}
r.StorageSizeMib = uint64(storageSizeMibInt)

return r, nil
}

Expand Down Expand Up @@ -509,12 +496,6 @@ func buildDatabaseResizeRequestFromArgs(c *CmdConfig) (*godo.DatabaseResizeReque
}
r.SizeSlug = size

storageSizeMibInt, err := c.Doit.GetInt(c.NS, doctl.ArgDatabaseStorageSizeMib)
if err != nil {
return nil, err
}
r.StorageSizeMib = uint64(storageSizeMibInt)

return r, nil
}

Expand Down Expand Up @@ -1806,10 +1787,6 @@ func getDatabaseTopicConfigArgs(c *CmdConfig) *godo.TopicConfig {
res.SegmentMS = &i
}
}
bVal, err = c.Doit.GetBoolPtr(c.NS, doctl.ArgDatabaseTopicUncleanLeaderElectionEnable)
if err == nil && bVal != nil {
res.UncleanLeaderElectionEnable = bVal
}

return res
}
Expand Down Expand Up @@ -1905,8 +1882,6 @@ This command lists the following details for each partition of a given topic in
"Specifies the maximum time (in ms) for random jitter that is subtracted from the scheduled segment roll time to avoid thundering herd problems")
AddStringFlag(c, doctl.ArgDatabaseTopicSegmentMS, "", "",
"Specifies the maximum time (in ms) to wait to force a log roll if the segment file isn't full. After this period, the log will be forced to roll")
AddBoolFlag(c, doctl.ArgDatabaseTopicUncleanLeaderElectionEnable, "", false,
"Specifies whether to allow replicas that are not insync to be elected as leader as a last resort. This may result in data loss since those leaders are not in sync")
}
return cmd
}
Expand Down
6 changes: 0 additions & 6 deletions commands/displayers/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -963,12 +963,6 @@ func (dt *DatabaseKafkaTopic) KV() []map[string]interface{} {
"value": *t.Config.SegmentMS,
})
}
if t.Config.UncleanLeaderElectionEnable != nil {
cfg = append(cfg, map[string]interface{}{
"key": "UncleanLeaderElectionEnable",
"value": *t.Config.UncleanLeaderElectionEnable,
})
}
o = append(o, cfg...)
}

Expand Down

0 comments on commit 7e953d4

Please sign in to comment.