Skip to content

Commit

Permalink
stash
Browse files Browse the repository at this point in the history
  • Loading branch information
asg0451 committed Jan 28, 2025
1 parent e508cf6 commit 0ed4fa1
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 41 deletions.
8 changes: 3 additions & 5 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2445,11 +2445,9 @@ def go_deps():
name = "com_github_dataexmachina_dev_side_eye_go",
build_file_proto_mode = "disable_global",
importpath = "github.com/DataExMachina-dev/side-eye-go",
sha256 = "ea5676af6abb1965ba70c24a9090932c9e45a002411e9c86298f60f60f16a10a",
strip_prefix = "github.com/DataExMachina-dev/[email protected]",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/DataExMachina-dev/side-eye-go/com_github_dataexmachina_dev_side_eye_go-v0.0.0-20250102012104-645b45402adf.zip",
],
vcs = "git",
remote = "https://github.com/DataExMachina-dev/side-eye-go",
commit = "98a5d15ddf3990000fad7b2756b56dfa3711c35b",
)
go_repository(
name = "com_github_dave_dst",
Expand Down
1 change: 1 addition & 0 deletions pkg/ccl/changefeedccl/cdcevent/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ go_library(
"//pkg/sql/sem/tree",
"//pkg/sql/sessiondatapb",
"//pkg/sql/types",
"//pkg/testutils",
"//pkg/util",
"//pkg/util/cache",
"//pkg/util/encoding",
Expand Down
10 changes: 10 additions & 0 deletions pkg/ccl/changefeedccl/cdcevent/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/sql/sem/tree"
"github.com/cockroachdb/cockroach/pkg/sql/sessiondatapb"
"github.com/cockroachdb/cockroach/pkg/sql/types"
"github.com/cockroachdb/cockroach/pkg/testutils"
"github.com/cockroachdb/cockroach/pkg/util/cache"
"github.com/cockroachdb/cockroach/pkg/util/hlc"
"github.com/cockroachdb/cockroach/pkg/util/iterutil"
Expand Down Expand Up @@ -545,6 +546,15 @@ func (d *eventDecoder) DecodeKV(
return Row{}, err
}

testutils.CaptureSideEyeSnapshotNoT(context.TODO(), "decodekv")
// _ = testutils.CaptureSideEyeSnapshotNoT
// runtime.Breakpoint()

// r, err = d.decodeKV(ctx, kv, rt, schemaTS, keyOnly)
// if err == nil {
// return r, nil
// }

// Failure to decode roachpb.KeyValue we received from rangefeed is pretty bad.
// At this point, we only have guesses why this happened (schema change? data corruption?).
// Retrying this error however is likely to produce exactly the same result.
Expand Down
68 changes: 36 additions & 32 deletions pkg/ccl/changefeedccl/nemeses_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,45 @@ func TestChangefeedNemeses(t *testing.T) {
defer log.Scope(t).Close(t)
skip.UnderRace(t, "takes >1 min under race")

testutils.RunValues(t, "nemeses_options=", cdctest.NemesesOptions, func(t *testing.T, nop cdctest.NemesesOption) {
if nop.EnableSQLSmith == true {
skip.WithIssue(t, 137125)
}
testFn := func(t *testing.T, s TestServer, f cdctest.TestFeedFactory) {
rng, seed := randutil.NewPseudoRand()
t.Logf("random seed: %d", seed)
for {
testutils.RunValues(t, "nemeses_options=", cdctest.NemesesOptions, func(t *testing.T, nop cdctest.NemesesOption) {
nop.EnableSQLSmith = true
// if nop.EnableSQLSmith == true {
// skip.WithIssue(t, 137125)
// }
testFn := func(t *testing.T, s TestServer, f cdctest.TestFeedFactory) {
rng, seed := randutil.NewPseudoRand()
t.Logf("random seed: %d", seed)

sqlDB := sqlutils.MakeSQLRunner(s.DB)
withLegacySchemaChanger := maybeDisableDeclarativeSchemaChangesForTest(t, sqlDB)
sqlDB := sqlutils.MakeSQLRunner(s.DB)
withLegacySchemaChanger := maybeDisableDeclarativeSchemaChangesForTest(t, sqlDB)
withLegacySchemaChanger = false

v, err := cdctest.RunNemesis(f, s.DB, t.Name(), withLegacySchemaChanger, rng, nop)
v, err := cdctest.RunNemesis(f, s.DB, t.Name(), withLegacySchemaChanger, rng, nop)
if err != nil {
t.Fatalf("%+v", err)
}
for _, failure := range v.Failures() {
t.Error(failure)
}
}

// Tenant tests disabled because ALTER TABLE .. SPLIT is not
// supported with cluster virtualization:
//
// nemeses_test.go:39: pq: unimplemented: operation is unsupported inside virtual clusters
//
// TODO(knz): This seems incorrect, see issue #109417.
cdcTest(t, testFn, feedTestNoTenants)
log.FlushFiles()
entries, err := log.FetchEntriesFromFiles(0, math.MaxInt64, 1,
regexp.MustCompile("cdc ux violation"), log.WithFlattenedSensitiveData)
if err != nil {
t.Fatalf("%+v", err)
t.Fatal(err)
}
for _, failure := range v.Failures() {
t.Error(failure)
if len(entries) > 0 {
t.Fatalf("Found violation of CDC's guarantees: %v", entries)
}
}

// Tenant tests disabled because ALTER TABLE .. SPLIT is not
// supported with cluster virtualization:
//
// nemeses_test.go:39: pq: unimplemented: operation is unsupported inside virtual clusters
//
// TODO(knz): This seems incorrect, see issue #109417.
cdcTest(t, testFn, feedTestNoTenants)
log.FlushFiles()
entries, err := log.FetchEntriesFromFiles(0, math.MaxInt64, 1,
regexp.MustCompile("cdc ux violation"), log.WithFlattenedSensitiveData)
if err != nil {
t.Fatal(err)
}
if len(entries) > 0 {
t.Fatalf("Found violation of CDC's guarantees: %v", entries)
}
})
})
}
}
2 changes: 1 addition & 1 deletion pkg/storage/pebble.go
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@ func (p *Pebble) makeMetricEtcEventListener(ctx context.Context) pebble.EventLis
},
DiskSlow: func(info pebble.DiskSlowInfo) {
maxSyncDuration := fs.MaxSyncDuration.Get(&p.cfg.settings.SV)
fatalOnExceeded := fs.MaxSyncDurationFatalOnExceeded.Get(&p.cfg.settings.SV)
fatalOnExceeded := false // fs.MaxSyncDurationFatalOnExceeded.Get(&p.cfg.settings.SV)
if info.Duration.Seconds() >= maxSyncDuration.Seconds() {
atomic.AddInt64(&p.diskStallCount, 1)
// Note that the below log messages go to the main cockroach log, not
Expand Down
45 changes: 44 additions & 1 deletion pkg/testutils/sideeye.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,49 @@ type testingT interface {
TestFatalerLogger
}

type fakeT struct {
name string
}

// Errorf implements testingT.
func (f *fakeT) Errorf(format string, args ...interface{}) {
fmt.Printf(format, args...)
}

// FailNow implements testingT.
func (f *fakeT) FailNow() {
panic("unimplemented")
}

// Fatal implements testingT.
func (f *fakeT) Fatal(args ...interface{}) {
panic("unimplemented")
}

// Fatalf implements testingT.
func (f *fakeT) Fatalf(format string, args ...interface{}) {
panic("unimplemented")
}

// Helper implements testingT.
func (f *fakeT) Helper() {
}

// Logf implements testingT.
func (f *fakeT) Logf(format string, args ...interface{}) {
fmt.Printf(format, args...)
}

func (f *fakeT) Name() string {
return f.name
}

var _ testingT = &fakeT{}

func CaptureSideEyeSnapshotNoT(ctx context.Context, name string) {
CaptureSideEyeSnapshot(ctx, &fakeT{name: name})
}

// CaptureSideEyeSnapshot captures a Side-Eye snapshot if the
// SIDE_EYE_TOKEN env var is set. If the snapshot is captured, the snapshot's
// URL is logged. Snapshots are captured with a 90s timeout.
Expand All @@ -47,7 +90,7 @@ func CaptureSideEyeSnapshot(ctx context.Context, t testingT) {
name = fmt.Sprintf("%s@%s: %s", username, hostname, name)

snapshotCtx, cancel := context.WithTimeoutCause(
ctx, 90*time.Second, errors.New("timed out waiting for Side-Eye snapshot"),
ctx, 180*time.Second, errors.New("timed out waiting for Side-Eye snapshot"),
)
defer cancel()
snapshotURL, err := sideeye.CaptureSelfSnapshot(snapshotCtx, name, sideeye.WithEnvironment("unit tests"))
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/buildutil/crdb_test_off.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ package buildutil
// flag can be used to enable expensive checks, test randomizations, or other
// metamorphic-style perturbations that will not affect test results but will
// exercise different parts of the code.
const CrdbTestBuild = false
const CrdbTestBuild = true
2 changes: 1 addition & 1 deletion pkg/util/log/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ func ApplyConfig(
if err != nil {
return nil, err
}
fileSink.fatalOnLogStall = fatalOnLogStall
fileSink.fatalOnLogStall = func() bool { return false }
attachBufferWrapper(fileSinkInfo, fc.CommonSinkConfig.Buffering, closer)
attachSinkInfo(fileSinkInfo, &fc.Channels)

Expand Down

0 comments on commit 0ed4fa1

Please sign in to comment.