Skip to content

Workaround the problem that of GetGCState API fails when calling on PD server in old versions #1728

@MyonKeminta

Description

@MyonKeminta

Problem description

As we are migrating GC related operations to the new APIs as tracked by tikv/pd#8978 , the saved safe point polling is migrated to using the new GetGCState API.
Unluckily, we recently found that some data migration tools needs to be compatible with old TiDB cluster versions while referencing client-go in new versions. As client-go was developed under the assumption for a long time that client is never newer than the server, there are huge risks that there exist critical compatible problems in the expected deployment of these tools.
While it needs efforts to completely handle the problem, we also need a quick solution to workaround the failure of the GetGCState API caused by calling on old versions where the new GC API is not implemented yet.

Possible solution

When it polls the GetGCState and receives an Unimplemented error, instead of exit reporting the error, fallback to direct reading from etcd, like how the current SafePointKV does.

Also note that SafePointKV is not proper to be reused. Not only for the fact that it's going to be deprecated and completely removed, but a worse reason is that it expects the etcd key prefix is properly set according to the keyspace and keyspace config by the creator, and it's created outside client-go by the user of client-go. It's way too hard to let the user call it correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions