Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat: taskRunLog for MySQL (#11925)
p0ny4832e4e45ecb
diff --git a/backend/plugin/db/driver.go b/backend/plugin/db/driver.goindex 123f5733d8..1e73ee1838 100644--- a/backend/plugin/db/driver.go+++ b/backend/plugin/db/driver.go@@ -6,11 +6,13 @@ import ("database/sql""fmt""io"+ "log/slog""sync""time""github.com/pkg/errors"+ "github.com/bytebase/bytebase/backend/common/log""github.com/bytebase/bytebase/backend/plugin/parser/base""github.com/bytebase/bytebase/backend/store/model"storepb "github.com/bytebase/bytebase/proto/generated-go/store"@@ -338,6 +340,69 @@ type ExecuteOptions struct {// For both cases, we will use one transaction to wrap the statements.ChunkedSubmission boolUpdateExecutionStatus func(*v1pb.TaskRun_ExecutionDetail)+ CreateTaskRunLog func(time.Time, *storepb.TaskRunLog) error+}++func (o *ExecuteOptions) LogSchemaDumpStart() {+ if o == nil || o.CreateTaskRunLog == nil {+ return+ }+ err := o.CreateTaskRunLog(time.Now(), &storepb.TaskRunLog{+ Type: storepb.TaskRunLog_SCHEMA_DUMP_START,+ SchemaDumpStart: &storepb.TaskRunLog_SchemaDumpStart{},+ })+ if err != nil {+ slog.Warn("failed to log schema dump start", log.BBError(err))+ }+}++func (o *ExecuteOptions) LogSchemaDumpEnd(derr string) {+ if o == nil || o.CreateTaskRunLog == nil {+ return+ }+ err := o.CreateTaskRunLog(time.Now(), &storepb.TaskRunLog{+ Type: storepb.TaskRunLog_SCHEMA_DUMP_END,+ SchemaDumpEnd: &storepb.TaskRunLog_SchemaDumpEnd{+ Error: derr,+ },+ })+ if err != nil {+ slog.Warn("failed to log schema dump end", log.BBError(err))+ }+}++func (o *ExecuteOptions) LogCommandExecute(commandIndex int32, commandCount int32) {+ if o == nil || o.CreateTaskRunLog == nil {+ return+ }+ err := o.CreateTaskRunLog(time.Now(), &storepb.TaskRunLog{+ Type: storepb.TaskRunLog_COMMAND_EXECUTE,+ CommandExecute: &storepb.TaskRunLog_CommandExecute{+ CommandIndex: commandIndex,+ CommandCount: commandCount,+ },+ })+ if err != nil {+ slog.Warn("failed to log command execute", log.BBError(err))+ }+}++func (o *ExecuteOptions) LogCommandResponse(commandIndex, commandCount, affectedRows int32, rerr string) {+ if o == nil || o.CreateTaskRunLog == nil {+ return+ }+ err := o.CreateTaskRunLog(time.Now(), &storepb.TaskRunLog{+ Type: storepb.TaskRunLog_COMMAND_RESPONSE,+ CommandResponse: &storepb.TaskRunLog_CommandResponse{+ CommandIndex: commandIndex,+ CommandCount: commandCount,+ AffectedRows: affectedRows,+ Error: rerr,+ },+ })+ if err != nil {+ slog.Warn("failed to log command response", log.BBError(err))+ }}// ErrorWithPosition is the error with the position information.diff --git a/backend/plugin/db/mysql/mysql.go b/backend/plugin/db/mysql/mysql.goindex eab7f7bff0..fa28c25915 100644--- a/backend/plugin/db/mysql/mysql.go+++ b/backend/plugin/db/mysql/mysql.go@@ -372,6 +372,8 @@ func (driver *Driver) Execute(ctx context.Context, statement string, opts db.Exereturn 0, err}+ opts.LogCommandExecute(int32(currentIndex), int32(len(chunk)))+sqlResult, err := tx.ExecContext(ctx, chunkText)if err != nil {if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {@@ -381,6 +383,8 @@ func (driver *Driver) Execute(ctx context.Context, statement string, opts db.Exe}}+ opts.LogCommandResponse(int32(currentIndex), int32(len(chunk)), 0, err.Error())+return 0, &db.ErrorWithPosition{Err: errors.Wrapf(err, "failed to execute context in a transaction"),Start: &storepb.TaskRunResult_Position{@@ -398,6 +402,7 @@ func (driver *Driver) Execute(ctx context.Context, statement string, opts db.Exe// Since we cannot differentiate DDL and DML yet, we have to ignore the error.slog.Debug("rowsAffected returns error", log.BBError(err))}+ opts.LogCommandResponse(int32(currentIndex), int32(len(chunk)), int32(rowsAffected), "")totalRowsAffected += rowsAffectedcurrentIndex += len(chunk)}diff --git a/backend/runner/taskrun/executor.go b/backend/runner/taskrun/executor.goindex a21169819f..2505de9098 100644--- a/backend/runner/taskrun/executor.go+++ b/backend/runner/taskrun/executor.go@@ -168,6 +168,12 @@ func getMigrationInfo(ctx context.Context, stores *store.Store, profile config.Preturn mi, nil}+func getCreateTaskRunLog(ctx context.Context, taskRunUID int, s *store.Store) func(t time.Time, e *storepb.TaskRunLog) error {+ return func(t time.Time, e *storepb.TaskRunLog) error {+ return s.CreateTaskRunLog(ctx, taskRunUID, t, e)+ }+}+func executeMigration(ctx context.Context,driverCtx context.Context,@@ -179,7 +185,8 @@ func executeMigration(taskRunUID int,statement string,sheetID *int,- mi *db.MigrationInfo) (string, string, error) {+ mi *db.MigrationInfo,+) (string, string, error) {instance, err := stores.GetInstanceV2(ctx, &store.FindInstanceMessage{UID: &task.InstanceID})if err != nil {return "", "", err@@ -235,6 +242,7 @@ func executeMigration(UpdateTime: time.Now(),})}+ opts.CreateTaskRunLog = getCreateTaskRunLog(ctx, taskRunUID, stores)default:// do nothing}diff --git a/backend/runner/taskrun/schema_update_ghost_cutover_executor.go b/backend/runner/taskrun/schema_update_ghost_cutover_executor.goindex 55d1f3003d..62e326a06e 100644--- a/backend/runner/taskrun/schema_update_ghost_cutover_executor.go+++ b/backend/runner/taskrun/schema_update_ghost_cutover_executor.go@@ -162,7 +162,7 @@ func cutover(ctx context.Context, taskContext context.Context, stores *store.Storeturn true, nil, err}defer driver.Close(ctx)- migrationID, _, err := utils.ExecuteMigrationWithFunc(ctx, ctx, stores, stateCfg, taskRunUID, driver, mi, statement, &sheetID, execFunc)+ migrationID, _, err := utils.ExecuteMigrationWithFunc(ctx, ctx, stores, stateCfg, taskRunUID, driver, mi, statement, &sheetID, execFunc, db.ExecuteOptions{})if err != nil {return true, nil, err}diff --git a/backend/store/task_run_log.go b/backend/store/task_run_log.gonew file mode 100644index 0000000000..118bccc7c5--- /dev/null+++ b/backend/store/task_run_log.go@@ -0,0 +1,33 @@+package store++import (+ "context"+ "time"++ "github.com/pkg/errors"+ "google.golang.org/protobuf/encoding/protojson"++ storepb "github.com/bytebase/bytebase/proto/generated-go/store"+)++func (s *Store) CreateTaskRunLog(ctx context.Context, taskRunUID int, t time.Time, e *storepb.TaskRunLog) error {+ query := `+ INSERT INTO task_run_log (+ task_run_id,+ created_ts,+ payload+ ) VALUES (+ $1,+ $2,+ $3+ )+ `+ p, err := protojson.Marshal(e)+ if err != nil {+ return errors.Wrapf(err, "failed to marshal task run log")+ }+ if _, err := s.db.db.ExecContext(ctx, query, taskRunUID, t, p); err != nil {+ return errors.Wrapf(err, "failed to create task run log")+ }+ return nil+}diff --git a/backend/utils/utils.go b/backend/utils/utils.goindex 565e07699d..7df4604f39 100644--- a/backend/utils/utils.go+++ b/backend/utils/utils.go@@ -201,18 +201,21 @@ func ExecuteMigrationDefault(ctx context.Context, driverCtx context.Context, sto}return nil}- return ExecuteMigrationWithFunc(ctx, driverCtx, store, stateCfg, taskRunUID, driver, mi, statement, sheetID, execFunc)+ return ExecuteMigrationWithFunc(ctx, driverCtx, store, stateCfg, taskRunUID, driver, mi, statement, sheetID, execFunc, opts)}// ExecuteMigrationWithFunc executes the migration with custom migration function.-func ExecuteMigrationWithFunc(ctx context.Context, driverCtx context.Context, s *store.Store, stateCfg *state.State, taskRunUID int, driver db.Driver, m *db.MigrationInfo, statement string, sheetID *int, execFunc func(ctx context.Context, execStatement string) error) (migrationHistoryID string, updatedSchema string, resErr error) {+func ExecuteMigrationWithFunc(ctx context.Context, driverCtx context.Context, s *store.Store, stateCfg *state.State, taskRunUID int, driver db.Driver, m *db.MigrationInfo, statement string, sheetID *int, execFunc func(ctx context.Context, execStatement string) error, opts db.ExecuteOptions) (migrationHistoryID string, updatedSchema string, resErr error) {+ opts.LogSchemaDumpStart()var prevSchemaBuf bytes.Buffer// Don't record schema if the database hasn't existed yet or is schemaless, e.g. MongoDB.// For baseline migration, we also record the live schema to detect the schema drift.// See https://bytebase.com/blog/what-is-database-schema-driftif _, err := driver.Dump(ctx, &prevSchemaBuf, true /* schemaOnly */); err != nil {+ opts.LogSchemaDumpEnd(err.Error())return "", "", err}+ opts.LogSchemaDumpEnd("")insertedID, err := BeginMigration(ctx, s, m, prevSchemaBuf.String(), statement, sheetID)if err != nil {@@ -277,6 +280,7 @@ func ExecuteMigrationWithFunc(ctx context.Context, driverCtx context.Context, s})}+ opts.LogSchemaDumpStart()// Phase 4 - Dump the schema after migrationvar afterSchemaBuf bytes.Bufferif _, err := driver.Dump(ctx, &afterSchemaBuf, true /* schemaOnly */); err != nil {@@ -284,8 +288,10 @@ func ExecuteMigrationWithFunc(ctx context.Context, driverCtx context.Context, sif strings.Contains(err.Error(), "not found") {return insertedID, "", nil}+ opts.LogSchemaDumpEnd(err.Error())return "", "", err}+ opts.LogSchemaDumpEnd("")return insertedID, afterSchemaBuf.String(), nil}diff --git a/frontend/src/types/proto/store/task_run_log.ts b/frontend/src/types/proto/store/task_run_log.tsindex 016dc8c217..a1f66dd93e 100644--- a/frontend/src/types/proto/store/task_run_log.ts+++ b/frontend/src/types/proto/store/task_run_log.ts@@ -95,6 +95,9 @@ export interface TaskRunLog_CommandExecute {}export interface TaskRunLog_CommandResponse {+ /** Executed commands are in range [command_index, command_index + command_count). */+ commandIndex: number;+ commandCount: number;error: string;affectedRows: number;}@@ -413,16 +416,22 @@ export const TaskRunLog_CommandExecute = {};function createBaseTaskRunLog_CommandResponse(): TaskRunLog_CommandResponse {- return { error: "", affectedRows: 0 };+ return { commandIndex: 0, commandCount: 0, error: "", affectedRows: 0 };}export const TaskRunLog_CommandResponse = {encode(message: TaskRunLog_CommandResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.commandIndex !== 0) {+ writer.uint32(8).int32(message.commandIndex);+ }+ if (message.commandCount !== 0) {+ writer.uint32(16).int32(message.commandCount);+ }if (message.error !== "") {- writer.uint32(10).string(message.error);+ writer.uint32(26).string(message.error);}if (message.affectedRows !== 0) {- writer.uint32(16).int32(message.affectedRows);+ writer.uint32(32).int32(message.affectedRows);}return writer;},@@ -435,17 +444,31 @@ export const TaskRunLog_CommandResponse = {const tag = reader.uint32();switch (tag >>> 3) {case 1:- if (tag !== 10) {+ if (tag !== 8) {break;}- message.error = reader.string();+ message.commandIndex = reader.int32();continue;case 2:if (tag !== 16) {break;}+ message.commandCount = reader.int32();+ continue;+ case 3:+ if (tag !== 26) {+ break;+ }++ message.error = reader.string();+ continue;+ case 4:+ if (tag !== 32) {+ break;+ }+message.affectedRows = reader.int32();continue;}@@ -459,6 +482,8 @@ export const TaskRunLog_CommandResponse = {fromJSON(object: any): TaskRunLog_CommandResponse {return {+ commandIndex: isSet(object.commandIndex) ? globalThis.Number(object.commandIndex) : 0,+ commandCount: isSet(object.commandCount) ? globalThis.Number(object.commandCount) : 0,error: isSet(object.error) ? globalThis.String(object.error) : "",affectedRows: isSet(object.affectedRows) ? globalThis.Number(object.affectedRows) : 0,};@@ -466,6 +491,12 @@ export const TaskRunLog_CommandResponse = {toJSON(message: TaskRunLog_CommandResponse): unknown {const obj: any = {};+ if (message.commandIndex !== 0) {+ obj.commandIndex = Math.round(message.commandIndex);+ }+ if (message.commandCount !== 0) {+ obj.commandCount = Math.round(message.commandCount);+ }if (message.error !== "") {obj.error = message.error;}@@ -480,6 +511,8 @@ export const TaskRunLog_CommandResponse = {},fromPartial(object: DeepPartial<TaskRunLog_CommandResponse>): TaskRunLog_CommandResponse {const message = createBaseTaskRunLog_CommandResponse();+ message.commandIndex = object.commandIndex ?? 0;+ message.commandCount = object.commandCount ?? 0;message.error = object.error ?? "";message.affectedRows = object.affectedRows ?? 0;return message;diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.mdindex baf3d10be9..96504c8902 100644--- a/proto/gen/grpc-doc/store/README.md+++ b/proto/gen/grpc-doc/store/README.md@@ -3703,6 +3703,8 @@ The following fields are used for error reporting.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |+| command_index | [int32](#int32) | | Executed commands are in range [command_index, command_index + command_count). |+| command_count | [int32](#int32) | | || error | [string](#string) | | || affected_rows | [int32](#int32) | | |diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.htmlindex b8a5bda25f..6682bff37a 100644--- a/proto/gen/grpc-doc/store/index.html+++ b/proto/gen/grpc-doc/store/index.html@@ -9119,6 +9119,20 @@ GitOps workflow. The webhook endpoint points to the backend. </p></td></thead><tbody>+ <tr>+ <td>command_index</td>+ <td><a href="#int32">int32</a></td>+ <td></td>+ <td><p>Executed commands are in range [command_index, command_index + command_count). </p></td>+ </tr>++ <tr>+ <td>command_count</td>+ <td><a href="#int32">int32</a></td>+ <td></td>+ <td><p> </p></td>+ </tr>+<tr><td>error</td><td><a href="#string">string</a></td>diff --git a/proto/generated-go/store/task_run_log.pb.go b/proto/generated-go/store/task_run_log.pb.goindex f1d92b7e94..0571dc8aac 100644--- a/proto/generated-go/store/task_run_log.pb.go+++ b/proto/generated-go/store/task_run_log.pb.go@@ -300,8 +300,11 @@ type TaskRunLog_CommandResponse struct {sizeCache protoimpl.SizeCacheunknownFields protoimpl.UnknownFields- Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`- AffectedRows int32 `protobuf:"varint,2,opt,name=affected_rows,json=affectedRows,proto3" json:"affected_rows,omitempty"`+ // Executed commands are in range [command_index, command_index + command_count).+ CommandIndex int32 `protobuf:"varint,1,opt,name=command_index,json=commandIndex,proto3" json:"command_index,omitempty"`+ CommandCount int32 `protobuf:"varint,2,opt,name=command_count,json=commandCount,proto3" json:"command_count,omitempty"`+ Error string `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"`+ AffectedRows int32 `protobuf:"varint,4,opt,name=affected_rows,json=affectedRows,proto3" json:"affected_rows,omitempty"`}func (x *TaskRunLog_CommandResponse) Reset() {@@ -336,6 +339,20 @@ func (*TaskRunLog_CommandResponse) Descriptor() ([]byte, []int) {return file_store_task_run_log_proto_rawDescGZIP(), []int{0, 3}}+func (x *TaskRunLog_CommandResponse) GetCommandIndex() int32 {+ if x != nil {+ return x.CommandIndex+ }+ return 0+}++func (x *TaskRunLog_CommandResponse) GetCommandCount() int32 {+ if x != nil {+ return x.CommandCount+ }+ return 0+}+func (x *TaskRunLog_CommandResponse) GetError() string {if x != nil {return x.Error@@ -355,7 +372,7 @@ var File_store_task_run_log_proto protoreflect.FileDescriptorvar file_store_task_run_log_proto_rawDesc = []byte{0x0a, 0x18, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x72, 0x75, 0x6e,0x5f, 0x6c, 0x6f, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x62, 0x79, 0x74, 0x65,- 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0xef, 0x05, 0x0a, 0x0a, 0x54,+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0xba, 0x06, 0x0a, 0x0a, 0x54,0x61, 0x73, 0x6b, 0x52, 0x75, 0x6e, 0x4c, 0x6f, 0x67, 0x12, 0x33, 0x0a, 0x04, 0x74, 0x79, 0x70,0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,0x73, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x75, 0x6e,@@ -390,21 +407,26 @@ var file_store_task_run_log_proto_rawDesc = []byte{0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x49,0x6e, 0x64, 0x65, 0x78, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x5f,0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x63, 0x6f, 0x6d,- 0x6d, 0x61, 0x6e, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x4c, 0x0a, 0x0f, 0x43, 0x6f, 0x6d,- 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05,- 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72,- 0x6f, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x66, 0x66, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x72,- 0x6f, 0x77, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x61, 0x66, 0x66, 0x65, 0x63,- 0x74, 0x65, 0x64, 0x52, 0x6f, 0x77, 0x73, 0x22, 0x73, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12,- 0x14, 0x0a, 0x10, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46,- 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x43, 0x48, 0x45, 0x4d, 0x41, 0x5f,- 0x44, 0x55, 0x4d, 0x50, 0x5f, 0x53, 0x54, 0x41, 0x52, 0x54, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f,- 0x53, 0x43, 0x48, 0x45, 0x4d, 0x41, 0x5f, 0x44, 0x55, 0x4d, 0x50, 0x5f, 0x45, 0x4e, 0x44, 0x10,- 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x43, 0x4f, 0x4d, 0x4d, 0x41, 0x4e, 0x44, 0x5f, 0x45, 0x58, 0x45,- 0x43, 0x55, 0x54, 0x45, 0x10, 0x03, 0x12, 0x14, 0x0a, 0x10, 0x43, 0x4f, 0x4d, 0x4d, 0x41, 0x4e,- 0x44, 0x5f, 0x52, 0x45, 0x53, 0x50, 0x4f, 0x4e, 0x53, 0x45, 0x10, 0x04, 0x42, 0x14, 0x5a, 0x12,- 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x73, 0x74, 0x6f,- 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,+ 0x6d, 0x61, 0x6e, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x96, 0x01, 0x0a, 0x0f, 0x43, 0x6f,+ 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a,+ 0x0d, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01,+ 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x49, 0x6e, 0x64,+ 0x65, 0x78, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x5f, 0x63, 0x6f,+ 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x61,+ 0x6e, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72,+ 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x23, 0x0a,+ 0x0d, 0x61, 0x66, 0x66, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x72, 0x6f, 0x77, 0x73, 0x18, 0x04,+ 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x61, 0x66, 0x66, 0x65, 0x63, 0x74, 0x65, 0x64, 0x52, 0x6f,+ 0x77, 0x73, 0x22, 0x73, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x59,+ 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00,+ 0x12, 0x15, 0x0a, 0x11, 0x53, 0x43, 0x48, 0x45, 0x4d, 0x41, 0x5f, 0x44, 0x55, 0x4d, 0x50, 0x5f,+ 0x53, 0x54, 0x41, 0x52, 0x54, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x43, 0x48, 0x45, 0x4d,+ 0x41, 0x5f, 0x44, 0x55, 0x4d, 0x50, 0x5f, 0x45, 0x4e, 0x44, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f,+ 0x43, 0x4f, 0x4d, 0x4d, 0x41, 0x4e, 0x44, 0x5f, 0x45, 0x58, 0x45, 0x43, 0x55, 0x54, 0x45, 0x10,+ 0x03, 0x12, 0x14, 0x0a, 0x10, 0x43, 0x4f, 0x4d, 0x4d, 0x41, 0x4e, 0x44, 0x5f, 0x52, 0x45, 0x53,+ 0x50, 0x4f, 0x4e, 0x53, 0x45, 0x10, 0x04, 0x42, 0x14, 0x5a, 0x12, 0x67, 0x65, 0x6e, 0x65, 0x72,+ 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70,+ 0x72, 0x6f, 0x74, 0x6f, 0x33,}var (diff --git a/proto/store/task_run_log.proto b/proto/store/task_run_log.protoindex e7609a7d46..efd1bc67bd 100644--- a/proto/store/task_run_log.proto+++ b/proto/store/task_run_log.proto@@ -28,7 +28,11 @@ message TaskRunLog {int32 command_count = 2;}message CommandResponse {- string error = 1;- int32 affected_rows = 2;+ // Executed commands are in range [command_index, command_index + command_count).+ int32 command_index = 1;+ int32 command_count = 2;++ string error = 3;+ int32 affected_rows = 4;}}