MCPcopy
hub / github.com/XiaoMi/Gaea

github.com/XiaoMi/Gaea @v2.4.2 sqlite

repository ↗ · DeepWiki ↗ · release v2.4.2 ↗
4,442 symbols 16,292 edges 329 files 2,577 documented · 58%
README

LICENSE Build Status Go Report Card

简介

Gaea是小米中国区电商研发部研发的基于mysql协议的数据库中间件,目前在小米商城大陆和海外得到广泛使用,包括订单、社区、活动等多个业务。Gaea支持分库分表、sql路由、读写分离等基本特性,更多详细功能可以参照下面的功能列表。其中分库分表方案兼容了mycat和kingshard两个项目的路由方式。Gaea在设计、实现阶段参照了mycat、kingshard和vitess,并使用tidb parser作为内置的sql parser,在此表达诚挚感谢。为了方便使用和学习Gaea,我们也提供了详细的使用和设计文档,也欢迎大家多多参与。

功能列表

基础功能

  • 多集群
  • 多租户
  • SQL透明转发
  • 慢SQL指纹
  • 错误SQL指纹
  • 注解路由
  • 慢日志
  • 读写分离,从库负载均衡
  • 自定义SQL拦截与过滤
  • 连接池
  • 配置热加载
  • IP/IP段白名单
  • 全局序列号

分库、分表功能

  • 分库: 支持mycat分库方式
  • 分表: 支持kingshard分表方式
  • 聚合函数: 支持max、min、sum、count、group by、order by等
  • join: 支持分片表和全局表的join、支持多个分片表但是路由规则相同的join

架构图

gaea架构图

集群部署图

gaea集群部署图

如上图所示, 部署一套gaea-cc和etcd可用来管理多套gaea集群, 负责集群内namespace配置的增删改查. gaea-cc的HTTP接口文档

安装使用

设计与实现

性能测试

Roadmap

  • [x] 支持配置加密存储,开关
  • [ ] 支持执行计划缓存
  • [ ] 支持事务追踪
  • [ ] 支持二级索引
  • [ ] 支持分布式事务
  • [ ] 支持平滑的扩容、缩容
  • [ ] 后端连接池优化 (按照请求时间排队)

自有开发模块

  • backend
  • cmd
  • log
  • models
  • proxy/plan
  • proxy/router(kingshard路由方式源自kingshard项目本身)
  • proxy/sequence
  • server

外部模块

  • mysql(google vitess、tidb、kingshard都有引入)
  • parser(tidb)
  • stats(google vitess,打点统计)
  • util(混合)

社区

gitter

Gitter

飞书

飞书

Extension points exported contracts — how you extend this code

Visitor (Interface)
Visitor visits a Node. [12 implementers]
parser/ast/ast.go
Formatter (Interface)
Formatter is an io.Writer extended formatter by a fmt.Printf like function Format. [28 implementers]
parser/format/format.go
Logger (Interface)
Logger is the log interface [6 implementers]
log/logger.go
CountTracker (Interface)
CountTracker defines the interface that needs to be supported by a variable for being tracked by Rates. [6 implementers]
stats/rates.go
Variable (Interface)
Variable is the minimal interface which each type in this "stats" package must implement. When integrating the Vitess st [8 …
stats/variable_interface.go
Resource (Interface)
Resource defines the interface that every resource must provide. Thread synchronization between Close() and IsClosed() i [32 …
util/resource_pool.go
AggregateFuncMerger (Interface)
AggregateFuncMerger is the merger of aggregate function [5 implementers]
proxy/plan/merge_result.go
Value (Interface)
Value is the interface values that go into LRUCache need to satisfy [5 implementers]
util/cache/lru_cache.go

Core symbols most depended-on inside this repo

Errorf
called by 1071
parser/parser.go
Equal
called by 706
parser/terror/terror.go
WriteKeyWord
called by 447
parser/format/format.go
ExpectNoError
called by 427
tests/e2e/util/expect.go
WritePlain
called by 290
parser/format/format.go
Restore
called by 242
parser/ast/ast.go
New
called by 227
parser/terror/terror.go
String
called by 226
stats/variable_interface.go

Shape

Method 2,107
Function 1,775
Struct 442
TypeAlias 70
Interface 36
FuncType 12

Languages

Go100%

Modules by API surface

parser/tidb-types/time.go121 symbols
parser/tidb-types/datum.go116 symbols
parser/ast/misc.go109 symbols
parser/ast/dml.go99 symbols
parser/ast/expressions.go97 symbols
parser/ast/ddl.go92 symbols
proxy/server/manager.go87 symbols
proxy/server/executor.go72 symbols
parser/parser_test.go70 symbols
proxy/router/rule.go68 symbols
parser/model/model.go63 symbols
proxy/plan/plan_select.go54 symbols

Dependencies from manifests, versioned

github.com/StackExchange/wmiv1.2.1 · 1×
github.com/bytedance/mockeyv1.2.10 · 1×
github.com/coreos/bboltv1.3.2 · 1×
github.com/coreos/etcdv3.3.13+incompatible · 1×
github.com/coreos/go-semverv0.2.0 · 1×
github.com/coreos/go-systemdv0.0.0-2018101212300 · 1×
github.com/coreos/pkgv0.0.0-2016072723371 · 1×
github.com/cznic/golexv0.0.0-2018112210185 · 1×
github.com/cznic/mathutilv0.0.0-2018112210185 · 1×
github.com/cznic/parserv0.0.0-2018112210185 · 1×
github.com/cznic/sortutilv0.0.0-2018112210185 · 1×
github.com/cznic/strutilv0.0.0-2018112210185 · 1×

For agents

$ claude mcp add Gaea \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact