Skip to content

Commit 0d15b1a

Browse files
authored
add debezium protocal (#305)
1 parent 9ef3f64 commit 0d15b1a

9 files changed

Lines changed: 274 additions & 5 deletions

File tree

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ generate-v1beta1-serverless-client: install-openapi-generator ## Generate server
5353
@echo "==> Generating serverless audit log client"
5454
rm -rf pkg/tidbcloud/v1beta1/serverless/auditlog
5555
cd tools/openapi-generator && npx openapi-generator-cli generate --inline-schema-options RESOLVE_INLINE_ENUMS=true --additional-properties=withGoMod=false,enumClassPrefix=true,disallowAdditionalPropertiesIfNotPresent=false --global-property=apiTests=false,apiDocs=false,modelDocs=false,modelTests=false -i ../../pkg/tidbcloud/v1beta1/serverless/auditlog.swagger.json -g go -o ../../pkg/tidbcloud/v1beta1/serverless/auditlog --package-name auditlog -c go/config.yaml
56-
cd pkg && go fmt ./tidbcloud/v1beta1/serverless/... && goimports -w .
5756
@echo "==> Generating serverless cdc client"
5857
rm -rf pkg/tidbcloud/v1beta1/serverless/cdc
5958
cd tools/openapi-generator && npx openapi-generator-cli generate --inline-schema-options RESOLVE_INLINE_ENUMS=true --additional-properties=withGoMod=false,enumClassPrefix=true,disallowAdditionalPropertiesIfNotPresent=false --global-property=apiTests=false,apiDocs=false,modelDocs=false,modelTests=false -i ../../pkg/tidbcloud/v1beta1/serverless/cdc.swagger.json -g go -o ../../pkg/tidbcloud/v1beta1/serverless/cdc --package-name cdc -c go/config.yaml

internal/cli/serverless/changefeed/template.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,15 @@ const (
4848
"enableTls": false
4949
},
5050
"dataFormat": {
51-
// "protocol": "CANAL_JSON", "AVRO", "OPEN_PROTOCOL"
51+
// "protocol": "CANAL_JSON", "AVRO", "OPEN_PROTOCOL", "DEBEZIUM"
5252
"protocol": "CANAL_JSON",
5353
// available when protocol is CANAL_JSON
5454
"enableTidbExtension": false,
55+
// available when protocol is DEBEZIUM
56+
"debeziumConfig": {
57+
"disableOutputOldValue": false,
58+
"disableSchema": false
59+
},
5560
// available when protocol is AVRO
5661
"avroConfig": {
5762
"decimalHandlingMode": "PRECISE",
@@ -122,6 +127,10 @@ const (
122127
"dataFormat": {
123128
"protocol": "CANAL_JSON",
124129
"enableTidbExtension": false,
130+
"debeziumConfig": {
131+
"disableOutputOldValue": false,
132+
"disableSchema": false
133+
},
125134
"avroConfig": {
126135
"decimalHandlingMode": "PRECISE",
127136
"bigintUnsignedHandlingMode": "LONG",

pkg/tidbcloud/v1beta1/serverless/cdc.swagger.json

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,19 @@
916916
"endpoint"
917917
]
918918
},
919+
"DebeziumConfig": {
920+
"type": "object",
921+
"properties": {
922+
"disableOutputOldValue": {
923+
"type": "boolean",
924+
"title": "whether disable output old value, default to false"
925+
},
926+
"disableSchema": {
927+
"type": "boolean",
928+
"title": "disable schema in debezium message, default to false"
929+
}
930+
}
931+
},
919932
"DecimalHandlingMode.Enum": {
920933
"type": "string",
921934
"enum": [
@@ -1083,6 +1096,9 @@
10831096
},
10841097
"avroConfig": {
10851098
"$ref": "#/definitions/AvroConfig"
1099+
},
1100+
"debeziumConfig": {
1101+
"$ref": "#/definitions/DebeziumConfig"
10861102
}
10871103
}
10881104
},
@@ -1215,9 +1231,10 @@
12151231
"enum": [
12161232
"CANAL_JSON",
12171233
"OPEN_PROTOCOL",
1218-
"AVRO"
1234+
"AVRO",
1235+
"DEBEZIUM"
12191236
],
1220-
"description": " - CANAL_JSON: Canal-JSON protocol.\n - OPEN_PROTOCOL: Open Protocol.\n - AVRO: Avro protocol."
1237+
"description": " - CANAL_JSON: Canal-JSON protocol.\n - OPEN_PROTOCOL: Open Protocol.\n - AVRO: Avro protocol.\n - DEBEZIUM: Debezium protocol."
12211238
},
12221239
"KafkaType.Enum": {
12231240
"type": "string",

pkg/tidbcloud/v1beta1/serverless/cdc/.openapi-generator/FILES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ model_changefeed_type_enum.go
2323
model_changefeeds.go
2424
model_checkpoint.go
2525
model_confluent_schema_registry.go
26+
model_debezium_config.go
2627
model_decimal_handling_mode_enum.go
2728
model_describe_schema_table_resp.go
2829
model_event_filter_rule.go

pkg/tidbcloud/v1beta1/serverless/cdc/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ Class | Method | HTTP request | Description
110110
- [Changefeeds](docs/Changefeeds.md)
111111
- [Checkpoint](docs/Checkpoint.md)
112112
- [ConfluentSchemaRegistry](docs/ConfluentSchemaRegistry.md)
113+
- [DebeziumConfig](docs/DebeziumConfig.md)
113114
- [DecimalHandlingModeEnum](docs/DecimalHandlingModeEnum.md)
114115
- [DescribeSchemaTableResp](docs/DescribeSchemaTableResp.md)
115116
- [EventFilterRule](docs/EventFilterRule.md)

pkg/tidbcloud/v1beta1/serverless/cdc/api/openapi.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,15 @@ components:
745745
required:
746746
- endpoint
747747
type: object
748+
DebeziumConfig:
749+
properties:
750+
disableOutputOldValue:
751+
title: "whether disable output old value, default to false"
752+
type: boolean
753+
disableSchema:
754+
title: "disable schema in debezium message, default to false"
755+
type: boolean
756+
type: object
748757
DecimalHandlingMode.Enum:
749758
description: |2-
750759
- PRECISE: Precise handling mode for decimals.
@@ -872,6 +881,8 @@ components:
872881
type: boolean
873882
avroConfig:
874883
$ref: '#/components/schemas/AvroConfig'
884+
debeziumConfig:
885+
$ref: '#/components/schemas/DebeziumConfig'
875886
type: object
876887
Kafka.Network:
877888
properties:
@@ -969,10 +980,12 @@ components:
969980
- CANAL_JSON: Canal-JSON protocol.
970981
- OPEN_PROTOCOL: Open Protocol.
971982
- AVRO: Avro protocol.
983+
- DEBEZIUM: Debezium protocol.
972984
enum:
973985
- CANAL_JSON
974986
- OPEN_PROTOCOL
975987
- AVRO
988+
- DEBEZIUM
976989
type: string
977990
KafkaType.Enum:
978991
description: |2-

pkg/tidbcloud/v1beta1/serverless/cdc/model_debezium_config.go

Lines changed: 190 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/tidbcloud/v1beta1/serverless/cdc/model_kafka_data_format.go

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)