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

do not show gid in cli #466

Merged
merged 1 commit into from
Nov 6, 2024
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
6 changes: 4 additions & 2 deletions api/v2/changefeed.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down Expand Up @@ -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,
Expand Down
13 changes: 7 additions & 6 deletions api/v2/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"`
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmd/cli/cli_changefeed_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
9 changes: 5 additions & 4 deletions cmd/cli/cli_changefeed_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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.
Expand Down Expand Up @@ -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,
Expand Down
9 changes: 5 additions & 4 deletions cmd/cli/cli_changefeed_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"`
Expand Down Expand Up @@ -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)
}
}
Expand All @@ -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),
Expand Down
Loading