-
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.
64131: storage: report all encountered intents in sst export error r=sumeerbhola,nvanbenschoten a=aliher1911 Previously, pebbleExportToSst was stopping upon encountering first intent. This was causing backups to be very slow if lots of intents build up. To be able to proceed with export, intent needs to be resolved and export retried. The result of this behaviour is that export would run as many times as there were intents in the table before succeeding. To address this, all intents from the range are collected and reported in WriteIntentError. They could be resolved efficiently as batch similar to how GC operates. Fixes #59704 Release note (bug fix): Backup no longer resolves intents one by one. This eliminates running a high pri query to cleanup intents to unblock backup in case of intent buildup. 64707: sql: Add telemetry for zone configuration override r=otan a=ajstorm Add telemetry for cases where the zone configuration of a multi-region database or table is overridden by the user. Release note: None Closes #64268. Co-authored-by: Oleg Afanasyev <[email protected]> Co-authored-by: Adam Storm <[email protected]>
- Loading branch information
Showing
10 changed files
with
563 additions
and
118 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// 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 backupccl_test | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"testing" | ||
"time" | ||
|
||
"github.com/cockroachdb/cockroach/pkg/base" | ||
"github.com/cockroachdb/cockroach/pkg/ccl/utilccl" | ||
"github.com/cockroachdb/cockroach/pkg/kv/kvserver" | ||
"github.com/cockroachdb/cockroach/pkg/roachpb" | ||
"github.com/cockroachdb/cockroach/pkg/testutils/serverutils" | ||
"github.com/cockroachdb/cockroach/pkg/testutils/skip" | ||
"github.com/cockroachdb/cockroach/pkg/util/leaktest" | ||
"github.com/cockroachdb/cockroach/pkg/util/log" | ||
"github.com/cockroachdb/cockroach/pkg/util/timeutil" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestCleanupIntentsDuringBackupPerformanceRegression(t *testing.T) { | ||
defer leaktest.AfterTest(t)() | ||
defer log.Scope(t).Close(t) | ||
defer utilccl.TestingEnableEnterprise()() | ||
|
||
skip.UnderRace(t, "measures backup times not to regress, can't work under race") | ||
|
||
// Time to create backup in presence of intents differs roughly 10x so some | ||
// arbitrary number is picked which is 2x higher than current backup time on | ||
// current (laptop) hardware. | ||
const backupTimeout = time.Second * 10 | ||
|
||
const totalRowCount = 10000 | ||
const perTransactionRowCount = 10 | ||
|
||
// Interceptor catches requests that cleanup transactions of size 1000 which are | ||
// test data transactions. All other transaction commits pass though. | ||
interceptor := func(ctx context.Context, req roachpb.BatchRequest) *roachpb.Error { | ||
endTxn := req.Requests[0].GetEndTxn() | ||
if endTxn != nil && !endTxn.Commit && len(endTxn.LockSpans) == perTransactionRowCount { | ||
// If this is a rollback of one the test's SQL transactions, allow the | ||
// EndTxn to proceed and mark the transaction record as ABORTED, but strip | ||
// the request of its lock spans so that no intents are recorded into the | ||
// transaction record or eagerly resolved. This is a bit of a hack, but it | ||
// mimics the behavior of an abandoned transaction which is aborted by a | ||
// pusher after expiring due to an absence of heartbeats. | ||
endTxn.LockSpans = nil | ||
} | ||
return nil | ||
} | ||
serverKnobs := kvserver.StoreTestingKnobs{TestingRequestFilter: interceptor} | ||
|
||
s, sqlDb, _ := serverutils.StartServer(t, | ||
base.TestServerArgs{Knobs: base.TestingKnobs{Store: &serverKnobs}}) | ||
defer s.Stopper().Stop(context.Background()) | ||
|
||
_, err := sqlDb.Exec("create table foo(v int not null)") | ||
require.NoError(t, err) | ||
|
||
for i := 0; i < totalRowCount; i += perTransactionRowCount { | ||
tx, err := sqlDb.Begin() | ||
require.NoError(t, err) | ||
for j := 0; j < perTransactionRowCount; j += 1 { | ||
statement := fmt.Sprintf("insert into foo (v) values (%d)", i+j) | ||
_, err = tx.Exec(statement) | ||
require.NoError(t, err) | ||
} | ||
require.NoError(t, tx.Rollback()) | ||
} | ||
|
||
start := timeutil.Now() | ||
_, err = sqlDb.Exec("backup table foo to 'userfile:///test.foo'") | ||
stop := timeutil.Now() | ||
require.NoError(t, err, "Failed to run backup") | ||
t.Logf("Backup took %s", stop.Sub(start)) | ||
require.WithinDuration(t, stop, start, backupTimeout, "Time to make backup") | ||
} |
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.