Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update admin rereplicate command to support SQL databases #4227

Merged
merged 1 commit into from
Jun 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/cli/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ func newAdminKafkaCommands() []cli.Command {
{
Name: "rereplicate",
Aliases: []string{"rrp"},
Usage: "Rereplicate replication tasks to target topic from history tables",
Usage: "Rereplicate replication tasks from history tables",
Flags: append(getDBFlags(),
cli.StringFlag{
Name: FlagSourceCluster,
Expand Down
16 changes: 4 additions & 12 deletions tools/cli/adminKafkaCommands.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ import (
"github.com/uber/cadence/client/admin"
"github.com/uber/cadence/common"
"github.com/uber/cadence/common/config"
"github.com/uber/cadence/common/log/loggerimpl"
"github.com/uber/cadence/common/persistence"
"github.com/uber/cadence/common/persistence/cassandra"
"github.com/uber/cadence/common/persistence/nosql/nosqlplugin/cassandra/gocql"
"github.com/uber/cadence/common/types"
"github.com/uber/cadence/common/types/mapper/thrift"
)
Expand Down Expand Up @@ -462,14 +459,9 @@ func doRereplicate(
endEventID int64,
endEventVersion int64,
sourceCluster string,
cqlClient gocql.Client,
session gocql.Session,
adminClient admin.Client,
exeMgr persistence.ExecutionManager,
) {

exeM, _ := cassandra.NewWorkflowExecutionPersistence(shardID, cqlClient, session, loggerimpl.NewNopLogger())
exeMgr := persistence.NewExecutionManagerImpl(exeM, loggerimpl.NewNopLogger())

fmt.Printf("Start rereplicate for wid: %v, rid:%v \n", wid, rid)
resp, err := exeMgr.GetWorkflowExecution(ctx, &persistence.GetWorkflowExecutionRequest{
DomainID: domainID,
Expand Down Expand Up @@ -517,7 +509,6 @@ func AdminRereplicate(c *cli.Context) {
ErrorAndExit("End event version is not defined", nil)
}

client, session := connectToCassandra(c)
adminClient := cFactory.ServerAdminClient(c)
endEventID := c.Int64(FlagMaxEventID)
endVersion := c.Int64(FlagEndEventVersion)
Expand All @@ -526,6 +517,8 @@ func AdminRereplicate(c *cli.Context) {
rid := getRequiredOption(c, FlagRunID)
shardID := common.WorkflowIDToHistoryShard(wid, numberOfShards)
contextTimeout := defaultResendContextTimeout
executionManager := initializeExecutionStore(c, shardID, 0)
defer executionManager.Close()
if c.GlobalIsSet(FlagContextTimeout) {
contextTimeout = time.Duration(c.GlobalInt(FlagContextTimeout)) * time.Second
}
Expand All @@ -541,9 +534,8 @@ func AdminRereplicate(c *cli.Context) {
endEventID,
endVersion,
sourceCluster,
client,
session,
adminClient,
executionManager,
)
}

Expand Down