This is an automated email from the ASF dual-hosted git repository.
casion pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-linkis-website.git
The following commit(s) were added to refs/heads/dev by this push:
new b64f6b5e34 fix image (#444)
b64f6b5e34 is described below
commit b64f6b5e34555118cb26df0e1b7e9f788fa72bd4
Author: Casion <[email protected]>
AuthorDate: Tue Jul 19 22:02:13 2022 +0800
fix image (#444)
---
.../context_service/content_service_cleanup.md | 37 ++++++++++++----------
1 file changed, 21 insertions(+), 16 deletions(-)
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/architecture/public_enhancement_services/context_service/content_service_cleanup.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/architecture/public_enhancement_services/context_service/content_service_cleanup.md
index 5271daea33..a7927748d9 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/architecture/public_enhancement_services/context_service/content_service_cleanup.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/architecture/public_enhancement_services/context_service/content_service_cleanup.md
@@ -1,31 +1,35 @@
---
-title: ContextService 清理接口特性
+title: CS 清理接口特性
sidebar_position: 7
tags: [Feature]
---
## 1. 功能需求
### 1.1 背景
-Linkis
ContextService统一上下文服务目前缺少清理机制,且缺少创建时间、更新时间字段以及批量清理的接口,在长期累积情况下可能出现百万级数据影响查询效率。
+1.1.3版本前,ContextService 统一上下文服务缺少清理机制,且缺少创建时间、更新时间字段以及批量清理的接口,
+在长期累积情况下可能出现百万级数据,影响查询效率。
+
### 1.2 目标
-- 修改ContextService底层库表,添加创建时间、修改时间、最后访问时间字段,完成ContextID和ContextMap相关数据的更新时间入库
-- 添加清理清理的restful接口,支持按照时间范围、按照id列表的批零清理接口
-- 添加对应的cs-client的java sdk接口
+-
修改1ContextService`底层库表,添加创建时间、修改时间、最后访问时间字段,完成`ContextID`和`ContextMap`相关数据的更新时间入库
+- 添加清理清理的`restful`接口,支持按照时间范围、按照id列表的批零清理接口
+- 添加对应的`cs-client`的`java sdk`接口
## 2. 总体设计
-本次需求涉及ContextService下的cs-client、cs-persistence以及cs-server模块。在cs-persistence模块添加已有表的3个字段;在cs-server模块添加3个restful接口,在cs-client模块添加3个sdk
api。
+本次需求涉及`ContextService`下的`cs-client`、`cs-persistence`以及`cs-server`模块。
+在`cs-persistence`模块添加已有表的3个字段;在`cs-server`模块添加3个`restful`接口,在`cs-client`模块添加3个`sdk
api`。
### 2.1 技术架构
-ContextService整体架构可参考已有文档:
[ContextService架构文档](https://linkis.apache.org/zh-CN/docs/latest/architecture/public_enhancement_services/context_service/overview
"ContextService架构文档")
+ContextService 整体架构可参考已有文档: [ContextService架构文档](overview.md)
ContestService各模块访问关系如下图所示
-
+
- 表变更均在cs-persistence模块。此次变更涉及5张表`context_id、 context_map 、context_id_listener
、context_key_listener 、
context_history`表,均需要添加`create_time,update_time,access_time` 3个字段。其中`context_id
、context_map` 表已启用,其它3张表未启用。`create_time`
在persistence模块执行insert操作前,添加时间。`update_time` 和 `access_time`
由上游接口主动调用,在update接口中,`update_time` 和 `access_time` 互斥更新,即当`access_time`
存在(不为null)则不更新`update_time`,否则更新update_time。
+ 表变更均在`cs-persistence`模块。此次变更涉及5张表`context_id、 context_map
、context_id_listener 、context_key_listener 、
context_history`表,均需要添加`create_time,update_time,access_time` 3个字段。其中`context_id
、context_map` 表已启用,其它3张表未启用。`create_time`
在persistence模块执行insert操作前,添加时间。`update_time` 和 `access_time`
由上游接口主动调用,在update接口中,`update_time` 和 `access_time` 互斥更新,即当`access_time`
存在(不为null)则不更新`update_time`,否则更新update_time。
-`update_time`字段更新在cs-cache模块中,检测到从db加载新的`context_id`时的ADD消息,此时同步`access_time`
到db。表中仅记录`context_id`
表的`create_time、update_time、access_time`。后续搜索清理,也是从context_id 表进行清理。
+`update_time`字段更新在cs-cache模块中,检测到从db加载新的`context_id`时的ADD消息,此时同步`access_time`
到db。
+表中仅记录`context_id` 表的`create_time、update_time、access_time`。后续搜索清理,也是从context_id
表进行清理。
增加3个清理相关接口:`searchContextIDByTime、clearAllContextByID、clearAllContextByTime`
- `searchContextIDByTime`按照3个时间起止范围搜索,返回contextID列表
@@ -35,11 +39,11 @@ ContestService各模块访问关系如下图所示
###2.2 业务架构
此次特性是给ContextService服务增加批量查询和清理的相关接口,以及增加底层数据表的更新时间等字段,便于根据访问情况清理过期数据。功能点涉及模块如下表。
-| 组件名 | 一级模块 | 二级模块 | 功能点 |
-| :------------ | :------------ | :------------ | :------------ |
-| Linkis | linkis-ps-cs | cs-client | 增加批量清理接口相关java sdk api接口 |
-| Linkis | Linkis-ps-cs | cs-server | 增加批量清理接口相关restful接口 |
-| Linkis | linkis-ps-cs | cs-persistence | 增加底层表的3个时间相关字段 |
+| 一级模块 | 二级模块 | 功能点 |
+| :------------ | :------------ | :------------ |
+| linkis-ps-cs | cs-client | 增加批量清理接口相关java sdk api接口 |
+| Linkis-ps-cs | cs-server | 增加批量清理接口相关restful接口 |
+| linkis-ps-cs | cs-persistence | 增加底层表的3个时间相关字段 |
##3. 模块设计
@@ -49,8 +53,9 @@ ContestService各模块访问关系如下图所示
- 根据时间查询ContextID。用户查询对应时间范围的ContextID,仅会返回haid字符串列表。此接口有分页,默认仅限5000条数据
- 批量清理ContextID。会批量清理传入的idList对应的所有contextMap数据和contextID数据。传入数组最大5000条
- 查询并清理ContextID,先查询再批量清理
+
上述对应时序图如下:
-
+
其中有两处需要额外注意:
①cs-server服务中restful api,会将请求封装成Job提交到队列并阻塞等待结果。新定义了CLEAR 的操作类型,便于匹配到清理相关接口。
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]