feat: Add cluster-level CCR sync and dynamic monitor interval configuration#636
Open
LemonCL wants to merge 43 commits intoselectdb:devfrom
Open
feat: Add cluster-level CCR sync and dynamic monitor interval configuration#636LemonCL wants to merge 43 commits intoselectdb:devfrom
LemonCL wants to merge 43 commits intoselectdb:devfrom
Conversation
…ration This commit introduces cluster-level CCR synchronization functionality and dynamic monitor interval configuration capabilities. 1. **Cluster-level CCR Sync** - Add `ClusterSync` parameter to `CreateCcrRequest` - Implement `createClusterCcr()` function for cluster-wide database sync - Add automatic database monitoring with `startDatabaseMonitor()` - Support dynamic detection of new/deleted databases - Auto-create/remove sync tasks for database changes 2. **Dynamic Monitor Interval Configuration** - Add `/update_monitor_interval` HTTP endpoint - Add `/get_monitor_interval` HTTP endpoint - Support runtime modification of database monitoring frequency - Implement thread-safe interval updates using channels - `POST /update_monitor_interval` - Update monitoring interval - `GET /get_monitor_interval` - Get current monitoring interval - All existing single-database sync functionality remains unchanged - New `cluster_sync` parameter defaults to `false` - Thread-safe implementation using `sync.RWMutex` - Non-blocking channel communication for interval updates - Comprehensive error handling and retry mechanisms - Detailed logging for observability
feat: Add cluster-level CCR sync and dynamic monitor interval configuration This commit introduces cluster-level CCR synchronization functionality and dynamic monitor interval configuration capabilities. 1. **Cluster-level CCR Sync** - Add `ClusterSync` parameter to `CreateCcrRequest` - Implement `createClusterCcr()` function for cluster-wide database sync - Add automatic database monitoring with `startDatabaseMonitor()` - Support dynamic detection of new/deleted databases - Auto-create/remove sync tasks for database changes 2. **Dynamic Monitor Interval Configuration** - Add `/update_monitor_interval` HTTP endpoint - Add `/get_monitor_interval` HTTP endpoint - Support runtime modification of database monitoring frequency - Implement thread-safe interval updates using channels 3. **Performance Optimizations** - Optimize lock usage in `startDatabaseMonitor()` - Replace frequent lock operations with channel communication - Reduce lock contention and improve monitoring performance - `POST /update_monitor_interval` - Update monitoring interval - `GET /get_monitor_interval` - Get current monitoring interval - All existing single-database sync functionality remains unchanged - New `cluster_sync` parameter defaults to `false` - Thread-safe implementation using `sync.RWMutex` - Non-blocking channel communication for interval updates - Comprehensive error handling and retry mechanisms - Detailed logging for observability Closes: #[issue_number] docs: Add documentation for cluster CCR sync feature
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
功能概述
本PR为CCR Syncer添加了集群级别同步功能和动态监控间隔配置功能。
主要更改
新增API端点
POST /update_monitor_interval- 更新监控间隔GET /get_monitor_interval- 获取当前监控间隔向后兼容性
cluster_sync默认为false1. 集群级别CCR同步
2. 动态监控间隔配置
API 接口
创建集群级同步任务
接口:
POST /create_ccr请求参数:
{ "name": "cluster_sync_job", "src": { "host": "source-cluster-host", "port": 9030, "user": "root", "password": "password", "database": "" }, "dest": { "host": "dest-cluster-host", "port": 9030, "user": "root", "password": "password", "database": "" }, "cluster_sync": true }参数说明:
cluster_sync: 设置为true启用集群级同步name: 同步任务的基础名称,实际任务名会加上数据库名后缀src/dest: 源集群和目标集群的连接信息响应示例:
{ "success": true }更新监控间隔
接口:
POST /update_monitor_interval请求参数:
{ "interval_seconds": 300 }参数说明:
interval_seconds: 监控间隔时间(秒),必须大于0响应示例:
{ "success": true }获取当前监控间隔
接口:
GET /get_monitor_interval响应示例:
{ "success": true, "interval_seconds": 120 }