github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/kv/kvserver/closedts/setting.go (about)

     1  // Copyright 2018 The Cockroach Authors.
     2  //
     3  // Use of this software is governed by the Business Source License
     4  // included in the file licenses/BSL.txt.
     5  //
     6  // As of the Change Date specified in that file, in accordance with
     7  // the Business Source License, use of this software will be governed
     8  // by the Apache License, Version 2.0, included in the file
     9  // licenses/APL.txt.
    10  
    11  package closedts
    12  
    13  import (
    14  	"time"
    15  
    16  	"github.com/cockroachdb/cockroach/pkg/settings"
    17  	"github.com/cockroachdb/errors"
    18  )
    19  
    20  // TargetDuration is the follower reads closed timestamp update target duration.
    21  var TargetDuration = settings.RegisterNonNegativeDurationSetting(
    22  	"kv.closed_timestamp.target_duration",
    23  	"if nonzero, attempt to provide closed timestamp notifications for timestamps trailing cluster time by approximately this duration",
    24  	3*time.Second,
    25  )
    26  
    27  // CloseFraction is the fraction of TargetDuration determining how often closed
    28  // timestamp updates are to be attempted.
    29  var CloseFraction = settings.RegisterValidatedFloatSetting(
    30  	"kv.closed_timestamp.close_fraction",
    31  	"fraction of closed timestamp target duration specifying how frequently the closed timestamp is advanced",
    32  	0.2,
    33  	func(v float64) error {
    34  		if v <= 0 || v > 1 {
    35  			return errors.New("value not between zero and one")
    36  		}
    37  		return nil
    38  	})