You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pegasus.apache.org by ji...@apache.org on 2022/06/20 08:52:18 UTC

[incubator-pegasus] branch master updated: feat(dup_enhancement#27): update dulication command in admin-cli (#1008)

This is an automated email from the ASF dual-hosted git repository.

jiashuo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git


The following commit(s) were added to refs/heads/master by this push:
     new 8758a575 feat(dup_enhancement#27): update dulication command in admin-cli (#1008)
8758a575 is described below

commit 8758a575ab067628d172ebc4952bae8803dd0698
Author: Jiashuo <js...@live.com>
AuthorDate: Mon Jun 20 16:52:13 2022 +0800

    feat(dup_enhancement#27): update dulication command in admin-cli (#1008)
---
 admin-cli/client/meta.go          | 10 +++++-----
 admin-cli/cmd/duplication.go      | 10 +++++-----
 admin-cli/executor/duplication.go |  4 ++--
 admin-cli/go.mod                  |  2 +-
 admin-cli/go.sum                  |  2 ++
 5 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/admin-cli/client/meta.go b/admin-cli/client/meta.go
index 91b71dc3..e07a1155 100644
--- a/admin-cli/client/meta.go
+++ b/admin-cli/client/meta.go
@@ -82,7 +82,7 @@ type Meta interface {
 
 	ModifyDuplication(tableName string, dupid int, status admin.DuplicationStatus) error
 
-	AddDuplication(tableName string, remoteCluster string, freezed bool) (*admin.DuplicationAddResponse, error)
+	AddDuplication(tableName string, remoteCluster string, duplicateCheckpoint bool) (*admin.DuplicationAddResponse, error)
 
 	QueryDuplication(tableName string) (*admin.DuplicationQueryResponse, error)
 
@@ -314,12 +314,12 @@ func (m *rpcBasedMeta) ModifyDuplication(tableName string, dupid int, status adm
 	return err
 }
 
-func (m *rpcBasedMeta) AddDuplication(tableName string, remoteCluster string, freezed bool) (*admin.DuplicationAddResponse, error) {
+func (m *rpcBasedMeta) AddDuplication(tableName string, remoteCluster string, duplicateCheckpoint bool) (*admin.DuplicationAddResponse, error) {
 	var result *admin.DuplicationAddResponse
 	req := &admin.DuplicationAddRequest{
-		AppName:           tableName,
-		RemoteClusterName: remoteCluster,
-		Freezed:           freezed,
+		AppName:                 tableName,
+		RemoteClusterName:       remoteCluster,
+		IsDuplicatingCheckpoint: duplicateCheckpoint,
 	}
 	err := m.callMeta("AddDuplication", req, func(resp interface{}) {
 		result = resp.(*admin.DuplicationAddResponse)
diff --git a/admin-cli/cmd/duplication.go b/admin-cli/cmd/duplication.go
index 253ff863..90584aa1 100644
--- a/admin-cli/cmd/duplication.go
+++ b/admin-cli/cmd/duplication.go
@@ -49,11 +49,11 @@ func init() {
 			if c.Flags.String("cluster") == "" {
 				return fmt.Errorf("cluster cannot be empty")
 			}
-			return executor.AddDuplication(pegasusClient, c.UseTable, c.Flags.String("cluster"), c.Flags.Bool("freezed"))
+			return executor.AddDuplication(pegasusClient, c.UseTable, c.Flags.String("cluster"), c.Flags.Bool("checkpoint"))
 		}),
 		Flags: func(f *grumble.Flags) {
 			f.String("c", "cluster", "", "the destination where the source data is duplicated")
-			f.Bool("f", "freezed", false, "whether to freeze replica GC when duplication created")
+			f.Bool("p", "checkpoint", true, "whether to duplicate checkpoint when duplication created")
 		},
 	})
 	rootCmd.AddCommand(&grumble.Command{
@@ -72,7 +72,7 @@ func init() {
 	})
 	rootCmd.AddCommand(&grumble.Command{
 		Name: "pause",
-		Help: "pause a duplication",
+		Help: "pause a duplication, it only support pause from `DS_LOG`",
 		Run: shell.RequireUseTable(func(c *shell.Context) error {
 			if c.Flags.Int("dupid") == -1 {
 				return fmt.Errorf("dupid cannot be empty")
@@ -85,12 +85,12 @@ func init() {
 	})
 	rootCmd.AddCommand(&grumble.Command{
 		Name: "start",
-		Help: "start a duplication",
+		Help: "start a duplication, it only support start from `DS_PAUSE`",
 		Run: shell.RequireUseTable(func(c *shell.Context) error {
 			if c.Flags.Int("dupid") == -1 {
 				return fmt.Errorf("dupid cannot be empty")
 			}
-			return executor.ModifyDuplication(pegasusClient, c.UseTable, c.Flags.Int("dupid"), admin.DuplicationStatus_DS_START)
+			return executor.ModifyDuplication(pegasusClient, c.UseTable, c.Flags.Int("dupid"), admin.DuplicationStatus_DS_LOG)
 		}),
 		Flags: func(f *grumble.Flags) {
 			f.Int("d", "dupid", -1, "the dupid")
diff --git a/admin-cli/executor/duplication.go b/admin-cli/executor/duplication.go
index e6ccc4e2..0a1736b8 100644
--- a/admin-cli/executor/duplication.go
+++ b/admin-cli/executor/duplication.go
@@ -39,8 +39,8 @@ func QueryDuplication(c *Client, tableName string) error {
 }
 
 // AddDuplication command
-func AddDuplication(c *Client, tableName string, remoteCluster string, freezed bool) error {
-	resp, err := c.Meta.AddDuplication(tableName, remoteCluster, freezed)
+func AddDuplication(c *Client, tableName string, remoteCluster string, duplicateCheckpoint bool) error {
+	resp, err := c.Meta.AddDuplication(tableName, remoteCluster, duplicateCheckpoint)
 	if err != nil {
 		return err
 	}
diff --git a/admin-cli/go.mod b/admin-cli/go.mod
index 99f0bbdb..ca023b24 100644
--- a/admin-cli/go.mod
+++ b/admin-cli/go.mod
@@ -20,7 +20,7 @@ module github.com/apache/incubator-pegasus/admin-cli
 go 1.14
 
 require (
-	github.com/apache/incubator-pegasus/go-client v0.0.0-20220526071020-be5634371701
+	github.com/apache/incubator-pegasus/go-client v0.0.0-20220617101220-e49a69d25a52
 	github.com/cheggaaa/pb/v3 v3.0.6
 	github.com/desertbit/grumble v1.1.1
 	github.com/dustin/go-humanize v1.0.0
diff --git a/admin-cli/go.sum b/admin-cli/go.sum
index 4d96344b..3feeea67 100644
--- a/admin-cli/go.sum
+++ b/admin-cli/go.sum
@@ -43,6 +43,8 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk5
 github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=
 github.com/apache/incubator-pegasus/go-client v0.0.0-20220526071020-be5634371701 h1:J9d8jaC0rKlnf8iQuImyBiDrZnl794JlGMXX8DhMNrs=
 github.com/apache/incubator-pegasus/go-client v0.0.0-20220526071020-be5634371701/go.mod h1:vOnSzVwVYmatouq8qEBX+yWV4AvoCTLRpQn6JA+qojs=
+github.com/apache/incubator-pegasus/go-client v0.0.0-20220617101220-e49a69d25a52 h1:RvSh9D6x+zfq56hk4vXZyUwjdnpAhBO6pSqcT2nRFgY=
+github.com/apache/incubator-pegasus/go-client v0.0.0-20220617101220-e49a69d25a52/go.mod h1:vOnSzVwVYmatouq8qEBX+yWV4AvoCTLRpQn6JA+qojs=
 github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
 github.com/apache/thrift v0.13.0 h1:5hryIiq9gtn+MiLVn0wP37kb/uTeRZgN08WoCsAhIhI=
 github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pegasus.apache.org
For additional commands, e-mail: commits-help@pegasus.apache.org