Skip to content

Commit

Permalink
[CLI] fix a few things in domain migration command (uber#5374)
Browse files Browse the repository at this point in the history
What changed?

add two methods in ClientFactory for migration
countWorkflowCheck should be on current domain
fix concurrency bug
make template look slightly better
Why?

add two methods in ClientFactory for migration
This is needed to be able to use environment flags for internal usage

How did you test it?

shengs@shengs-C02XN3VDJGH6 cadence % go run cmd/tools/cli/main.go --do domain-1 domain migration --destination_address localhost:7933 --destination_domain domain-2 --tasklist ts1 --search_attr someID:INT
2023/08/08 10:21:28 Loading configFiles=[config/base.yaml config/development.yaml]
2023/08/08 10:21:28 Loading configFiles=[config/base.yaml config/development.yaml]
{"level":"info","ts":"2023-08-08T10:21:28.241-0700","msg":"Updated dynamic config","logging-call-at":"file_based_client.go:284"}
Validation Check:
- Domain Meta Data: true
    Current Domain:
      Name: domain-1
      UUID: d3cc0a3c-8f55-40af-9820-c48f8a0f46e5
    New Domain:
      Name: domain-2
      UUID: 203f0088-1d0f-40ac-a7c3-fdcf57ec0a99
- Workflow Check: true
    Long Running Workflow Num: 0
- Dynamic Config Check: false
    - Config Key: matching.asyncTaskDispatchTimeout
        Current Response:
          Data: "50s"
          Filters:
            - Name: domainName
              Value: "domain-1"
            - Name: taskListName
              Value: ["ts1"]
        New Response:
          Data: "20s"
          Filters:
            - Name: domainName
              Value: "domain-2"
            - Name: taskListName
              Value: ["ts1"]
- Search Attributes Check: false
    Missing Search Attributes in Current Domain:
      - someID:INT
    Missing Search Attributes in New Domain:
      - someID:INT
Potential risks

No Risk
  • Loading branch information
shijiesheng authored Aug 9, 2023
1 parent fea24c2 commit 818cdb7
Show file tree
Hide file tree
Showing 6 changed files with 575 additions and 513 deletions.
8 changes: 8 additions & 0 deletions tools/cli/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ func (m *clientFactoryMock) ServerAdminClient(c *cli.Context) admin.Client {
return m.serverAdminClient
}

func (m *clientFactoryMock) ServerFrontendClientForMigration(c *cli.Context) frontend.Client {
panic("not implemented")
}

func (m *clientFactoryMock) ServerAdminClientForMigration(c *cli.Context) admin.Client {
panic("not implemented")
}

func (m *clientFactoryMock) ElasticSearchClient(c *cli.Context) *elastic.Client {
panic("not implemented")
}
Expand Down
3 changes: 1 addition & 2 deletions tools/cli/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,13 @@ func newDomainCommands() []cli.Command {
newDomainCLI(c, false).DescribeDomain(c)
},
},

{
Name: "migration",
Aliases: []string{"mi"},
Usage: "Migrate existing domain to new domain. This command only validates the settings. It does not perform actual data migration",
Flags: migrateDomainFlags,
Action: func(c *cli.Context) {
newDomainCLI(c, true).MigrateDomain(c)
newDomainMigrationCLIImpl(c).Validation(c)
},
},
}
Expand Down
Loading

0 comments on commit 818cdb7

Please sign in to comment.