From fff9cceea7caa4e39492c0e5340c4d97b17ced80 Mon Sep 17 00:00:00 2001 From: Xin Hao Zhang Date: Fri, 12 Aug 2022 15:49:44 -0400 Subject: [PATCH 1/3] ui/cluster-ui: prevent returning new obj from session storage every time When we retrieve from localSettings in db-console, we retrieve in the following order: `localSettings ?? sessionStorage ?? defaultValue` The value from the session storage is retrieved via parsing a JSON string and returning a new object. In the active execution pages, we update the URL search string every time the filters object changes to reflect any filters selected. Due to the local settings behaviour, we could end up in an infinite update loop if we continously read from session storage since a new object was being returned each time (e.g. on a hard refresh). To prevent this, when retrieving a stored value, if it exists in session storage but not local storage, we can set the local setting to be parsed object from session storage. Release note (bug fix): active execution pages will no longer crash if there are no filters set in local settings. Release justification: bug fix --- pkg/ui/workspaces/db-console/src/redux/localsettings.ts | 3 +++ .../src/views/statements/activeStatementsSelectors.tsx | 4 +++- .../src/views/transactions/activeTransactionsSelectors.tsx | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pkg/ui/workspaces/db-console/src/redux/localsettings.ts b/pkg/ui/workspaces/db-console/src/redux/localsettings.ts index a1eca5b94508..5a72a80912f7 100644 --- a/pkg/ui/workspaces/db-console/src/redux/localsettings.ts +++ b/pkg/ui/workspaces/db-console/src/redux/localsettings.ts @@ -157,6 +157,9 @@ export class LocalSetting { innerSelector, () => getValueFromSessionStorage(this.key), (uiSettings, cachedValue) => { + if (cachedValue != null && uiSettings[this.key] == null) { + uiSettings[this.key] = cachedValue; + } return uiSettings[this.key] ?? cachedValue ?? defaultValue; }, ); diff --git a/pkg/ui/workspaces/db-console/src/views/statements/activeStatementsSelectors.tsx b/pkg/ui/workspaces/db-console/src/views/statements/activeStatementsSelectors.tsx index 4bc79b1b8fa8..f0af55b6c1ca 100644 --- a/pkg/ui/workspaces/db-console/src/views/statements/activeStatementsSelectors.tsx +++ b/pkg/ui/workspaces/db-console/src/views/statements/activeStatementsSelectors.tsx @@ -27,13 +27,15 @@ const selectedColumnsLocalSetting = new LocalSetting< null, ); +const defaultActiveFilters = { app: defaultFilters.app }; + const filtersLocalSetting = new LocalSetting< AdminUIState, ActiveStatementFilters >( "filters/ActiveStatementsPage", (state: AdminUIState) => state.localSettings, - { app: defaultFilters.app }, + defaultActiveFilters, ); const sortSettingLocalSetting = new LocalSetting( diff --git a/pkg/ui/workspaces/db-console/src/views/transactions/activeTransactionsSelectors.tsx b/pkg/ui/workspaces/db-console/src/views/transactions/activeTransactionsSelectors.tsx index 7fab80df9ae9..2fd785d34efc 100644 --- a/pkg/ui/workspaces/db-console/src/views/transactions/activeTransactionsSelectors.tsx +++ b/pkg/ui/workspaces/db-console/src/views/transactions/activeTransactionsSelectors.tsx @@ -28,13 +28,15 @@ const transactionsColumnsLocalSetting = new LocalSetting< null, ); +const defaultActiveTxnFilters = { app: defaultFilters.app }; + const filtersLocalSetting = new LocalSetting< AdminUIState, ActiveTransactionFilters >( "filters/ActiveTransactionsPage", (state: AdminUIState) => state.localSettings, - { app: defaultFilters.app }, + defaultActiveTxnFilters, ); const sortSettingLocalSetting = new LocalSetting( From 454826e72e2d32244e61574a51a96e95130a7db9 Mon Sep 17 00:00:00 2001 From: Ryan Kuo Date: Mon, 15 Aug 2022 12:04:19 -0400 Subject: [PATCH 2/3] docs: remove 'api change' from git commit scripts --- githooks/commit-msg | 3 --- githooks/prepare-commit-msg | 1 - scripts/release-notes.py | 4 ---- 3 files changed, 8 deletions(-) diff --git a/githooks/commit-msg b/githooks/commit-msg index 634d1c71feb7..146aed08dfb9 100755 --- a/githooks/commit-msg +++ b/githooks/commit-msg @@ -140,7 +140,6 @@ else "cli change") ;; "ops change") ;; "sql change") ;; - "api change") ;; "ui change") ;; "general change") ;; "build change") ;; @@ -157,8 +156,6 @@ else hint "Try 'Release note ($lcat)' -> 'Release note (security update)'" ;; sql*) hint "Try 'Release note ($lcat)' -> 'Release note (sql change)'" ;; - api*) - hint "Try 'Release note ($lcat)' -> 'Release note (api change)'" ;; "admin ui"*|"admin-ui"*) hint "Try 'Release note ($lcat)' -> 'Release note (ui change)'" ;; "backwards-incompatible"*|"backward incompatible"*) diff --git a/githooks/prepare-commit-msg b/githooks/prepare-commit-msg index 2b6488303df5..1a24e426bd2a 100755 --- a/githooks/prepare-commit-msg +++ b/githooks/prepare-commit-msg @@ -148,7 +148,6 @@ $cchar Categories for release notes:\\ $cchar - cli change\\ $cchar - ops change\\ $cchar - sql change\\ -$cchar - api change\\ $cchar - ui change\\ $cchar - security update\\ $cchar - general change (e.g., change of required Go version)\\ diff --git a/scripts/release-notes.py b/scripts/release-notes.py index 10fd84866bd0..b7128710a6c1 100755 --- a/scripts/release-notes.py +++ b/scripts/release-notes.py @@ -157,7 +157,6 @@ def lookup_person(name, email): 'cli change': "Command-line changes", 'ops change': "Operational changes", 'sql change': "SQL language changes", - 'api change': "API endpoint changes", 'ui change': "DB Console changes", 'general change': "General changes", 'build change': "Build changes", @@ -177,7 +176,6 @@ def lookup_person(name, email): 'sql change', 'ops change', 'cli change', - 'api change', 'ui change', 'bug fix', 'performance improvement', @@ -195,8 +193,6 @@ def lookup_person(name, email): 'ui': 'ui change', 'operational change': 'ops change', 'admin ui': 'ui change', - 'api': 'api change', - 'http': 'api change', 'backwards-incompatible change': 'backward-incompatible change', 'enterprise': 'enterprise change', 'security': 'security update', From 1fa00d428a0ec995255393ca94830f4f2babfdce Mon Sep 17 00:00:00 2001 From: Tobias Grieger Date: Mon, 15 Aug 2022 17:11:28 +0200 Subject: [PATCH 3/3] kvserver: default admission.kv.pause_replication_io_threshold to 0.8 Closes https://github.com/cockroachdb/cockroach/issues/83920. Release note (ops change): The `admission.kv.pause_replication_threshold` cluster setting is now set to a default value of 0.8. On a fully migrated v22.2+ deployment, this will allow the KV layer to pause replication streams to followers located on stores that are close to activating their I/O admission control subsystem (thereby protecting these followers from additional overload). The cluster setting can be disabled by setting it to zero. --- pkg/kv/kvserver/replica_raft_overload.go | 4 +--- pkg/kv/kvserver/store_raft.go | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/kv/kvserver/replica_raft_overload.go b/pkg/kv/kvserver/replica_raft_overload.go index 18b1b04ef729..01aa92240cb5 100644 --- a/pkg/kv/kvserver/replica_raft_overload.go +++ b/pkg/kv/kvserver/replica_raft_overload.go @@ -28,9 +28,7 @@ var pauseReplicationIOThreshold = settings.RegisterFloatSetting( settings.SystemOnly, "admission.kv.pause_replication_io_threshold", "pause replication to non-essential followers when their I/O admission control score exceeds the given threshold (zero to disable)", - // TODO(tbg): set a sub-one default. - // See: https://github.com/cockroachdb/cockroach/issues/83920 - 10000, + 0.8, func(v float64) error { if v == 0 { return nil diff --git a/pkg/kv/kvserver/store_raft.go b/pkg/kv/kvserver/store_raft.go index 284e60d8c197..92164cd63f8e 100644 --- a/pkg/kv/kvserver/store_raft.go +++ b/pkg/kv/kvserver/store_raft.go @@ -12,6 +12,7 @@ package kvserver import ( "context" + "math" "time" "unsafe" @@ -770,6 +771,9 @@ func (s *Store) updateIOThresholdMap() { ioThresholdMap[sd.StoreID] = &ioThreshold } threshold := pauseReplicationIOThreshold.Get(&s.cfg.Settings.SV) + if threshold <= 0 { + threshold = math.MaxFloat64 + } old, cur := s.ioThresholds.Replace(ioThresholdMap, threshold) // Log whenever the set of overloaded stores changes. shouldLog := log.V(1) || old.seq != cur.seq