Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Juicedata
JuiceFS
提交
c1a1c095
JuiceFS
项目概览
Juicedata
/
JuiceFS
通知
10
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
JuiceFS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
c1a1c095
编写于
6月 21, 2021
作者:
D
Davies Liu
提交者:
GitHub
6月 21, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
meta/sql: Fix returned inode from Rename and locks (#543)
* fix returned inode in Rename() * fix locks with mysql
上级
21040863
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
34 addition
and
5 deletion
+34
-5
pkg/meta/redis.go
pkg/meta/redis.go
+3
-0
pkg/meta/redis_test.go
pkg/meta/redis_test.go
+5
-5
pkg/meta/sql.go
pkg/meta/sql.go
+3
-0
pkg/meta/sql_test.go
pkg/meta/sql_test.go
+11
-0
pkg/meta/sql_unix.go
pkg/meta/sql_unix.go
+12
-0
未找到文件。
pkg/meta/redis.go
浏览文件 @
c1a1c095
...
...
@@ -1611,6 +1611,9 @@ func (r *redisMeta) Rename(ctx Context, parentSrc Ino, nameSrc string, parentDst
sattr
.
Nlink
--
dattr
.
Nlink
++
}
if
inode
!=
nil
{
*
inode
=
ino
}
if
attr
!=
nil
{
*
attr
=
iattr
}
...
...
pkg/meta/redis_test.go
浏览文件 @
c1a1c095
...
...
@@ -281,14 +281,14 @@ func testMetaClient(t *testing.T, m Meta) {
if
st
:=
GetSummary
(
m
,
ctx
,
1
,
&
summary
);
st
!=
0
{
t
.
Fatalf
(
"summary: %s"
,
st
)
}
expected
:=
Summary
{
Length
:
2
02
,
Size
:
20480
,
Files
:
3
,
Dirs
:
2
}
expected
:=
Summary
{
Length
:
4
02
,
Size
:
20480
,
Files
:
3
,
Dirs
:
2
}
if
summary
!=
expected
{
t
.
Fatalf
(
"summary %+v not equal to expected: %+v"
,
summary
,
expected
)
}
if
st
:=
GetSummary
(
m
,
ctx
,
inode
,
&
summary
);
st
!=
0
{
t
.
Fatalf
(
"summary: %s"
,
st
)
}
expected
=
Summary
{
Length
:
4
02
,
Size
:
24576
,
Files
:
4
,
Dirs
:
2
}
expected
=
Summary
{
Length
:
6
02
,
Size
:
24576
,
Files
:
4
,
Dirs
:
2
}
if
summary
!=
expected
{
t
.
Fatalf
(
"summary %+v not equal to expected: %+v"
,
summary
,
expected
)
}
...
...
@@ -472,10 +472,10 @@ func testLocks(t *testing.T, m Meta) {
time
.
Sleep
(
time
.
Millisecond
)
count
--
if
count
>
0
{
logger
.
Error
f
(
"count should be be zero but got %d"
,
count
)
logger
.
Fatal
f
(
"count should be be zero but got %d"
,
count
)
}
if
st
:=
m
.
Setlk
(
ctx
,
inode
,
uint64
(
i
),
false
,
syscall
.
F_UNLCK
,
0
,
0xFFFF
,
uint32
(
i
));
st
!=
0
{
logger
.
Error
f
(
"plock unlock: %s"
,
st
)
logger
.
Fatal
f
(
"plock unlock: %s"
,
st
)
err
=
st
}
}(
i
)
...
...
@@ -759,7 +759,7 @@ func testTruncateAndDelete(t *testing.T, m Meta) {
var
ss
[]
Slice
m
.
ListSlices
(
ctx
,
&
ss
,
false
)
if
len
(
ss
)
!=
1
{
t
.
Fatalf
(
"number of chunks: %d !=
3
, %+v"
,
len
(
ss
),
ss
)
t
.
Fatalf
(
"number of chunks: %d !=
1
, %+v"
,
len
(
ss
),
ss
)
}
m
.
Close
(
ctx
,
inode
)
if
st
:=
m
.
Unlink
(
ctx
,
1
,
"f"
);
st
!=
0
{
...
...
pkg/meta/sql.go
浏览文件 @
c1a1c095
...
...
@@ -1385,6 +1385,9 @@ func (m *dbMeta) Rename(ctx Context, parentSrc Ino, nameSrc string, parentDst In
spn
.
Nlink
--
dpn
.
Nlink
++
}
if
inode
!=
nil
{
*
inode
=
sn
.
Inode
}
m
.
parseAttr
(
&
sn
,
attr
)
if
n
,
err
:=
s
.
Delete
(
&
edge
{
Parent
:
parentSrc
,
Name
:
se
.
Name
});
err
!=
nil
{
...
...
pkg/meta/sql_test.go
浏览文件 @
c1a1c095
...
...
@@ -60,7 +60,18 @@ func TestMySQLClient(t *testing.T) {
m
.
engine
.
DropTables
(
&
sustained
{})
m
.
engine
.
DropTables
(
&
xattr
{})
m
.
engine
.
DropTables
(
&
delfile
{})
m
.
engine
.
DropTables
(
&
flock
{})
m
.
engine
.
DropTables
(
&
plock
{})
testTruncateAndDelete
(
t
,
m
)
testMetaClient
(
t
,
m
)
testStickyBit
(
t
,
m
)
testLocks
(
t
,
m
)
testConcurrentWrite
(
t
,
m
)
testCompaction
(
t
,
m
)
testCopyFileRange
(
t
,
m
)
m
.
conf
.
CaseInsensi
=
true
testCaseIncensi
(
t
,
m
)
}
func
TestStickyBitSQL
(
t
*
testing
.
T
)
{
...
...
pkg/meta/sql_unix.go
浏览文件 @
c1a1c095
...
...
@@ -35,6 +35,12 @@ func (m *dbMeta) Flock(ctx Context, inode Ino, owner uint64, ltype uint32, block
var
err
syscall
.
Errno
for
{
err
=
errno
(
m
.
txn
(
func
(
s
*
xorm
.
Session
)
error
{
if
exists
,
err
:=
s
.
Get
(
&
node
{
Inode
:
inode
});
err
!=
nil
||
!
exists
{
if
err
==
nil
&&
!
exists
{
err
=
syscall
.
ENOENT
}
return
err
}
rows
,
err
:=
s
.
Rows
(
&
flock
{
Inode
:
inode
})
if
err
!=
nil
{
return
err
...
...
@@ -143,6 +149,12 @@ func (m *dbMeta) Setlk(ctx Context, inode Ino, owner uint64, block bool, ltype u
lock
:=
plockRecord
{
ltype
,
pid
,
start
,
end
}
for
{
err
=
errno
(
m
.
txn
(
func
(
s
*
xorm
.
Session
)
error
{
if
exists
,
err
:=
s
.
Get
(
&
node
{
Inode
:
inode
});
err
!=
nil
||
!
exists
{
if
err
==
nil
&&
!
exists
{
err
=
syscall
.
ENOENT
}
return
err
}
if
ltype
==
syscall
.
F_UNLCK
{
var
l
=
plock
{
Inode
:
inode
,
Owner
:
owner
,
Sid
:
m
.
sid
}
ok
,
err
:=
m
.
engine
.
Get
(
&
l
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录