diff --git a/dbs/migrate.go b/dbs/migrate.go index 7740c7ab..238b8cc5 100644 --- a/dbs/migrate.go +++ b/dbs/migrate.go @@ -47,11 +47,13 @@ DBS migration status codes: 1=IN PROGRESS 2=COMPLETED 3=FAILED (will be retried) + 4=EXIST_IN_DB 9=Terminally FAILED status change: 0 -> 1 1 -> 2 1 -> 3 + 1 -> 4 1 -> 9 are only allowed changes for working through migration. 3 -> 1 is allowed for retrying and retry count +1. @@ -63,6 +65,7 @@ const ( IN_PROGRESS COMPLETED FAILED + EXIST_IN_DB TERM_FAILED = 9 ) @@ -497,6 +500,8 @@ func statusString(status int64) string { s = "FAILED" } else if status == TERM_FAILED { s = "TERMINATED" + } else if status == EXIST_IN_DB { + s = "EXIST_IN_DB" } return s } @@ -610,6 +615,8 @@ func startMigrationRequest(rec MigrationRequest) ([]MigrationReport, error) { // if no migration blocks found to process return immediately if len(migBlocks) == 0 { + rec.MIGRATION_STATUS = EXIST_IN_DB + updateMigrationStatus(rec, EXIST_IN_DB) msg = fmt.Sprintf("%s is already fulfilled, no blocks found for migration", mstr) log.Println(msg) return []MigrationReport{migrationReport(rec, msg, status, err)}, nil diff --git a/docs/MigrationServer.md b/docs/MigrationServer.md index 9b18ede7..4b1e6bd2 100644 --- a/docs/MigrationServer.md +++ b/docs/MigrationServer.md @@ -32,6 +32,8 @@ from underlying DB backend on periodic basis - 2 migration request has successfully completed - 3 migration request has failed, it will be retried according to DB migration server settings (by default 3 times) + - 4 migration request is already exist in DB, i.e. the requested block or + dataset is already found in database - 9 migration request termindated, this can happen in two scenarios - migration request has been cancelled explicitly by user - migration request failed N times and will no longer be retried @@ -39,10 +41,11 @@ from underlying DB backend on periodic basis The migration request goes throught the followin cycle: ``` status change: -0 -> 1 -1 -> 2 +0 -> 1, request in progress +1 -> 2, request is completed successfully 1 -> 3, and if failed 3->1 -1 -> 9 +1 -> 4, if request is alaready in DB +1 -> 9, request is terminated ``` ### Examples