Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport 1.0.7 #4394

Merged
merged 12 commits into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/scripts/prepare_db.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/bin/bash -e

set -x

source .github/scripts/start_meta_engine.sh
[ -z "$TEST" ] && echo "TEST is not set" && exit 1

Expand Down
5 changes: 3 additions & 2 deletions .github/scripts/setup-hdfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
# limitations under the License.
#

set -x
set -e
sudo apt-get update
sudo apt-get install openjdk-8-jdk -y

HADOOP_VERSION="2.10.1"
wget -q https://dlcdn.apache.org/hadoop/common/hadoop-2.10.1/hadoop-2.10.1.tar.gz
HADOOP_VERSION="2.10.2"
wget -q https://dlcdn.apache.org/hadoop/common/hadoop-2.10.2/hadoop-2.10.2.tar.gz
mkdir ~/app
tar -zxf hadoop-${HADOOP_VERSION}.tar.gz -C ~/app

Expand Down
18 changes: 11 additions & 7 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,15 +284,19 @@ func setup(c *cli.Context, n int) {
}
}

func removePassword(uri string) {
func removePassword(uris ...string) {
args := make([]string, len(os.Args))
copy(args, os.Args)
uri2 := utils.RemovePassword(uri)
if uri2 != uri {
for i, a := range os.Args {
if a == uri {
args[i] = uri2
break
var idx int
for _, uri := range uris {
uri2 := utils.RemovePassword(uri)
if uri2 != uri {
for i := idx; i < len(os.Args); i++ {
if os.Args[i] == uri {
args[i] = uri2
idx = i + 1
break
}
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions cmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,7 @@ func doSync(c *cli.Context) error {
// Windows support `\` and `/` as its separator, Unix only use `/`
srcURL := c.Args().Get(0)
dstURL := c.Args().Get(1)
removePassword(srcURL)
removePassword(dstURL)
removePassword(srcURL, dstURL)
if runtime.GOOS == "windows" {
if !strings.Contains(srcURL, "://") {
srcURL = strings.Replace(srcURL, "\\", "/", -1)
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ require (
github.com/sirupsen/logrus v1.9.0
github.com/smartystreets/goconvey v1.7.2
github.com/studio-b12/gowebdav v0.0.0-20220128162035-c7b1ff8a5e62
github.com/tencentyun/cos-go-sdk-v5 v0.7.34
github.com/tencentyun/cos-go-sdk-v5 v0.7.45
github.com/tikv/client-go/v2 v2.0.2
github.com/upyun/go-sdk/v3 v3.0.2
github.com/urfave/cli/v2 v2.4.0
Expand All @@ -65,12 +65,12 @@ require (
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a
go.etcd.io/etcd v3.3.27+incompatible
go.etcd.io/etcd/client/v3 v3.5.2
golang.org/x/crypto v0.14.0
golang.org/x/crypto v0.17.0
golang.org/x/net v0.17.0
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8
golang.org/x/sys v0.13.0
golang.org/x/term v0.13.0
golang.org/x/text v0.13.0
golang.org/x/sys v0.15.0
golang.org/x/term v0.15.0
golang.org/x/text v0.14.0
google.golang.org/api v0.70.0
gopkg.in/kothar/go-backblaze.v0 v0.0.0-20210124194846-35409b867216
xorm.io/xorm v1.0.7
Expand Down
24 changes: 12 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -924,10 +924,10 @@ github.com/studio-b12/gowebdav v0.0.0-20220128162035-c7b1ff8a5e62 h1:b2nJXyPCa9H
github.com/studio-b12/gowebdav v0.0.0-20220128162035-c7b1ff8a5e62/go.mod h1:bHA7t77X/QFExdeAnDzK6vKM34kEZAcE1OX4MfiwjkE=
github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE=
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.194/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/kms v1.0.194/go.mod h1:yrBKWhChnDqNz1xuXdSbWXG56XawEq0G5j1lg4VwBD4=
github.com/tencentyun/cos-go-sdk-v5 v0.7.34 h1:xm+Pg+6m486y4eugRI7/E4WasbVmpY1hp9QBSRErgp8=
github.com/tencentyun/cos-go-sdk-v5 v0.7.34/go.mod h1:4dCEtLHGh8QPxHEkgq+nFaky7yZxQuYwgSJM87icDaw=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.563/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/kms v1.0.563/go.mod h1:uom4Nvi9W+Qkom0exYiJ9VWJjXwyxtPYTkKkaLMlfE0=
github.com/tencentyun/cos-go-sdk-v5 v0.7.45 h1:5/ZGOv846tP6+2X7w//8QjLgH2KcUK+HciFbfjWquFU=
github.com/tencentyun/cos-go-sdk-v5 v0.7.45/go.mod h1:DH9US8nB+AJXqwu/AMOrCFN1COv3dpytXuJWHgdg7kE=
github.com/tidwall/gjson v1.6.7/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI=
github.com/tidwall/gjson v1.9.3 h1:hqzS9wAHMO+KVBBkLxYdkEeeFHuqr95GfClRLKlgK0E=
github.com/tidwall/gjson v1.9.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
Expand Down Expand Up @@ -1056,8 +1056,8 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -1275,12 +1275,12 @@ golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek=
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4=
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand All @@ -1291,8 +1291,8 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/time v0.0.0-20161028155119-f51c12702a4d/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down
2 changes: 2 additions & 0 deletions pkg/meta/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ const (
nlocks = 1024
)

var maxCompactSlices = 1000

type engine interface {
// Get the value of counter name.
getCounter(name string) (int64, error)
Expand Down
47 changes: 47 additions & 0 deletions pkg/meta/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,53 @@ func testCompaction(t *testing.T, m Meta, trash bool) {
if deletes < 200 {
t.Fatalf("deleted slices %d is less than 200", deletes)
}

// truncate to 0
if st := m.Truncate(ctx, inode, 0, 0, attr); st != 0 {
t.Fatalf("truncate file: %s", st)
}
if c, ok := m.(compactor); ok {
c.compactChunk(inode, 0, true)
}
if st := m.Read(ctx, inode, 0, &slices); st != 0 {
t.Fatalf("read 0: %s", st)
}
if len(slices) != 1 || slices[0].Len != 1 {
t.Fatalf("inode %d should be compacted, but have %d slices, size %d", inode, len(slices), slices[0].Len)
}

if st := m.Truncate(ctx, inode, 0, 64<<10, attr); st != 0 {
t.Fatalf("truncate file: %s", st)
}
m.NewSlice(ctx, &sliceId)
_ = m.Write(ctx, inode, 0, uint32(1<<20), Slice{Id: sliceId, Size: 2 << 20, Len: 2 << 20})
if c, ok := m.(compactor); ok {
c.compactChunk(inode, 0, true)
}
if st := m.Read(ctx, inode, 0, &slices); st != 0 {
t.Fatalf("read 0: %s", st)
}
if len(slices) != 2 || slices[0].Id != 0 || slices[1].Len != 2<<20 {
t.Fatalf("inode %d should be compacted, but have %d slices, id %d size %d",
inode, len(slices), slices[0].Id, slices[1].Len)
}

m.NewSlice(ctx, &sliceId)
_ = m.Write(ctx, inode, 0, uint32(512<<10), Slice{Id: sliceId, Size: 2 << 20, Len: 64 << 10})
m.NewSlice(ctx, &sliceId)
_ = m.Write(ctx, inode, 0, uint32(0), Slice{Id: sliceId, Size: 1 << 20, Len: 64 << 10})
m.NewSlice(ctx, &sliceId)
_ = m.Write(ctx, inode, 0, uint32(128<<10), Slice{Id: sliceId, Size: 2 << 20, Len: 128 << 10})
_ = m.Write(ctx, inode, 0, uint32(0), Slice{Id: 0, Size: 1 << 20, Len: 1 << 20})
if c, ok := m.(compactor); ok {
c.compactChunk(inode, 0, true)
}
if st := m.Read(ctx, inode, 0, &slices); st != 0 {
t.Fatalf("read 0: %s", st)
}
if len(slices) != 1 || slices[0].Len != 3<<20 {
t.Fatalf("inode %d should be compacted, but have %d slices, size %d", inode, len(slices), slices[0].Len)
}
}

func testConcurrentWrite(t *testing.T, m Meta) {
Expand Down
19 changes: 13 additions & 6 deletions pkg/meta/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -2028,7 +2028,7 @@ func (m *redisMeta) Write(ctx Context, inode Ino, indx uint32, off uint32, slice
return nil
})
if err == nil {
needCompact = rpush.Val()%100 == 99
needCompact = rpush.Val()%100 == 99 || rpush.Val() > 350
}
return err
}, m.inodeKey(inode))
Expand Down Expand Up @@ -2101,7 +2101,7 @@ func (m *redisMeta) CopyFileRange(ctx Context, fin Ino, offIn uint64, fout Ino,
vals = append(vals, val)
}

_, err = tx.Pipelined(ctx, func(pipe redis.Pipeliner) error {
_, err = tx.TxPipelined(ctx, func(pipe redis.Pipeliner) error {
coff := offIn / ChunkSize * ChunkSize
for _, sv := range vals {
// Add a zero chunk for hole
Expand Down Expand Up @@ -2261,7 +2261,7 @@ func (m *redisMeta) cleanupZeroRef(key string) {
if v != 0 {
return syscall.EINVAL
}
_, err = tx.Pipelined(ctx, func(p redis.Pipeliner) error {
_, err = tx.TxPipelined(ctx, func(p redis.Pipeliner) error {
p.HDel(ctx, m.sliceRefs(), key)
return nil
})
Expand Down Expand Up @@ -2456,7 +2456,7 @@ func (r *redisMeta) doCleanupDelayedSlices(edge int64) (int, error) {
if len(ss) == 0 {
return fmt.Errorf("invalid value for delSlices %s: %v", key, buf)
}
_, e = tx.Pipelined(ctx, func(pipe redis.Pipeliner) error {
_, e = tx.TxPipelined(ctx, func(pipe redis.Pipeliner) error {
for _, s := range ss {
rs = append(rs, pipe.HIncrBy(ctx, r.sliceRefs(), r.sliceKey(s.Id, s.Size), -1))
}
Expand Down Expand Up @@ -2505,7 +2505,7 @@ func (m *redisMeta) compactChunk(inode Ino, indx uint32, force bool) {
}

var ctx = Background
vals, err := m.rdb.LRange(ctx, m.chunkKey(inode, indx), 0, 1000).Result()
vals, err := m.rdb.LRange(ctx, m.chunkKey(inode, indx), 0, int64(maxCompactSlices)).Result()
if err != nil {
return
}
Expand All @@ -2516,11 +2516,18 @@ func (m *redisMeta) compactChunk(inode Ino, indx uint32, force bool) {
return
}
skipped := skipSome(ss)
var first, last *slice
if skipped > 0 {
first, last = ss[0], ss[skipped-1]
}
ss = ss[skipped:]
pos, size, slices := compactChunk(ss)
if len(ss) < 2 || size == 0 {
return
}
if first != nil && last != nil && pos+size > first.pos && last.pos+last.len > pos {
panic(fmt.Sprintf("invalid compaction: skipped slices [%+v, %+v], pos %d, size %d", *first, *last, pos, size))
}

var id uint64
st := m.NewSlice(ctx, &id)
Expand Down Expand Up @@ -2562,7 +2569,7 @@ func (m *redisMeta) compactChunk(inode Ino, indx uint32, force bool) {
}
}

_, err = tx.Pipelined(ctx, func(pipe redis.Pipeliner) error {
_, err = tx.TxPipelined(ctx, func(pipe redis.Pipeliner) error {
pipe.LTrim(ctx, key, int64(len(vals)), -1)
pipe.LPush(ctx, key, marshalSlice(pos, id, size, 0, size))
for i := skipped; i > 0; i-- {
Expand Down
7 changes: 5 additions & 2 deletions pkg/meta/slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,13 @@ func buildSlice(ss []*slice) []Slice {
func compactChunk(ss []*slice) (uint32, uint32, []Slice) {
var chunk = buildSlice(ss)
var pos uint32
if len(chunk) > 0 && chunk[0].Id == 0 {
pos = chunk[0].Len
for len(chunk) > 1 && chunk[0].Id == 0 {
pos += chunk[0].Len
chunk = chunk[1:]
}
if len(chunk) == 1 && chunk[0].Id == 0 {
chunk[0].Len = 1
}
var size uint32
for _, c := range chunk {
size += c.Len
Expand Down
13 changes: 12 additions & 1 deletion pkg/meta/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -2048,7 +2048,8 @@ func (m *dbMeta) Write(ctx Context, inode Ino, indx uint32, off uint32, slice Sl
}
_, err = s.Cols("length", "mtime", "ctime").Update(&n, &node{Inode: inode})
if err == nil {
needCompact = (len(ck.Slices)/sliceBytes)%100 == 99
ns := len(ck.Slices) / sliceBytes // number of slices
needCompact = ns%100 == 99 || ns > 350
}
return err
}, inode)
Expand Down Expand Up @@ -2383,18 +2384,28 @@ func (m *dbMeta) compactChunk(inode Ino, indx uint32, force bool) {
if err != nil {
return
}
if len(c.Slices) > sliceBytes*maxCompactSlices {
c.Slices = c.Slices[:sliceBytes*maxCompactSlices]
}

ss := readSliceBuf(c.Slices)
if ss == nil {
logger.Errorf("Corrupt value for inode %d chunk indx %d", inode, indx)
return
}
skipped := skipSome(ss)
var first, last *slice
if skipped > 0 {
first, last = ss[0], ss[skipped-1]
}
ss = ss[skipped:]
pos, size, slices := compactChunk(ss)
if len(ss) < 2 || size == 0 {
return
}
if first != nil && last != nil && pos+size > first.pos && last.pos+last.len > pos {
panic(fmt.Sprintf("invalid compaction: skipped slices [%+v, %+v], pos %d, size %d", *first, *last, pos, size))
}

var id uint64
st := m.NewSlice(Background, &id)
Expand Down
16 changes: 12 additions & 4 deletions pkg/meta/tkv.go
Original file line number Diff line number Diff line change
Expand Up @@ -1716,7 +1716,8 @@ func (m *kvMeta) Write(ctx Context, inode Ino, indx uint32, off uint32, slice Sl
attr.Ctimensec = uint32(now.Nanosecond())
val := tx.append(m.chunkKey(inode, indx), marshalSlice(off, slice.Id, slice.Size, slice.Off, slice.Len))
tx.set(m.inodeKey(inode), m.marshal(&attr))
needCompact = (len(val)/sliceBytes)%100 == 99
ns := len(val) / sliceBytes // number of slices
needCompact = ns%100 == 99 || ns > 350
return nil
}, inode)
if err == nil {
Expand Down Expand Up @@ -2025,21 +2026,28 @@ func (m *kvMeta) compactChunk(inode Ino, indx uint32, force bool) {
if err != nil {
return
}

if len(buf) > sliceBytes*100 {
buf = buf[:sliceBytes*100]
if len(buf) > sliceBytes*maxCompactSlices {
buf = buf[:sliceBytes*maxCompactSlices]
}

ss := readSliceBuf(buf)
if ss == nil {
logger.Errorf("Corrupt value for inode %d chunk indx %d", inode, indx)
return
}
skipped := skipSome(ss)
var first, last *slice
if skipped > 0 {
first, last = ss[0], ss[skipped-1]
}
ss = ss[skipped:]
pos, size, slices := compactChunk(ss)
if len(ss) < 2 || size == 0 {
return
}
if first != nil && last != nil && pos+size > first.pos && last.pos+last.len > pos {
panic(fmt.Sprintf("invalid compaction: skipped slices [%+v, %+v], pos %d, size %d", *first, *last, pos, size))
}

var id uint64
st := m.NewSlice(Background, &id)
Expand Down
1 change: 1 addition & 0 deletions pkg/meta/tkv_etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ func newEtcdClient(addr string) (tkvClient, error) {
if err != nil {
return nil, err
}
maxCompactSlices = 100
var prefix string = u.Path + "\xFD"
return withPrefix(&etcdClient{c, etcd.NewKV(c)}, []byte(prefix)), nil
}
Expand Down
Loading
Loading