-
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.
64171: ccl/sqlproxyccl: directory proto and test server r=darinpp a=darinpp * Defines a new interface between a tenant directory client and server * Moves the tenant directory from the CC repo over * Tenant directory modified to use the new interface * Tenant directory modified to use stop.Stopper * Modified pod watcher to use streaming grpc call * Renamed package from directory to tenant, tenantID to ID etc * Renamed references to k8s, pods to server, endpoints etc * Prevents test tenant servers to start for non-existing/inactive tenants * Adds ability to shut down individual tenant servers within a test cluster * Adds a test directory server that can start/stop tenants * Adds tests of the directory running agianst the test server * Allow insecure connections from test tenant to KV server * Fixed a race in kvtenantccl Release note: None 64273: sql: Repartition tables before dropping regions r=arulajmani,otan,ajwerner a=ajstorm Previously we could get into a situation where on dropping a region, concurrent queries on REGIONAL BY ROW tables could fail. This was due to the fact that when resolving the partition tuple in the optimizer, we'd encounter a partition without a corresponding enum value. This issue was timing dependant, and would only be hit if the query had a leased type descriptor from after the drop region, along with a table descriptor from before the drop region. To get around this problem, we introduce a new transaction to the drop region schema changer which performs a pre-drop action of repartitioning all REGIONAL BY ROW tables, and updating their leases. This ensures that the table descriptors will be seen _before_ the modified type descriptors. Of note is the fact that this is only required on drop region. In the add region case, having this mismatch occur and seeing an extra region (with no corresponding partition) is not a problem for the query engine. Release note (sql change): Fix a bug where queries on REGIONAL BY ROW tables could fail in the brief window in which a DROP REGION operation is in progress. Resolves: #64223 64341: changefeedccl: Add a large doc comment r=stevendanna a=stevendanna I found drawing out this diagram useful when working on this system, perhaps it'll be useful to others as well. Release note: None Co-authored-by: Darin Peshev <[email protected]> Co-authored-by: Adam Storm <[email protected]> Co-authored-by: Steven Danna <[email protected]>
- Loading branch information
Showing
24 changed files
with
4,102 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
// Copyright 2021 The Cockroach Authors. | ||
// | ||
// Licensed as a CockroachDB Enterprise file under the Cockroach Community | ||
// License (the "License"); you may not use this file except in compliance with | ||
// the License. You may obtain a copy of the License at | ||
// | ||
// https://github.com/cockroachdb/cockroach/blob/master/licenses/CCL.txt | ||
|
||
/* | ||
Package changefeedccl is the internal implementation behind | ||
changefeeds. | ||
Changefeeds emit KV events on user-specified tables to user-specified | ||
sinks. | ||
Changefeeds are built on top of rangefeeds, which provide a stream of | ||
KV events for a given keyspan as well as periodic "resolved | ||
timestamps" for those spans. For more information on rangefeeds see | ||
docs/RFCS/20170613_range_feeds_storage_primitive.md | ||
The changefeed machinery encodes and delivers both the KV events | ||
and resolved timestamps to the sinks. It further uses the resolved | ||
timestamps to periodically checkpoint a changefeed's progress such | ||
that it can be resumed in the case of a failure. | ||
To ensure that we can correctly encode every KV returned by the | ||
rangefeed, changefeeds also monitor for schema changes. | ||
"Enterprise" changefeeds are all changefeeds with a sink. These | ||
feeds emit KV events to external systems and are run via the job | ||
system. | ||
"Sinkless" or "Experimental" changefeeds are changefeeds without a | ||
sink which emit rows back to the original sql node that issues the | ||
CREATE CHANGEFEED request. | ||
The major components of this system are: | ||
changfeedAggregator: Reads events from a kvfeed, encodes and emits | ||
KV events to the sink and forwards resolved to the changeFrontier. | ||
changeFrontier: Keeps track of the high-watermark of resolved | ||
timestamps seen across the spans we are tracking. Periodically, it | ||
emits resolved timestamps to the sink and checkpoints the | ||
changefeed progress in the job system. | ||
kvfeed: Coordinates the consumption of the rangefeed with the | ||
schemafeed. It starts a set of goroutines that consume the | ||
rangefeed events and forwards events back to the | ||
changefeedAggregator once the schema for the event is known. | ||
schemafeed: Periodically polls the table descriptors | ||
table. Rangefeed events are held until it is sure it knows the | ||
schema for the relevant table at the event's timestamp. | ||
+-----------------+ | ||
+------+ | | +-----+ | ||
| sink |<------+ changeFrontier +------>| job | | ||
+------+ | | +-----+ | ||
+--------+--------+ | ||
^ | ||
| | ||
+-------+--------+ | ||
+------+ | | | ||
| sink +<-------+ changefeedAgg |<------------+ | ||
+------+ | | | | ||
+--+-------------+ chanBuffer | ||
| | | ||
v +------+------+ | ||
+--------------+ | | | ||
| +------>| copyFromTo +--+ | ||
| kvfeed | | | | | ||
| | +------+------+ | | ||
+--------+---+-+ ^ | | ||
| | memBuffer | | ||
| | | | | ||
| | +-----+------+ | +-----------+ | ||
| | | | | | | | ||
| +--------> |physical +----->| rangefeed | | ||
| | feed | | | | | ||
| +------------+ | +-----------+ | ||
| | | ||
| | | ||
| +------------+ | | ||
+------------> | schemafeed |<-| | ||
| (polls) | | ||
+------------+ | ||
*/ | ||
package changefeedccl |
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
Oops, something went wrong.