Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Database governance-BadConnectionEvictionRule CRD for database connection pool | 数据库治理-异常连接剔除 #18

Open
sczyh30 opened this issue Jul 27, 2022 · 0 comments
Labels
area/database-governance Category issues or PRs related to database governance kind/spec-RFC Issues or PRs for OpenSergo spec RFC

Comments

@sczyh30
Copy link
Member

sczyh30 commented Jul 27, 2022

domain: database

Umbrella issue: #15

BadConnectionEvictionRule defines how to handle the "bad" connections in the database connection pool.

(English version TBD...)


BadConnectionEvictionRule 定义了数据库连接池中针对异常连接的处理规则,其中连接“异常”的判断、处理条件与行为均在该规则中定义:

  • TargetErrors: 针对哪些错误算作“异常连接”,这里面可能要细分错误类型(Java 中可类比异常, Go 里面类比 Error)、信息或错误码
  • Condition: 驱逐条件,有几种类型:任何出现(AnyOccurrence)、连续出现 n 次(ConsecutiveOccurrence)、单位时间内出现 n 次
  • EvictionAction: 驱逐动作,有几种类型:仅剔除 (RemoveOnly)、剔除后替换 (ReplaceWithNew)

以下 YAML 描述了一个异常连接处理规则。该规则将错误码为 1040, 1042, 1043, 1047 的 SQL 访问,以及 com.mysql.jdbc.CommunicationsException 异常类型定义为“异常”;连接的驱逐条件为该连接中出现任意上述错误码或异常;驱逐动作为将该连接剔除后替换为新的连接。YAML 示例:

apiVersion: database.opensergo.io/v1alpha1
kind: BadConnectionEvictionRule
metadata:
  name: my-bad-connection-goaway-rule
  labels:
    app: foo-app
spec:
  selector:
    app: foo-app
  targetErrors: 
    - errorCode: [1040, 1042, 1043, 1047]
    - errorType: ['com.mysql.jdbc.CommunicationsException']
  condition:
    type: AnyOccurrence
  evictionAction: ReplaceWithNew
@sczyh30 sczyh30 added the kind/spec-RFC Issues or PRs for OpenSergo spec RFC label Jul 27, 2022
@sczyh30 sczyh30 added the area/database-governance Category issues or PRs related to database governance label Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/database-governance Category issues or PRs related to database governance kind/spec-RFC Issues or PRs for OpenSergo spec RFC
Projects
None yet
Development

No branches or pull requests

1 participant