Skip to content

Commit

Permalink
Merge remote-tracking branch 'pingcap/master' into exch-part-list-val…
Browse files Browse the repository at this point in the history
…idate-46492
  • Loading branch information
mjonss committed Sep 5, 2023
2 parents 2345310 + 923d98f commit 213d9e2
Show file tree
Hide file tree
Showing 321 changed files with 10,864 additions and 4,460 deletions.
1 change: 1 addition & 0 deletions .github/licenserc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ header:
- "**/OWNERS"
- "OWNERS_ALIASES"
- "disttask/framework/mock/*_mock.go"
- "util/sqlexec/mock/*_mock.go"
comment: on-failure
60 changes: 30 additions & 30 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6937,13 +6937,13 @@ def go_deps():
name = "com_github_tikv_client_go_v2",
build_file_proto_mode = "disable_global",
importpath = "github.com/tikv/client-go/v2",
sha256 = "608e5c393dcf7fa07a7a360333816dc479b05bad6ad489a4643c9a096e47f5d9",
strip_prefix = "github.com/tikv/client-go/[email protected].20230811033710-8a214402da13",
sha256 = "d6ce005b65261e495ee771f5cfdbc75e409c739ff0b89f4edcd187c3c0cb000f",
strip_prefix = "github.com/tikv/client-go/[email protected].20230905034839-5dd12b06bc3c",
urls = [
"http://bazel-cache.pingcap.net:8080/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20230811033710-8a214402da13.zip",
"http://ats.apps.svc/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20230811033710-8a214402da13.zip",
"https://cache.hawkingrei.com/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20230811033710-8a214402da13.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20230811033710-8a214402da13.zip",
"http://bazel-cache.pingcap.net:8080/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20230905034839-5dd12b06bc3c.zip",
"http://ats.apps.svc/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20230905034839-5dd12b06bc3c.zip",
"https://cache.hawkingrei.com/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20230905034839-5dd12b06bc3c.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20230905034839-5dd12b06bc3c.zip",
],
)
go_repository(
Expand Down Expand Up @@ -10282,39 +10282,39 @@ def go_deps():
name = "org_modernc_golex",
build_file_proto_mode = "disable_global",
importpath = "modernc.org/golex",
sha256 = "81ddbe54f9eca46effe625329bfb961ea5e63a8acc1c793e2ee1b8a61a770bf9",
strip_prefix = "modernc.org/golex@v1.0.5",
sha256 = "3099b4f7e65cc38d113d6558f2a223ba4ce5288a930b182ac6ef679a96dbcfe5",
strip_prefix = "modernc.org/golex@v1.1.0",
urls = [
"http://bazel-cache.pingcap.net:8080/gomod/modernc.org/golex/org_modernc_golex-v1.0.5.zip",
"http://ats.apps.svc/gomod/modernc.org/golex/org_modernc_golex-v1.0.5.zip",
"https://cache.hawkingrei.com/gomod/modernc.org/golex/org_modernc_golex-v1.0.5.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/modernc.org/golex/org_modernc_golex-v1.0.5.zip",
"http://bazel-cache.pingcap.net:8080/gomod/modernc.org/golex/org_modernc_golex-v1.1.0.zip",
"http://ats.apps.svc/gomod/modernc.org/golex/org_modernc_golex-v1.1.0.zip",
"https://cache.hawkingrei.com/gomod/modernc.org/golex/org_modernc_golex-v1.1.0.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/modernc.org/golex/org_modernc_golex-v1.1.0.zip",
],
)
go_repository(
name = "org_modernc_mathutil",
build_file_proto_mode = "disable_global",
importpath = "modernc.org/mathutil",
sha256 = "c17a767eaa5eb62d9bb105b8ece7f249186dd52b9b533301bec140b3d5fd260f",
strip_prefix = "modernc.org/mathutil@v1.5.0",
sha256 = "3a9e2065897e172b4c092c3098e15a2d66bc2700432f88ba6812c1b6b0acf2b2",
strip_prefix = "modernc.org/mathutil@v1.6.0",
urls = [
"http://bazel-cache.pingcap.net:8080/gomod/modernc.org/mathutil/org_modernc_mathutil-v1.5.0.zip",
"http://ats.apps.svc/gomod/modernc.org/mathutil/org_modernc_mathutil-v1.5.0.zip",
"https://cache.hawkingrei.com/gomod/modernc.org/mathutil/org_modernc_mathutil-v1.5.0.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/modernc.org/mathutil/org_modernc_mathutil-v1.5.0.zip",
"http://bazel-cache.pingcap.net:8080/gomod/modernc.org/mathutil/org_modernc_mathutil-v1.6.0.zip",
"http://ats.apps.svc/gomod/modernc.org/mathutil/org_modernc_mathutil-v1.6.0.zip",
"https://cache.hawkingrei.com/gomod/modernc.org/mathutil/org_modernc_mathutil-v1.6.0.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/modernc.org/mathutil/org_modernc_mathutil-v1.6.0.zip",
],
)
go_repository(
name = "org_modernc_parser",
build_file_proto_mode = "disable_global",
importpath = "modernc.org/parser",
sha256 = "fd46145315aac782cfe7199f58b01a88da814200857b136029aa635c55eff705",
strip_prefix = "modernc.org/parser@v1.0.7",
sha256 = "e50f98025a0dfff5ffe5fe5dba38a11f85e5402cdcb9ed7ed0a8d3db6d811b67",
strip_prefix = "modernc.org/parser@v1.1.0",
urls = [
"http://bazel-cache.pingcap.net:8080/gomod/modernc.org/parser/org_modernc_parser-v1.0.7.zip",
"http://ats.apps.svc/gomod/modernc.org/parser/org_modernc_parser-v1.0.7.zip",
"https://cache.hawkingrei.com/gomod/modernc.org/parser/org_modernc_parser-v1.0.7.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/modernc.org/parser/org_modernc_parser-v1.0.7.zip",
"http://bazel-cache.pingcap.net:8080/gomod/modernc.org/parser/org_modernc_parser-v1.1.0.zip",
"http://ats.apps.svc/gomod/modernc.org/parser/org_modernc_parser-v1.1.0.zip",
"https://cache.hawkingrei.com/gomod/modernc.org/parser/org_modernc_parser-v1.1.0.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/modernc.org/parser/org_modernc_parser-v1.1.0.zip",
],
)
go_repository(
Expand All @@ -10334,13 +10334,13 @@ def go_deps():
name = "org_modernc_strutil",
build_file_proto_mode = "disable_global",
importpath = "modernc.org/strutil",
sha256 = "2e59915393fa6a75021a97a41c60fac71c662bb9d1dc2d06e2c4ed77ea5da8cc",
strip_prefix = "modernc.org/strutil@v1.1.3",
sha256 = "1ea20b81cf3fd6efad4bb1b791255cc2fd486111d5e9f2cb0e551e9d39aa3f8f",
strip_prefix = "modernc.org/strutil@v1.2.0",
urls = [
"http://bazel-cache.pingcap.net:8080/gomod/modernc.org/strutil/org_modernc_strutil-v1.1.3.zip",
"http://ats.apps.svc/gomod/modernc.org/strutil/org_modernc_strutil-v1.1.3.zip",
"https://cache.hawkingrei.com/gomod/modernc.org/strutil/org_modernc_strutil-v1.1.3.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/modernc.org/strutil/org_modernc_strutil-v1.1.3.zip",
"http://bazel-cache.pingcap.net:8080/gomod/modernc.org/strutil/org_modernc_strutil-v1.2.0.zip",
"http://ats.apps.svc/gomod/modernc.org/strutil/org_modernc_strutil-v1.2.0.zip",
"https://cache.hawkingrei.com/gomod/modernc.org/strutil/org_modernc_strutil-v1.2.0.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/modernc.org/strutil/org_modernc_strutil-v1.2.0.zip",
],
)
go_repository(
Expand Down
27 changes: 16 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ tools/bin/vfsgendev:
tools/bin/gotestsum:
GOBIN=$(shell pwd)/tools/bin $(GO) install gotest.tools/[email protected]

tools/bin/mockgen:
GOBIN=$(shell pwd)/tools/bin $(GO) install go.uber.org/mock/[email protected]

# Usage:
#
# $ make vectorized-bench VB_FILE=Time VB_FUNC=builtinCurrentDateSig
Expand Down Expand Up @@ -370,19 +373,21 @@ br_compatibility_test_prepare:
br_compatibility_test:
@cd br && tests/run_compatible.sh run

mock_s3iface:
@mockgen -package mock github.com/aws/aws-sdk-go/service/s3/s3iface S3API > br/pkg/mock/s3iface.go
mock_s3iface: tools/bin/mockgen
tools/bin/mockgen -package mock github.com/aws/aws-sdk-go/service/s3/s3iface S3API > br/pkg/mock/s3iface.go

# mock interface for lightning and IMPORT INTO
mock_lightning:
@mockgen -package mock github.com/pingcap/tidb/br/pkg/lightning/backend Backend,EngineWriter,TargetInfoGetter,ChunkFlushStatus > br/pkg/mock/backend.go
@mockgen -package mock github.com/pingcap/tidb/br/pkg/lightning/backend/encode Encoder,EncodingBuilder,Rows,Row > br/pkg/mock/encode.go
@mockgen -package mocklocal github.com/pingcap/tidb/br/pkg/lightning/backend/local DiskUsage,TiKVModeSwitcher > br/pkg/mock/mocklocal/local.go
@mockgen -package mock github.com/pingcap/tidb/br/pkg/utils TaskRegister > br/pkg/mock/task_register.go

gen_mock:
@mockgen -package mock github.com/pingcap/tidb/disttask/framework/scheduler TaskTable,SubtaskExecutor,Pool,Scheduler,InternalScheduler > disttask/framework/mock/scheduler_mock.go

mock_lightning: tools/bin/mockgen
tools/bin/mockgen -package mock github.com/pingcap/tidb/br/pkg/lightning/backend Backend,EngineWriter,TargetInfoGetter,ChunkFlushStatus > br/pkg/mock/backend.go
tools/bin/mockgen -package mock github.com/pingcap/tidb/br/pkg/lightning/backend/encode Encoder,EncodingBuilder,Rows,Row > br/pkg/mock/encode.go
tools/bin/mockgen -package mocklocal github.com/pingcap/tidb/br/pkg/lightning/backend/local DiskUsage,TiKVModeSwitcher > br/pkg/mock/mocklocal/local.go
tools/bin/mockgen -package mock github.com/pingcap/tidb/br/pkg/utils TaskRegister > br/pkg/mock/task_register.go

gen_mock: tools/bin/mockgen
tools/bin/mockgen -package mock github.com/pingcap/tidb/disttask/framework/scheduler TaskTable,SubtaskExecutor,Pool,Scheduler,InternalScheduler > disttask/framework/mock/scheduler_mock.go
tools/bin/mockgen -package mock github.com/pingcap/tidb/disttask/framework/planner LogicalPlan,PipelineSpec > disttask/framework/mock/plan_mock.go
tools/bin/mockgen -package mock github.com/pingcap/tidb/util/sqlexec RestrictedSQLExecutor > util/sqlexec/mock/restricted_sql_executor_mock.go

# There is no FreeBSD environment for GitHub actions. So cross-compile on Linux
# but that doesn't work with CGO_ENABLED=1, so disable cgo. The reason to have
# cgo enabled on regular builds is performance.
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
 
<a href="https://ask.pingcap.com/"><img src="https://img.shields.io/badge/- Forum -red?style=social&logo=discourse" height=25></a>
&nbsp;
<a href="https://discord.gg/KVRZBR2DrG?utm_source=github"><img src="https://img.shields.io/badge/- Discord -red?style=social&logo=discord" height=25></a>
&nbsp;
<a href="https://slack.tidb.io/invite?team=tidb-community&channel=everyone&ref=pingcap-tidb"><img src="https://img.shields.io/badge/-Slack-red?style=social&logo=slack" height=25></a>
&nbsp;
<a href="https://stackoverflow.com/questions/tagged/tidb"><img src="https://img.shields.io/badge/-Stack Overflow-red?style=social&logo=stackoverflow" height=25></a>
Expand Down Expand Up @@ -75,6 +77,7 @@ You can join the following groups or channels to discuss or ask questions about

- Seek help when you use TiDB
- TiDB Forum: [English](https://ask.pingcap.com/), [Chinese](https://asktug.com)
- [Discord](https://discord.gg/KVRZBR2DrG?utm_source=github)
- Slack channels: [#everyone](https://slack.tidb.io/invite?team=tidb-community&channel=everyone&ref=pingcap-tidb) (English), [#tidb-japan](https://slack.tidb.io/invite?team=tidb-community&channel=tidb-japan&ref=github-tidb) (Japanese)
- [Stack Overflow](https://stackoverflow.com/questions/tagged/tidb) (questions tagged with #tidb)
- Discuss TiDB's implementation and design
Expand Down
24 changes: 24 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,27 @@ http_archive(
"https://github.com/bazelbuild/java_tools/releases/download/java_v12.6/java_tools_linux-v12.6.zip",
],
)

http_archive(
name = "rules_proto",
sha256 = "aa1ee19226f707d44bee44c720915199c20c84a23318bb0597ed4e5c873ccbd5",
strip_prefix = "rules_proto-40298556293ae502c66579620a7ce867d5f57311",
urls = [
"http://bazel-cache.pingcap.net:8080/bazelbuild/rules_proto/archive/40298556293ae502c66579620a7ce867d5f57311.tar.gz",
"http://ats.apps.svc/bazelbuild/rules_proto/archive/40298556293ae502c66579620a7ce867d5f57311.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/40298556293ae502c66579620a7ce867d5f57311.tar.gz",
"https://github.com/bazelbuild/rules_proto/archive/40298556293ae502c66579620a7ce867d5f57311.tar.gz",
],
)

http_archive(
name = "rules_java",
sha256 = "f5a3e477e579231fca27bf202bb0e8fbe4fc6339d63b38ccb87c2760b533d1c3",
strip_prefix = "rules_java-981f06c3d2bd10225e85209904090eb7b5fb26bd",
urls = [
"http://bazel-cache.pingcap.net:8080/bazelbuild/rules_java/archive/981f06c3d2bd10225e85209904090eb7b5fb26bd.tar.gz",
"http://ats.apps.svc/bazelbuild/rules_java/archive/981f06c3d2bd10225e85209904090eb7b5fb26bd.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_java/archive/981f06c3d2bd10225e85209904090eb7b5fb26bd.tar.gz",
"https://github.com/bazelbuild/rules_java/archive/981f06c3d2bd10225e85209904090eb7b5fb26bd.tar.gz",
],
)
5 changes: 3 additions & 2 deletions autoid_service/autoid.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@ func newWithCli(selfAddr string, cli *clientv3.Client, store kv.Storage) *Servic
zap.String("addr", selfAddr),
zap.String("category", "autoid service"))
})
err := l.CampaignOwner()
// 10 means that autoid service's etcd lease is 10s.
err := l.CampaignOwner(10)
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -464,7 +465,7 @@ func (s *Service) allocAutoID(ctx context.Context, req *autoid.AutoIDRequest) (*
var currentEnd int64
ctx = kv.WithInternalSourceType(ctx, kv.InternalTxnMeta)
err := kv.RunInNewTxn(ctx, s.store, true, func(ctx context.Context, txn kv.Transaction) error {
idAcc := meta.NewMeta(txn).GetAutoIDAccessors(req.DbID, req.TblID).RowID()
idAcc := meta.NewMeta(txn).GetAutoIDAccessors(req.DbID, req.TblID).IncrementID(model.TableInfoVersion5)
var err1 error
currentEnd, err1 = idAcc.Get()
if err1 != nil {
Expand Down
1 change: 1 addition & 0 deletions br/pkg/backup/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ go_library(
"//br/pkg/storage",
"//br/pkg/summary",
"//br/pkg/utils",
"//br/pkg/version",
"//ddl",
"//distsql",
"//kv",
Expand Down
10 changes: 10 additions & 0 deletions br/pkg/backup/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
"github.com/pingcap/tidb/br/pkg/storage"
"github.com/pingcap/tidb/br/pkg/summary"
"github.com/pingcap/tidb/br/pkg/utils"
"github.com/pingcap/tidb/br/pkg/version"
"github.com/pingcap/tidb/ddl"
"github.com/pingcap/tidb/distsql"
"github.com/pingcap/tidb/kv"
Expand Down Expand Up @@ -537,6 +538,15 @@ func BuildBackupRangeAndInitSchema(

hasTable := false
err = m.IterTables(dbInfo.ID, func(tableInfo *model.TableInfo) error {
if tableInfo.Version > version.CURRENT_BACKUP_SUPPORT_TABLE_INFO_VERSION {
// normally this shouldn't happen in a production env.
// because we had a unit test to avoid table info version update silencly.
// and had version check before run backup.
return errors.Errorf("backup doesn't not support table %s with version %d, maybe try a new version of br",
tableInfo.Name.String(),
tableInfo.Version,
)
}
if !tableFilter.MatchTable(dbInfo.Name.O, tableInfo.Name.O) {
// Skip tables other than the given table.
return nil
Expand Down
4 changes: 3 additions & 1 deletion br/pkg/lightning/backend/external/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ go_library(
"file.go",
"iter.go",
"kv_reader.go",
"split.go",
"stat_reader.go",
"util.go",
"writer.go",
Expand Down Expand Up @@ -46,12 +47,13 @@ go_test(
"engine_test.go",
"file_test.go",
"iter_test.go",
"split_test.go",
"util_test.go",
"writer_test.go",
],
embed = [":external"],
flaky = True,
shard_count = 22,
shard_count = 28,
deps = [
"//br/pkg/lightning/backend/kv",
"//br/pkg/lightning/common",
Expand Down
46 changes: 32 additions & 14 deletions br/pkg/lightning/backend/external/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@ import (
"encoding/binary"
)

// rangeProperty stores properties of a range:
// - key: the start key of the range.
// - offset: the start offset of the range in the file.
// - size: the size of the range.
// - keys: the number of keys in the range.
type rangeProperty struct {
key []byte
offset uint64
size uint64
keys uint64
firstKey []byte
lastKey []byte
offset uint64
size uint64
keys uint64
}

// decodeMultiProps is only used for test.
Expand All @@ -40,22 +46,31 @@ func decodeMultiProps(data []byte) []*rangeProperty {

func decodeProp(data []byte) *rangeProperty {
rp := &rangeProperty{}
keyLen := binary.BigEndian.Uint32(data[0:4])
rp.key = data[4 : 4+keyLen]
rp.size = binary.BigEndian.Uint64(data[4+keyLen : 12+keyLen])
rp.keys = binary.BigEndian.Uint64(data[12+keyLen : 20+keyLen])
rp.offset = binary.BigEndian.Uint64(data[20+keyLen : 28+keyLen])
n := 0
keyLen := int(binary.BigEndian.Uint32(data[n : n+4]))
n += 4
rp.firstKey = data[n : n+keyLen]
n += keyLen
keyLen = int(binary.BigEndian.Uint32(data[n : n+4]))
n += 4
rp.lastKey = data[n : n+keyLen]
n += keyLen
rp.size = binary.BigEndian.Uint64(data[n : n+8])
n += 8
rp.keys = binary.BigEndian.Uint64(data[n : n+8])
n += 8
rp.offset = binary.BigEndian.Uint64(data[n : n+8])
return rp
}

// keyLen + p.size + p.keys + p.offset
const propertyLengthExceptKey = 4 + 8 + 8 + 8
// keyLen * 2 + p.size + p.keys + p.offset
const propertyLengthExceptKeys = 4*2 + 8 + 8 + 8

func encodeMultiProps(buf []byte, props []*rangeProperty) []byte {
var propLen [4]byte
for _, p := range props {
binary.BigEndian.PutUint32(propLen[:],
uint32(propertyLengthExceptKey+len(p.key)))
uint32(propertyLengthExceptKeys+len(p.firstKey)+len(p.lastKey)))
buf = append(buf, propLen[:4]...)
buf = encodeProp(buf, p)
}
Expand All @@ -64,9 +79,12 @@ func encodeMultiProps(buf []byte, props []*rangeProperty) []byte {

func encodeProp(buf []byte, r *rangeProperty) []byte {
var b [8]byte
binary.BigEndian.PutUint32(b[:], uint32(len(r.key)))
binary.BigEndian.PutUint32(b[:], uint32(len(r.firstKey)))
buf = append(buf, b[:4]...)
buf = append(buf, r.key...)
buf = append(buf, r.firstKey...)
binary.BigEndian.PutUint32(b[:], uint32(len(r.lastKey)))
buf = append(buf, b[:4]...)
buf = append(buf, r.lastKey...)
binary.BigEndian.PutUint64(b[:], r.size)
buf = append(buf, b[:]...)
binary.BigEndian.PutUint64(b[:], r.keys)
Expand Down
18 changes: 13 additions & 5 deletions br/pkg/lightning/backend/external/codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,20 @@ import (

func TestRangePropertyCodec(t *testing.T) {
prop := &rangeProperty{
key: []byte("key"),
offset: 1,
size: 2,
keys: 3,
firstKey: []byte("key"),
lastKey: []byte("key2"),
offset: 1,
size: 2,
keys: 3,
}
buf := encodeProp(nil, prop)
prop2 := decodeProp(buf)
require.EqualValues(t, prop, prop2)

p1, p2, p3 := &rangeProperty{}, &rangeProperty{}, &rangeProperty{}
for i, p := range []*rangeProperty{p1, p2, p3} {
p.key = []byte(fmt.Sprintf("key%d", i))
p.firstKey = []byte(fmt.Sprintf("key%d", i))
p.lastKey = []byte(fmt.Sprintf("key%d9", i))
p.offset = uint64(10 * i)
p.size = uint64(20 * i)
p.keys = uint64(30 * i)
Expand All @@ -43,3 +45,9 @@ func TestRangePropertyCodec(t *testing.T) {
props := decodeMultiProps(buf)
require.EqualValues(t, []*rangeProperty{p1, p2, p3}, props)
}

func TestPropertyLengthExceptKeys(t *testing.T) {
zero := &rangeProperty{}
bs := encodeProp(nil, zero)
require.EqualValues(t, propertyLengthExceptKeys, len(bs))
}
Loading

0 comments on commit 213d9e2

Please sign in to comment.