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

Use the HealthCheckImpl in vtctld instead of the LegacyHealthCheck #10254

Merged
merged 16 commits into from
Jun 6, 2022

Conversation

frouioui
Copy link
Member

@frouioui frouioui commented May 10, 2022

Description

This Pull Request removes the usage of the legacy healthcheck in the vtctld package. The new healthcheck implementation is used instead.

In the vtctld API, instead of having a realtime_stats and tablet_cache, we now only have a healthcheck implementation. Most of the code that lived in realtime_stats and tablet_cache and that was required by the new implementation got moved to api_utils.go

Related Issue(s)

Checklist

  • "Backport me!" label has been added if this change should be backported
  • Tests were added or are not required
  • Documentation was added or is not required

@frouioui frouioui added Type: Internal Cleanup Component: Cluster management release notes (needs details) This PR needs to be listed in the release notes in a dedicated section (deprecation notice, etc...) labels May 10, 2022
@frouioui frouioui changed the title wip Remove the legacy healthcheck May 10, 2022
@frouioui frouioui added this to the v14.0 milestone May 20, 2022
@frouioui frouioui changed the title Remove the legacy healthcheck Use the HealthCheckImpl in vtctld instead of the LegacyHealthCheck May 25, 2022
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>

Follow up on the intial vtctld API changes

Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
… GetShardInKeyspace

Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
@frouioui frouioui marked this pull request as ready for review May 25, 2022 18:12
@github-actions
Copy link
Contributor

github-actions bot commented May 25, 2022

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has the correct release notes label. release notes none should only be used for PRs that are so trivial that they need not be included.
  • If a new flag is being introduced, review whether it is really needed. The flag names should be clear and intuitive (as far as possible), and the flag's help should be descriptive.

Bug fixes

  • There should be at least one unit or end-to-end test.
  • The Pull Request description should either include a link to an issue that describes the bug OR an actual description of the bug and how to reproduce, along with a description of the fix.

Non-trivial changes

  • There should be some code comments as to why things are implemented the way they are.

New/Existing features

  • Should be documented, either by modifying the existing documentation or creating new documentation.
  • New features should have a link to a feature request issue or an RFC that documents the use cases, corner cases and test cases.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • vtctl command output order should be stable and awk-able.

go/vt/vtctld/api_test.go Outdated Show resolved Hide resolved
go/vt/vtctld/api_test.go Outdated Show resolved Hide resolved
go/vt/vtctld/api.go Outdated Show resolved Hide resolved
go/vt/discovery/fake_healthcheck.go Show resolved Hide resolved
go/vt/discovery/tablet_health.go Outdated Show resolved Hide resolved
go/vt/discovery/tablet_health.go Outdated Show resolved Hide resolved
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
…hcheck

Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
@frouioui
Copy link
Member Author

Manual Testing

Here is a preview of a couple of endpoints before and after the changes brought by this PR. Other endpoints have been manually tested too on both sharded and unsharded clusters, nothing to report.

http://localhost:15000/api/tablet_health/zone1/100

Before

{
  "Key": "localhost,grpc:16100,vt:15100",
  "Tablet": {
    "alias": {
      "cell": "zone1",
      "uid": 100
    },
    "hostname": "localhost",
    "port_map": {
      "grpc": 16100,
      "vt": 15100
    },
    "keyspace": "commerce",
    "shard": "0",
    "type": 1,
    "mysql_hostname": "localhost",
    "mysql_port": 17100,
    "primary_term_start_time": {
      "seconds": 1653685533,
      "nanoseconds": 104635000
    },
    "db_server_version": "8.0.28",
    "default_conn_collation": 255
  },
  "Name": "zone1-0000000100",
  "Target": {
    "keyspace": "commerce",
    "shard": "0",
    "tablet_type": 1
  },
  "Up": true,
  "Serving": true,
  "TabletExternallyReparentedTimestamp": 1653685533,
  "Stats": {},
  "LastError": null
}

After

{
  "Key": "localhost,grpc:16100,vt:15100",
  "Tablet": {
    "alias": {
      "cell": "zone1",
      "uid": 100
    },
    "hostname": "localhost",
    "port_map": {
      "grpc": 16100,
      "vt": 15100
    },
    "keyspace": "commerce",
    "shard": "0",
    "type": 1,
    "mysql_hostname": "localhost",
    "mysql_port": 17100,
    "primary_term_start_time": {
      "seconds": 1653686352,
      "nanoseconds": 49835000
    },
    "db_server_version": "8.0.28",
    "default_conn_collation": 255
  },
  "Name": "zone1-0000000100",
  "Target": {
    "keyspace": "commerce",
    "shard": "0",
    "tablet_type": 1
  },
  "Up": true,
  "Serving": true,
  "PrimaryTermStartTime": 1653686352,
  "TabletExternallyReparentedTimestamp": 1653686352,
  "Stats": {},
  "LastError": null
}

http://localhost:15000/api/tablet_statuses/?keyspace=all&cell=all&type=all&metric=lag

Before

[
  {
    "Data": [
      [
        0
      ]
    ],
    "Aliases": null,
    "KeyspaceLabel": {
      "Name": "commerce",
      "Rowspan": 1
    },
    "CellAndTypeLabels": [
      {
        "CellLabel": {
          "Name": "zone1",
          "Rowspan": 1
        },
        "TypeLabels": null
      }
    ],
    "ShardLabels": [
      "0"
    ],
    "YGridLines": [
      0.5
    ]
  }
]

After

[
  {
    "Data": [
      [
        0
      ]
    ],
    "Aliases": null,
    "KeyspaceLabel": {
      "Name": "commerce",
      "Rowspan": 1
    },
    "CellAndTypeLabels": [
      {
        "CellLabel": {
          "Name": "zone1",
          "Rowspan": 1
        },
        "TypeLabels": null
      }
    ],
    "ShardLabels": [
      "0"
    ],
    "YGridLines": [
      0.5
    ]
  }
]

@frouioui frouioui requested a review from deepthi May 27, 2022 21:32
Copy link
Member

@deepthi deepthi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Everything looks good except for a few minor comments.
We can merge once those are addressed.

go/vt/discovery/tablet_health.go Outdated Show resolved Hide resolved
go/vt/discovery/tablet_health.go Show resolved Hide resolved
Comment on lines +808 to +809
buildVarCharRow("aa", "TestExecutor", "-20", "PRIMARY", "SERVING", "aa-0000000001", "-20", "1970-01-01T00:00:01Z"),
buildVarCharRow("aa", "TestXBadVSchema", "-20", "PRIMARY", "SERVING", "aa-0000000009", "random", "1970-01-01T00:00:01Z"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this needs to change in this PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use the FakeHealthCheck in these tests. The implementation used to ignore the cell and use FakeCell always, this was changed, so now the output of the test uses the real cell's name.

@frouioui frouioui requested a review from deepthi June 2, 2022 07:29
…for v15

Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
@frouioui frouioui mentioned this pull request Jun 6, 2022
12 tasks
…hcheck

Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
@deepthi deepthi merged commit f7082a8 into vitessio:main Jun 6, 2022
@deepthi deepthi deleted the remove-legacy-healthcheck branch June 6, 2022 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Cluster management release notes (needs details) This PR needs to be listed in the release notes in a dedicated section (deprecation notice, etc...) Type: Internal Cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Task: change vtctld's realtime_status to use new health check
2 participants