-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
132252: storeliveness,inspectz,sql: expose store liveness state r=nvanbenschoten a=miraradeva The first commit introduces two new inspectz endpoints: - `/inspectz/storeliveness/supportFrom`: for each store on the local server, returns the set of stores the local store is receiving support from, along with the corresponding epochs and expiration timestamps. - `/inspectz/storeliveness/supportFor`: for each store on the local server, returns the set of stores the local store is providing support for, along with the corresponding epochs and expiration timestamps. The second commit adds two new `crdb_internal` tables that expose the node-level view of the local stores' support for and from other stores. They are powered by the /inspectz server API. Both new tables have the same schema: ``` CREATE TABLE crdb_internal.store_liveness_support_{for,from} ( node_id INT NOT NULL, store_id INT NOT NULL, support_{for,from}_node_id INT NOT NULL, support_{for,from}_store_id INT NOT NULL, support_epoch INT NOT NULL, support_expiration TIMESTAMP NOT NULL ``` These tables will be empty unless both store liveness and Raft leader fortification are enabled. 133279: logictest: improve reassign_owned_by test to show names r=rafiss a=rafiss This makes it easier to read the test instead of having to use internal IDs. Epic: None Release note: None Co-authored-by: Mira Radeva <[email protected]> Co-authored-by: Rafi Shamim <[email protected]>
- Loading branch information
Showing
31 changed files
with
739 additions
and
429 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright 2024 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the CockroachDB Software License | ||
// included in the /LICENSE file. | ||
|
||
package kvserver | ||
|
||
import slpb "github.com/cockroachdb/cockroach/pkg/kv/kvserver/storeliveness/storelivenesspb" | ||
|
||
// InspectAllStoreLiveness is an interface that allows for per-store Store | ||
// Liveness state to be combined into a per-node view. It powers the inspectz | ||
// Store Liveness functionality. | ||
type InspectAllStoreLiveness interface { | ||
InspectAllSupportFrom() ([]slpb.SupportStatesPerStore, error) | ||
InspectAllSupportFor() ([]slpb.SupportStatesPerStore, error) | ||
} | ||
|
||
// StoresForStoreLiveness is a wrapper around Stores that implements | ||
// InspectAllStoreLiveness. | ||
type StoresForStoreLiveness Stores | ||
|
||
var _ InspectAllStoreLiveness = (*StoresForStoreLiveness)(nil) | ||
|
||
// MakeStoresForStoreLiveness casts Stores into StoresForStoreLiveness. | ||
func MakeStoresForStoreLiveness(stores *Stores) *StoresForStoreLiveness { | ||
return (*StoresForStoreLiveness)(stores) | ||
} | ||
|
||
// InspectAllSupportFrom implements the InspectAllStoreLiveness interface. It | ||
// iterates over all stores and aggregates their SupportFrom SupportStates. | ||
func (sfsl *StoresForStoreLiveness) InspectAllSupportFrom() ([]slpb.SupportStatesPerStore, error) { | ||
stores := (*Stores)(sfsl) | ||
var sspf []slpb.SupportStatesPerStore | ||
err := stores.VisitStores( | ||
func(s *Store) error { | ||
sspf = append(sspf, s.storeLiveness.InspectSupportFrom()) | ||
return nil | ||
}, | ||
) | ||
return sspf, err | ||
} | ||
|
||
// InspectAllSupportFor implements the InspectAllStoreLiveness interface. It | ||
// iterates over all stores and aggregates their SupportFor SupportStates. | ||
func (sfsl *StoresForStoreLiveness) InspectAllSupportFor() ([]slpb.SupportStatesPerStore, error) { | ||
stores := (*Stores)(sfsl) | ||
var sspf []slpb.SupportStatesPerStore | ||
err := stores.VisitStores( | ||
func(s *Store) error { | ||
sspf = append(sspf, s.storeLiveness.InspectSupportFor()) | ||
return nil | ||
}, | ||
) | ||
return sspf, err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.