Skip to content

Commit

Permalink
feat: support batch ddl (#135)
Browse files Browse the repository at this point in the history
* feat: support batch create table

* feat: ddl batch

* feat: batch ddl task

* feat: response table ids
  • Loading branch information
fengjiachun authored Jan 22, 2024
1 parent 65b008f commit 519b1d0
Show file tree
Hide file tree
Showing 9 changed files with 15,807 additions and 5,195 deletions.
1,146 changes: 1,003 additions & 143 deletions c++/greptime/v1/meta/ddl.pb.cc

Large diffs are not rendered by default.

1,084 changes: 1,025 additions & 59 deletions c++/greptime/v1/meta/ddl.pb.h

Large diffs are not rendered by default.

1,369 changes: 1,094 additions & 275 deletions c++/greptime/v1/region/server.pb.cc

Large diffs are not rendered by default.

1,019 changes: 964 additions & 55 deletions c++/greptime/v1/region/server.pb.h

Large diffs are not rendered by default.

513 changes: 394 additions & 119 deletions go/greptime/v1/meta/ddl.pb.go

Large diffs are not rendered by default.

6,521 changes: 5,071 additions & 1,450 deletions java/src/main/java/greptime/v1/meta/Ddl.java

Large diffs are not rendered by default.

9,325 changes: 6,231 additions & 3,094 deletions java/src/main/java/io/greptime/v1/region/Server.java

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions proto/greptime/v1/meta/ddl.proto
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,20 @@ message CreateTableTask {
bytes table_info = 3;
}

message CreateTableTasks { repeated CreateTableTask tasks = 1; }

message DropTableTask{
DropTableExpr drop_table = 1;
}

message DropTableTasks { repeated DropTableTask tasks = 1; }

message AlterTableTask{
AlterExpr alter_table = 1;
}

message AlterTableTasks { repeated AlterTableTask tasks = 1; }

message TruncateTableTask {
TruncateTableExpr truncate_table = 1;
}
Expand All @@ -59,6 +65,9 @@ message SubmitDdlTaskRequest {
DropTableTask drop_table_task = 3;
AlterTableTask alter_table_task = 4;
TruncateTableTask truncate_table_task = 5;
CreateTableTasks create_table_tasks = 6;
DropTableTasks drop_table_tasks = 7;
AlterTableTasks alter_table_tasks = 8;
}
}

Expand All @@ -68,5 +77,8 @@ message SubmitDdlTaskResponse {
bytes key = 2;

// Returns if table created.
// TODO(jeremy): remove it?
TableId table_id = 4;
// Returns if the tables created.
repeated TableId table_ids = 5;
}
13 changes: 13 additions & 0 deletions proto/greptime/v1/region/server.proto
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ message RegionRequest {
FlushRequest flush = 10;
CompactRequest compact = 11;
TruncateRequest truncate = 12;
CreateRequests creates = 13;
DropRequests drops = 14;
AlterRequests alters = 15;
}
}

Expand Down Expand Up @@ -76,6 +79,11 @@ message QueryRequest {
bytes plan = 3;
}

// Create a batch of regions at once, usually used to create multiple logical regions
// at once. Different engines can choose whether to support this request.
// Metric Engine needs it.
message CreateRequests { repeated CreateRequest requests = 1; }

message CreateRequest {
uint64 region_id = 1;
// Region engine name
Expand All @@ -91,6 +99,9 @@ message CreateRequest {
// TODO: add partition def
}

// Same as CreateRequests, but for dropping regions.
message DropRequests { repeated DropRequest requests = 1; }

message DropRequest { uint64 region_id = 1; }

message OpenRequest {
Expand All @@ -105,6 +116,8 @@ message OpenRequest {

message CloseRequest { uint64 region_id = 1; }

message AlterRequests { repeated AlterRequest requests = 1; }

message AlterRequest {
uint64 region_id = 1;
oneof kind {
Expand Down

0 comments on commit 519b1d0

Please sign in to comment.