func NewPopulatedMVCCMetadata(r randyMvcc, easy bool) *MVCCMetadata { this := &MVCCMetadata{} if r.Intn(10) != 0 { this.Txn = NewPopulatedTxnMeta(r, easy) } v3 := cockroach_util_hlc.NewPopulatedTimestamp(r, easy) this.Timestamp = *v3 this.Deleted = bool(bool(r.Intn(2) == 0)) this.KeyBytes = int64(r.Int63()) if r.Intn(2) == 0 { this.KeyBytes *= -1 } this.ValBytes = int64(r.Int63()) if r.Intn(2) == 0 { this.ValBytes *= -1 } if r.Intn(10) != 0 { v4 := r.Intn(100) this.RawBytes = make([]byte, v4) for i := 0; i < v4; i++ { this.RawBytes[i] = byte(r.Intn(256)) } } if r.Intn(10) != 0 { this.MergeTimestamp = cockroach_util_hlc.NewPopulatedTimestamp(r, easy) } if !easy && r.Intn(10) != 0 { } return this }
func NewPopulatedTxnMeta(r randyMvcc, easy bool) *TxnMeta { this := &TxnMeta{} if r.Intn(10) != 0 { this.ID = github_com_cockroachdb_cockroach_pkg_util_uuid.NewPopulatedUUID(r) } this.Isolation = IsolationType([]int32{0, 1}[r.Intn(2)]) if r.Intn(10) != 0 { v1 := r.Intn(100) this.Key = make([]byte, v1) for i := 0; i < v1; i++ { this.Key[i] = byte(r.Intn(256)) } } this.Epoch = uint32(r.Uint32()) v2 := cockroach_util_hlc.NewPopulatedTimestamp(r, easy) this.Timestamp = *v2 this.Priority = int32(r.Int31()) if r.Intn(2) == 0 { this.Priority *= -1 } this.Sequence = int32(r.Int31()) if r.Intn(2) == 0 { this.Sequence *= -1 } this.BatchIndex = int32(r.Int31()) if r.Intn(2) == 0 { this.BatchIndex *= -1 } if !easy && r.Intn(10) != 0 { } return this }
populatedConstructor: func(r *rand.Rand) proto.Message { return roachpb.NewPopulatedAbortCacheEntry(r, false) }, emptySum: 11932598136014321867, populatedSum: 5118321872981034391, }, reflect.TypeOf(&roachpb.Lease{}): { populatedConstructor: func(r *rand.Rand) proto.Message { return roachpb.NewPopulatedLease(r, false) }, emptySum: 10006158318270644799, populatedSum: 17421216026521129287, }, reflect.TypeOf(&roachpb.RaftTruncatedState{}): { populatedConstructor: func(r *rand.Rand) proto.Message { return roachpb.NewPopulatedRaftTruncatedState(r, false) }, emptySum: 5531676819244041709, populatedSum: 14781226418259198098, }, reflect.TypeOf(&hlc.Timestamp{}): { populatedConstructor: func(r *rand.Rand) proto.Message { return hlc.NewPopulatedTimestamp(r, false) }, emptySum: 5531676819244041709, populatedSum: 10735653246768912584, }, reflect.TypeOf(&roachpb.Transaction{}): { populatedConstructor: func(r *rand.Rand) proto.Message { return roachpb.NewPopulatedTransaction(r, false) }, emptySum: 8650182997796107667, populatedSum: 85604713557216790, }, } func TestBelowRaftProtos(t *testing.T) { defer leaktest.AfterTest(t)() // Enable the additional checks in TestMain. NB: running this test by itself // will fail those extra checks - such failures are safe to ignore, so long