-
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.
26441: distsql: add NewFinalIterator to the rowIterator interface r=asubiotto a=asubiotto Some implementations of the rowIterator interface would destroy rows as they were iterated over to free memory eagerly. NewFinalIterator is introduced in this change to provide non-reusable behavior and NewIterator is explicitly described as reusable. A reusable iterator has been added to the memRowContainer to satisfy these new interface semantics. Release note: None 26463: storage: Disable campaign-on-wake when receiving raft messages r=bdarnell a=bdarnell When the incoming message is a MsgVote (which is likely the case for the first message received by a quiesced follower), immediate campaigning will cause the election to fail. This is similar to reverting commit 44e3977, but only disables campaigning in one location. Fixes #26391 Release note: None 26469: lint: Fix a file descriptor leak r=bdarnell a=bdarnell This leak is enough to cause `make lintshort` fail when run under the default file descriptor limit on macos (256). Release note: None 26470: build: Pin go.uuid to the version currently in use r=bdarnell a=bdarnell Updates #26332 Release note: None Co-authored-by: Alfonso Subiotto Marqués <alfonso@cockroachlabs.com> Co-authored-by: Ben Darnell <ben@cockroachlabs.com>
- Loading branch information
Showing
13 changed files
with
266 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Copyright 2018 The Cockroach Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
// implied. See the License for the specific language governing | ||
// permissions and limitations under the License. See the AUTHORS file | ||
// for names of contributors. | ||
|
||
package main | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
"github.com/cockroachdb/cockroach/pkg/util/timeutil" | ||
) | ||
|
||
func registerElectionAfterRestart(r *registry) { | ||
r.Add(testSpec{ | ||
Name: "election-after-restart", | ||
Nodes: nodes(3), | ||
Stable: false, // Introduced 2018-06-06 | ||
Run: func(ctx context.Context, t *test, c *cluster) { | ||
t.Status("starting up") | ||
c.Put(ctx, cockroach, "./cockroach") | ||
c.Start(ctx) | ||
|
||
t.Status("creating table and splits") | ||
c.Run(ctx, c.Node(1), `./cockroach sql --insecure -e " | ||
CREATE TABLE kv (k INT PRIMARY KEY, v INT); | ||
ALTER TABLE kv SPLIT AT SELECT generate_series(0, 10000, 100)"`) | ||
|
||
start := timeutil.Now() | ||
c.Run(ctx, c.Node(1), `./cockroach sql --insecure -e " | ||
SELECT * FROM kv"`) | ||
duration := timeutil.Since(start) | ||
c.l.printf("pre-restart, query took %s\n", duration) | ||
|
||
t.Status("restarting") | ||
c.Stop(ctx) | ||
c.Start(ctx) | ||
|
||
// Each of the 100 ranges in this table must elect a leader for | ||
// this query to complete. In naive raft, each of these | ||
// elections would require waiting for a 3-second timeout, one | ||
// at a time. This test verifies that our mechanisms to speed | ||
// this up are working (we trigger elections eagerly, but not so | ||
// eagerly that multiple elections conflict with each other). | ||
start = timeutil.Now() | ||
c.Run(ctx, c.Node(1), `./cockroach sql --insecure -e " | ||
SELECT * FROM kv"`) | ||
duration = timeutil.Since(start) | ||
c.l.printf("post-restart, query took %s\n", duration) | ||
if expected := 15 * time.Second; duration > expected { | ||
// In the happy case, this query runs in around 250ms. Prior | ||
// to the introduction of this test, a bug caused most | ||
// elections to fail and the query would take over 100 | ||
// seconds. There are still issues that can cause a few | ||
// elections to fail (the biggest one as I write this is | ||
// #26448), so we must use a generous timeout here. We may be | ||
// able to tighten the bounds as we make more improvements. | ||
t.Fatalf("expected query to succeed in less than %s, took %s", expected, duration) | ||
} | ||
}, | ||
}) | ||
} |
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
Oops, something went wrong.