Skip to content

Commit 7744d4e

Browse files
Revert "refactor(operations): use full names for operation types (#128)" (#131)
This reverts commit 90afa3a.
1 parent 82a2a8d commit 7744d4e

File tree

3 files changed

+10
-19
lines changed

3 files changed

+10
-19
lines changed

internal/connectors/db/process_result_set.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ func ReadOperationFromResultSet(res query.Row) (types.Operation, error) {
209209
updatedTs = timestamppb.New(*updatedAt)
210210
}
211211

212-
if operationType == string(types.LegacyOperationTypeTB) || operationType == string(types.OperationTypeTB) {
212+
if operationType == string(types.OperationTypeTB) {
213213
if backupId == nil {
214214
return nil, fmt.Errorf("failed to read backup_id for TB operation: %s", operationId)
215215
}
@@ -230,7 +230,7 @@ func ReadOperationFromResultSet(res query.Row) (types.Operation, error) {
230230
UpdatedAt: updatedTs,
231231
ParentOperationID: parentOperationID,
232232
}, nil
233-
} else if operationType == string(types.LegacyOperationTypeRB) || operationType == string(types.OperationTypeRB) {
233+
} else if operationType == string(types.OperationTypeRB) {
234234
if backupId == nil {
235235
return nil, fmt.Errorf("failed to read backup_id for RB operation: %s", operationId)
236236
}
@@ -249,7 +249,7 @@ func ReadOperationFromResultSet(res query.Row) (types.Operation, error) {
249249
Audit: auditFromDb(creator, createdAt, completedAt),
250250
UpdatedAt: updatedTs,
251251
}, nil
252-
} else if operationType == string(types.LegacyOperationTypeDB) || operationType == string(types.OperationTypeDB) {
252+
} else if operationType == string(types.OperationTypeDB) {
253253
if backupId == nil {
254254
return nil, fmt.Errorf("failed to read backup_id for DB operation: %s", operationId)
255255
}
@@ -273,7 +273,7 @@ func ReadOperationFromResultSet(res query.Row) (types.Operation, error) {
273273
PathPrefix: pathPrefix,
274274
UpdatedAt: updatedTs,
275275
}, nil
276-
} else if operationType == string(types.LegacyOperationTypeTBWR) || operationType == string(types.OperationTypeTBWR) {
276+
} else if operationType == string(types.OperationTypeTBWR) {
277277
var retryConfig *pb.RetryConfig = nil
278278
if maxBackoff != nil {
279279
retryConfig = &pb.RetryConfig{

internal/connectors/db/yql/queries/write_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ UPSERT INTO Operations (id, type, status, message, initiated, created_at, contai
123123
),
124124

125125
table.ValueParam("$id_1", table_types.StringValueFromString(opId)),
126-
table.ValueParam("$type_1", table_types.StringValueFromString(types.OperationTypeTB.String())),
126+
table.ValueParam("$type_1", table_types.StringValueFromString("TB")),
127127
table.ValueParam(
128128
"$status_1", table_types.StringValueFromString(string(tbOp.State)),
129129
),
@@ -209,7 +209,7 @@ UPSERT INTO Operations (id, type, status, message, initiated, created_at, contai
209209
table.ValueParam("$message_0", table_types.StringValueFromString("Success")),
210210
table.ValueParam("$expire_at_0", table_types.NullableTimestampValueFromTime(nil)),
211211
table.ValueParam("$id_1", table_types.StringValueFromString(opId)),
212-
table.ValueParam("$type_1", table_types.StringValueFromString(types.OperationTypeTB.String())),
212+
table.ValueParam("$type_1", table_types.StringValueFromString("TB")),
213213
table.ValueParam(
214214
"$status_1", table_types.StringValueFromString(string(tbOp.State)),
215215
),

internal/types/operation.go

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -434,20 +434,11 @@ var (
434434
OperationStateStartCancelling = OperationState(pb.Operation_START_CANCELLING.String())
435435
)
436436

437-
// Deprecated: these short operation type names are unclear and will be removed in the future. Use full names instead.
438437
const (
439-
LegacyOperationTypeTB = OperationType("TB")
440-
LegacyOperationTypeRB = OperationType("RB")
441-
LegacyOperationTypeDB = OperationType("DB")
442-
LegacyOperationTypeTBWR = OperationType("TBWR")
443-
)
444-
445-
const (
446-
OperationTypeTB = OperationType("TakeBackup")
447-
OperationTypeRB = OperationType("RestoreBackup")
448-
OperationTypeDB = OperationType("DeleteBackup")
449-
OperationTypeTBWR = OperationType("TakeBackupWithRetries")
450-
438+
OperationTypeTB = OperationType("TB")
439+
OperationTypeRB = OperationType("RB")
440+
OperationTypeDB = OperationType("DB")
441+
OperationTypeTBWR = OperationType("TBWR")
451442
BackupTimestampFormat = "20060102_150405"
452443
OperationCreatorName = "ydbcp"
453444
)

0 commit comments

Comments
 (0)