Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
SkyWalking
提交
a68503b3
S
SkyWalking
项目概览
apache
/
SkyWalking
上一次同步 1 年多
通知
302
Star
21345
Fork
6091
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SkyWalking
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
a68503b3
编写于
10月 25, 2021
作者:
wu-sheng
提交者:
GitHub
10月 25, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix unexpected deleting due to TTL mechanism bug (#8000)
上级
1ee9ce0a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
18 addition
and
3 deletion
+18
-3
CHANGES.md
CHANGES.md
+1
-0
oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2HistoryDeleteDAO.java
...server/storage/plugin/jdbc/h2/dao/H2HistoryDeleteDAO.java
+9
-2
oap-server/server-storage-plugin/storage-tidb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/tidb/TiDBHistoryDeleteDAO.java
...server/storage/plugin/jdbc/tidb/TiDBHistoryDeleteDAO.java
+8
-1
未找到文件。
CHANGES.md
浏览文件 @
a68503b3
...
...
@@ -50,6 +50,7 @@ Release Notes.
*
Support search browser service.
*
Add
`getProfileTaskLogs`
to profile query protocol.
*
Set
`SW_KAFKA_FETCHER_ENABLE_NATIVE_PROTO_LOG`
,
`SW_KAFKA_FETCHER_ENABLE_NATIVE_JSON_LOG`
default
`true`
.
*
Fix unexpected deleting due to TTL mechanism bug for H2, MySQL, TiDB and PostgreSQL.
#### UI
...
...
oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2HistoryDeleteDAO.java
浏览文件 @
a68503b3
...
...
@@ -39,28 +39,35 @@ public class H2HistoryDeleteDAO implements IHistoryDeleteDAO {
@Override
public
void
deleteHistory
(
Model
model
,
String
timeBucketColumnName
,
int
ttl
)
throws
IOException
{
SQLBuilder
dataDeleteSQL
=
new
SQLBuilder
(
"delete from "
+
model
.
getName
()
+
" where "
)
.
append
(
timeBucketColumnName
).
append
(
"<= ? "
);
.
append
(
timeBucketColumnName
).
append
(
"<= ? "
)
.
append
(
" and "
)
.
append
(
timeBucketColumnName
).
append
(
">= ? "
);
try
(
Connection
connection
=
client
.
getConnection
())
{
long
deadline
;
long
minTime
;
if
(
model
.
isRecord
())
{
deadline
=
Long
.
parseLong
(
new
DateTime
().
plusDays
(-
ttl
).
toString
(
"yyyyMMddHHmmss"
));
minTime
=
1000_00_00_00_00_00L
;
}
else
{
switch
(
model
.
getDownsampling
())
{
case
Minute:
deadline
=
Long
.
parseLong
(
new
DateTime
().
plusDays
(-
ttl
).
toString
(
"yyyyMMddHHmm"
));
minTime
=
1000_00_00_00_00L
;
break
;
case
Hour:
deadline
=
Long
.
parseLong
(
new
DateTime
().
plusDays
(-
ttl
).
toString
(
"yyyyMMddHH"
));
minTime
=
1000_00_00_00L
;
break
;
case
Day:
deadline
=
Long
.
parseLong
(
new
DateTime
().
plusDays
(-
ttl
).
toString
(
"yyyyMMdd"
));
minTime
=
1000_00_00L
;
break
;
default
:
return
;
}
}
client
.
executeUpdate
(
connection
,
dataDeleteSQL
.
toString
(),
deadline
);
client
.
executeUpdate
(
connection
,
dataDeleteSQL
.
toString
(),
deadline
,
minTime
);
}
catch
(
JDBCClientException
|
SQLException
e
)
{
throw
new
IOException
(
e
.
getMessage
(),
e
);
}
...
...
oap-server/server-storage-plugin/storage-tidb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/tidb/TiDBHistoryDeleteDAO.java
浏览文件 @
a68503b3
...
...
@@ -40,28 +40,35 @@ public class TiDBHistoryDeleteDAO implements IHistoryDeleteDAO {
public
void
deleteHistory
(
Model
model
,
String
timeBucketColumnName
,
int
ttl
)
throws
IOException
{
SQLBuilder
dataDeleteSQL
=
new
SQLBuilder
(
"delete from "
+
model
.
getName
()
+
" where "
)
.
append
(
timeBucketColumnName
).
append
(
"<= ? "
)
.
append
(
" and "
)
.
append
(
timeBucketColumnName
).
append
(
">= ? "
)
.
append
(
" limit 10000"
);
try
(
Connection
connection
=
client
.
getConnection
())
{
long
deadline
;
long
minTime
;
if
(
model
.
isRecord
())
{
deadline
=
Long
.
parseLong
(
new
DateTime
().
plusDays
(-
ttl
).
toString
(
"yyyyMMddHHmmss"
));
minTime
=
1000_00_00_00_00_00L
;
}
else
{
switch
(
model
.
getDownsampling
())
{
case
Minute:
deadline
=
Long
.
parseLong
(
new
DateTime
().
plusDays
(-
ttl
).
toString
(
"yyyyMMddHHmm"
));
minTime
=
1000_00_00_00_00L
;
break
;
case
Hour:
deadline
=
Long
.
parseLong
(
new
DateTime
().
plusDays
(-
ttl
).
toString
(
"yyyyMMddHH"
));
minTime
=
1000_00_00_00L
;
break
;
case
Day:
deadline
=
Long
.
parseLong
(
new
DateTime
().
plusDays
(-
ttl
).
toString
(
"yyyyMMdd"
));
minTime
=
1000_00_00L
;
break
;
default
:
return
;
}
}
while
(
client
.
executeUpdate
(
connection
,
dataDeleteSQL
.
toString
(),
deadline
)
>
0
)
{
while
(
client
.
executeUpdate
(
connection
,
dataDeleteSQL
.
toString
(),
deadline
,
minTime
)
>
0
)
{
}
}
catch
(
JDBCClientException
|
SQLException
e
)
{
throw
new
IOException
(
e
.
getMessage
(),
e
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录