Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: nolouch <[email protected]>
  • Loading branch information
nolouch committed Jul 4, 2024
1 parent 1eadd59 commit 2a20278
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions pkg/mcs/resourcemanager/server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,30 +155,30 @@ type RequestUnitConfig struct {
}

// Adjust adjusts the configuration and initializes it with the default value if necessary.
func (ruc *RequestUnitConfig) Adjust() {
func (ruc *RequestUnitConfig) Adjust(meta *configutil.ConfigMetaData) {
if ruc == nil {
return
}
if ruc.ReadBaseCost == 0 {
ruc.ReadBaseCost = defaultReadBaseCost
if !meta.IsDefined("read-base-cost") {
configutil.AdjustFloat64(&ruc.ReadBaseCost, defaultReadBaseCost)
}
if ruc.ReadPerBatchBaseCost == 0 {
ruc.ReadPerBatchBaseCost = defaultReadPerBatchBaseCost
if !meta.IsDefined("read-per-batch-base-cost") {
configutil.AdjustFloat64(&ruc.ReadPerBatchBaseCost, defaultReadPerBatchBaseCost)
}
if ruc.ReadCostPerByte == 0 {
ruc.ReadCostPerByte = defaultReadCostPerByte
if !meta.IsDefined("read-cost-per-byte") {
configutil.AdjustFloat64(&ruc.ReadCostPerByte, defaultReadCostPerByte)
}
if ruc.WriteBaseCost == 0 {
ruc.WriteBaseCost = defaultWriteBaseCost
if !meta.IsDefined("write-base-cost") {
configutil.AdjustFloat64(&ruc.WriteBaseCost, defaultWriteBaseCost)
}
if ruc.WritePerBatchBaseCost == 0 {
ruc.WritePerBatchBaseCost = defaultWritePerBatchBaseCost
if !meta.IsDefined("write-per-batch-base-cost") {
configutil.AdjustFloat64(&ruc.WritePerBatchBaseCost, defaultWritePerBatchBaseCost)
}
if ruc.WriteCostPerByte == 0 {
ruc.WriteCostPerByte = defaultWriteCostPerByte
if !meta.IsDefined("write-cost-per-byte") {
configutil.AdjustFloat64(&ruc.WriteCostPerByte, defaultWriteCostPerByte)
}
if ruc.CPUMsCost == 0 {
ruc.CPUMsCost = defaultCPUMsCost
if !meta.IsDefined("read-cpu-ms-cost") {
configutil.AdjustFloat64(&ruc.CPUMsCost, defaultCPUMsCost)
}
}

Expand Down

0 comments on commit 2a20278

Please sign in to comment.