Skip to content

Commit 153a3b1

Browse files
committed
wip: split the is_importing stat
1 parent d6e09d5 commit 153a3b1

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

internal/governor/conn.go

+4
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ func readSockstat(environ []string) updateData {
211211
res.GroupLeader = sockstat.GetBool(parts[1])
212212
case "is_importing":
213213
res.IsImporting = sockstat.BoolValue(parts[1])
214+
case "import_skip_push_limit":
215+
res.ImportSkipPushLimit = sockstat.BoolValue(parts[1])
216+
case "import_soft_throttling":
217+
res.ImportSoftThrottling = sockstat.BoolValue(parts[1])
214218
}
215219
}
216220

internal/governor/governor.go

+6
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ type updateData struct {
7676
CommandID string `json:"command_id,omitempty"`
7777
// IsImporting is true if the command is an import.
7878
IsImporting bool `json:"is_importing,omitempty"`
79+
// ImportSkipPushLimit is true if the command is an import and
80+
// want to skip the push limit for a command.
81+
ImportSkipPushLimit bool `json:"is_importing,omitempty"`
82+
// IsImportSoftThrottling is true if the command is an import and
83+
// want to apply it some soft throttling policies.
84+
ImportSoftThrottling bool `json:"is_importing,omitempty"`
7985
}
8086

8187
func update(w io.Writer, ud updateData) error {

internal/spokes/spokes.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,11 @@ func (r *spokesReceivePack) isFsckConfigEnabled() bool {
955955
}
956956

957957
func (r *spokesReceivePack) getMaxInputSize() (int, error) {
958-
if isImporting() {
958+
// We want to skip the default push limit when the `import_skip_push_limit`
959+
// stat is set only.
960+
// We keep using the `is_import` here for backward compatibility only,
961+
// which should be removed on a subsequent PR.
962+
if isImporting() || shouldSkipPushLimit() {
959963
return 80 * 1024 * 1024 * 1024, nil /* 80 GB */
960964
}
961965

@@ -1234,6 +1238,10 @@ func isImporting() bool {
12341238
return sockstat.GetBool("is_importing")
12351239
}
12361240

1241+
func shouldSkipPushLimit() bool {
1242+
return sockstat.GetBool("import_skip_push_limit")
1243+
}
1244+
12371245
func allowBadDate() bool {
12381246
return isImporting() && sockstat.GetBool("allow_baddate_in_import")
12391247
}

0 commit comments

Comments
 (0)