feat: 异步同步知识库分块检索索引
This commit is contained in:
@@ -376,6 +376,13 @@ rag:
|
||||
username: easyflowadmin
|
||||
password: easyflowadmin123
|
||||
autoCreateCollection: true
|
||||
poolMaxTotal: 8
|
||||
poolMaxTotalPerKey: 8
|
||||
poolMaxIdlePerKey: 4
|
||||
poolMinIdlePerKey: 1
|
||||
poolMaxWaitMillis: 3000
|
||||
poolEvictionIntervalMillis: 60000
|
||||
poolMinEvictableIdleMillis: 300000
|
||||
# 搜索引擎配置
|
||||
searcher:
|
||||
lucene:
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
ALTER TABLE `tb_document_chunk`
|
||||
ADD COLUMN `index_sync_status` varchar(16) NOT NULL DEFAULT 'SYNCED'
|
||||
COMMENT '检索索引同步状态' AFTER `options`,
|
||||
ADD COLUMN `index_sync_version` bigint UNSIGNED NOT NULL DEFAULT 0
|
||||
COMMENT '检索索引同步版本' AFTER `index_sync_status`,
|
||||
ADD COLUMN `index_sync_error_code` varchar(64) NULL DEFAULT NULL
|
||||
COMMENT '脱敏同步错误码' AFTER `index_sync_version`,
|
||||
ADD COLUMN `index_sync_error_message` varchar(255) NULL DEFAULT NULL
|
||||
COMMENT '脱敏同步错误摘要' AFTER `index_sync_error_code`,
|
||||
ADD KEY `idx_document_chunk_sync_filter`
|
||||
(`document_collection_id`, `index_sync_status`, `id`);
|
||||
|
||||
CREATE TABLE `tb_document_chunk_sync_task`
|
||||
(
|
||||
`id` bigint UNSIGNED NOT NULL COMMENT '主键',
|
||||
`chunk_id` bigint UNSIGNED NOT NULL COMMENT '分块ID',
|
||||
`document_id` bigint UNSIGNED NOT NULL COMMENT '文档ID',
|
||||
`document_collection_id` bigint UNSIGNED NOT NULL COMMENT '知识库ID',
|
||||
`vector_collection` varchar(128) NULL DEFAULT NULL COMMENT '向量集合名',
|
||||
`operation` varchar(16) NOT NULL COMMENT 'UPSERT/DELETE',
|
||||
`sync_version` bigint UNSIGNED NOT NULL COMMENT '同步版本',
|
||||
`status` varchar(16) NOT NULL DEFAULT 'PENDING'
|
||||
COMMENT 'PENDING/RUNNING/SUCCEEDED/FAILED/SUPERSEDED',
|
||||
`attempt_count` int NOT NULL DEFAULT 0 COMMENT '已尝试次数',
|
||||
`next_retry_at` datetime(3) NOT NULL COMMENT '下次执行时间',
|
||||
`last_dispatched_at` datetime(3) NULL DEFAULT NULL COMMENT '最近投递时间',
|
||||
`execution_token` varchar(64) NULL DEFAULT NULL COMMENT '执行令牌',
|
||||
`lease_until` datetime(3) NULL DEFAULT NULL COMMENT '租约截止时间',
|
||||
`error_code` varchar(64) NULL DEFAULT NULL COMMENT '脱敏错误码',
|
||||
`error_message` varchar(255) NULL DEFAULT NULL COMMENT '脱敏错误摘要',
|
||||
`created` datetime(3) NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`created_by` bigint UNSIGNED NULL DEFAULT NULL COMMENT '创建人',
|
||||
`modified` datetime(3) NULL DEFAULT NULL COMMENT '修改时间',
|
||||
`modified_by` bigint UNSIGNED NULL DEFAULT NULL COMMENT '修改人',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE KEY `uk_document_chunk_sync_version`
|
||||
(`chunk_id`, `sync_version`, `operation`),
|
||||
KEY `idx_document_chunk_sync_due`
|
||||
(`status`, `next_retry_at`, `last_dispatched_at`, `id`),
|
||||
KEY `idx_document_chunk_sync_lease`
|
||||
(`status`, `lease_until`, `id`),
|
||||
KEY `idx_document_chunk_sync_chunk`
|
||||
(`chunk_id`, `sync_version`, `status`)
|
||||
) ENGINE = InnoDB
|
||||
CHARACTER SET = utf8mb4
|
||||
COLLATE = utf8mb4_0900_ai_ci
|
||||
COMMENT = '文档分块检索索引同步任务'
|
||||
ROW_FORMAT = DYNAMIC;
|
||||
Reference in New Issue
Block a user