Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CDCSDK] [#9019] CDC SDK API changes
Summary: Added following CDC admin APIs. The CDC stream is created at the namespace level. It creates the stream on all the tables present at that point in time. This Stream ID can be used by the CDC client to get the data of the tables. Currently, any table created in this namespace after this command is executed, will not have the stream created for it automatically. The user will need to alter this stream to add/remove the table id. **Case 1: No tables are present in the database** ``` $ ./yb-admin create_change_data_stream demo CDC Stream ID: 3ea999960f5f4fe49d5526079cd0eec4 $ ./yb-admin list_change_data_streams CDC Streams: streams { stream_id: "3ea999960f5f4fe49d5526079cd0eec4" options { key: "id_type" value: "NAMESPACEID" } options { key: "checkpoint_type" value: "EXPLICIT" } options { key: "source_type" value: "CDCSDK" } options { key: "record_format" value: "PROTO" } options { key: "record_type" value: "CHANGE" } options { key: "state" value: "ACTIVE" } } $ ./yb-admin get_change_data_stream_info 3ea999960f5f4fe49d5526079cd0eec4 CDC DB Stream Info: namespace_id: "000033e1000030008000000000000000" $ ./yb-admin delete_change_data_stream 3ea999960f5f4fe49d5526079cd0eec4 Successfully deleted Change Data Stream ID: 3ea999960f5f4fe49d5526079cd0eec4 ``` **Case 2: Some tables are present in the DB** In this case, we will be getting the table IDs of the respective tables in the relevant responses ``` $ ./yb-admin create_change_data_stream demo CDC Stream ID: a6e987dbc2af4516b02ab53dfd01cf56 $ ./yb-admin list_change_data_streams CDC Streams: streams { stream_id: "a6e987dbc2af4516b02ab53dfd01cf56" table_id: "000033e1000030008000000000004000" table_id: "000033e1000030008000000000004005" options { key: "id_type" value: "NAMESPACEID" } options { key: "checkpoint_type" value: "EXPLICIT" } options { key: "source_type" value: "CDCSDK" } options { key: "record_format" value: "PROTO" } options { key: "record_type" value: "CHANGE" } options { key: "state" value: "ACTIVE" } } $ ./yb-admin get_change_data_stream_info a6e987dbc2af4516b02ab53dfd01cf56 CDC DB Stream Info: table_info { stream_id: "a6e987dbc2af4516b02ab53dfd01cf56" table_id: "000033e1000030008000000000004000" } table_info { stream_id: "a6e987dbc2af4516b02ab53dfd01cf56" table_id: "000033e1000030008000000000004005" } namespace_id: "000033e1000030008000000000000000" $ ./yb-admin delete_change_data_stream a6e987dbc2af4516b02ab53dfd01cf56 Successfully deleted Change Data Stream ID: a6e987dbc2af4516b02ab53dfd01cf56 ``` Test Plan: Added unit tests. Have tested it manually. Reviewers: rahuldesirazu, nicolas, sergei, vkushwaha Reviewed By: sergei, vkushwaha Subscribers: zyu, ybase, bogdan Differential Revision: https://phabricator.dev.yugabyte.com/D14605
- Loading branch information