diff --git a/api/v2/changefeed.go b/api/v2/changefeed.go index 030d8583..ea998cbf 100644 --- a/api/v2/changefeed.go +++ b/api/v2/changefeed.go @@ -223,7 +223,8 @@ func (h *OpenAPIV2) listChangeFeeds(c *gin.Context) { } commonInfos = append(commonInfos, ChangefeedCommonInfo{ UpstreamID: changefeed.UpstreamID, - ChangefeedID: changefeed.ChangefeedID, + ID: changefeed.ChangefeedID.Name(), + Namespace: changefeed.ChangefeedID.Namespace(), FeedState: changefeed.State, CheckpointTSO: status.CheckpointTs, CheckpointTime: model.JSONTime(oracle.GetTimeFromTS(status.CheckpointTs)), @@ -298,7 +299,8 @@ func toAPIModel( apiInfoModel := &ChangeFeedInfo{ UpstreamID: info.UpstreamID, - ChangefeedID: info.ChangefeedID, + ID: info.ChangefeedID.Name(), + Namespace: info.ChangefeedID.Namespace(), SinkURI: sinkURI, CreateTime: info.CreateTime, StartTs: info.StartTs, diff --git a/api/v2/model.go b/api/v2/model.go index 3269ac88..3d548f35 100644 --- a/api/v2/model.go +++ b/api/v2/model.go @@ -18,7 +18,6 @@ import ( "time" "github.com/pingcap/errors" - "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/ticdc/pkg/config" "github.com/pingcap/tiflow/cdc/model" bf "github.com/pingcap/tiflow/pkg/binlog-filter" @@ -95,7 +94,8 @@ type PDConfig struct { // ChangefeedCommonInfo holds some common usage information of a changefeed type ChangefeedCommonInfo struct { UpstreamID uint64 `json:"upstream_id"` - ChangefeedID common.ChangeFeedID `json:"changefeed_id"` + ID string `json:"id"` + Namespace string `json:"namespace"` FeedState model.FeedState `json:"state"` CheckpointTSO uint64 `json:"checkpoint_tso"` CheckpointTime model.JSONTime `json:"checkpoint_time"` @@ -1067,10 +1067,11 @@ type ResolveLockReq struct { // ChangeFeedInfo describes the detail of a ChangeFeed type ChangeFeedInfo struct { - UpstreamID uint64 `json:"upstream_id,omitempty"` - ChangefeedID common.ChangeFeedID `json:"changefeed_id,omitempty"` - SinkURI string `json:"sink_uri,omitempty"` - CreateTime time.Time `json:"create_time"` + UpstreamID uint64 `json:"upstream_id,omitempty"` + ID string `json:"id"` + Namespace string `json:"namespace"` + SinkURI string `json:"sink_uri,omitempty"` + CreateTime time.Time `json:"create_time"` // Start sync at this commit ts if `StartTs` is specify or using the CreateTime of changefeed. StartTs uint64 `json:"start_ts,omitempty"` // The ChangeFeed will exits until sync to timestamp TargetTs diff --git a/cmd/cli/cli_changefeed_create.go b/cmd/cli/cli_changefeed_create.go index 17e4ea1d..ee2c817a 100644 --- a/cmd/cli/cli_changefeed_create.go +++ b/cmd/cli/cli_changefeed_create.go @@ -339,7 +339,7 @@ func (o *createChangefeedOptions) run(ctx context.Context, cmd *cobra.Command) e if err != nil { return err } - cmd.Printf("Create changefeed successfully!\nID: %s\nInfo: %s\n", info.ChangefeedID.Name(), infoStr) + cmd.Printf("Create changefeed successfully!\nID: %s\nInfo: %s\n", info.ID, infoStr) return nil } diff --git a/cmd/cli/cli_changefeed_list.go b/cmd/cli/cli_changefeed_list.go index d10e3d49..3b4188c5 100644 --- a/cmd/cli/cli_changefeed_list.go +++ b/cmd/cli/cli_changefeed_list.go @@ -18,7 +18,6 @@ import ( "github.com/pingcap/ticdc/cmd/factory" v2 "github.com/pingcap/ticdc/pkg/api/v2" - "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/tiflow/cdc/api/owner" "github.com/pingcap/tiflow/cdc/model" "github.com/pingcap/tiflow/pkg/cmd/context" @@ -30,8 +29,9 @@ const timeFormat = "2006-01-02 15:04:05.000" // changefeedCommonInfo holds some common used information of a changefeed. type changefeedCommonInfo struct { - ChangefeedID common.ChangeFeedID `json:"changefeed_id"` - Summary *owner.ChangefeedResp `json:"summary"` + ID string `json:"id"` + Namespace string `json:"namespace"` + Summary *owner.ChangefeedResp `json:"summary"` } // listChangefeedOptions defines flags for the `cli changefeed list` command. @@ -82,7 +82,8 @@ func (o *listChangefeedOptions) run(cmd *cobra.Command) error { } } cfci := &changefeedCommonInfo{ - ChangefeedID: cf.ChangefeedID, + ID: cf.ID, + Namespace: cf.Namespace, Summary: &owner.ChangefeedResp{ FeedState: string(cf.FeedState), TSO: cf.CheckpointTSO, diff --git a/cmd/cli/cli_changefeed_query.go b/cmd/cli/cli_changefeed_query.go index fe32cdd0..4ce74d29 100644 --- a/cmd/cli/cli_changefeed_query.go +++ b/cmd/cli/cli_changefeed_query.go @@ -20,7 +20,6 @@ import ( v2 "github.com/pingcap/ticdc/api/v2" "github.com/pingcap/ticdc/cmd/factory" apiv2client "github.com/pingcap/ticdc/pkg/api/v2" - "github.com/pingcap/ticdc/pkg/common" "github.com/pingcap/tiflow/cdc/model" "github.com/pingcap/tiflow/pkg/cmd/util" cerror "github.com/pingcap/tiflow/pkg/errors" @@ -30,7 +29,8 @@ import ( // cfMeta holds changefeed info and changefeed status. type cfMeta struct { UpstreamID uint64 `json:"upstream_id"` - ChangefeedID common.ChangeFeedID `json:"changefeed_id"` + ID string `json:"id"` + Namespace string `json:"namespace"` SinkURI string `json:"sink_uri"` Config *v2.ReplicaConfig `json:"config"` CreateTime model.JSONTime `json:"create_time"` @@ -88,7 +88,7 @@ func (o *queryChangefeedOptions) run(cmd *cobra.Command) error { return errors.Trace(err) } for _, info := range infos { - if info.ChangefeedID.Name() == o.changefeedID { + if info.ID == o.changefeedID { return util.JSONPrint(cmd, info) } } @@ -101,7 +101,8 @@ func (o *queryChangefeedOptions) run(cmd *cobra.Command) error { } meta := &cfMeta{ UpstreamID: detail.UpstreamID, - ChangefeedID: detail.ChangefeedID, + ID: detail.ID, + Namespace: detail.Namespace, SinkURI: detail.SinkURI, Config: detail.Config, CreateTime: model.JSONTime(detail.CreateTime),