-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CLC-427][CLC-428]: Remove Data Migrations in Progress List and Statu…
…s Map Usages (#424)
- Loading branch information
Kutluhan Metin
authored
Nov 7, 2023
1 parent
ead4607
commit beb23e4
Showing
17 changed files
with
186 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//go:build std || migration | ||
|
||
package migration | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"fmt" | ||
|
||
"github.com/hazelcast/hazelcast-go-client" | ||
"github.com/hazelcast/hazelcast-go-client/serialization" | ||
) | ||
|
||
type MigrationInProgress struct { | ||
MigrationID string `json:"id"` | ||
} | ||
|
||
func findMigrationInProgress(ctx context.Context, ci *hazelcast.ClientInternal) (MigrationInProgress, error) { | ||
var mip MigrationInProgress | ||
q := fmt.Sprintf("SELECT this FROM %s WHERE JSON_VALUE(this, '$.status') IN('STARTED', 'IN_PROGRESS', 'CANCELING')", StatusMapName) | ||
r, err := querySingleRow(ctx, ci, q) | ||
if err != nil { | ||
return mip, fmt.Errorf("finding migration in progress: %w", err) | ||
} | ||
rr, err := r.Get(0) | ||
if err != nil { | ||
return mip, fmt.Errorf("finding migration in progress: %w", err) | ||
} | ||
m := rr.(serialization.JSON) | ||
if err = json.Unmarshal(m, &mip); err != nil { | ||
return mip, fmt.Errorf("parsing migration in progress: %w", err) | ||
} | ||
return mip, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.