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

Table lifecycle: skip time hint for unspecified states #7151

Merged

Conversation

shlomi-noach
Copy link
Contributor

@shlomi-noach shlomi-noach commented Dec 10, 2020

Backport

NO

Status

READY

Description

Table GC uses table names as hints. For example: _vt_HOLD_3ace8bcef73211ea87e9f875a4d24e90_20200915120412 says to hold the table until 2020-09-15 12:04:12.

Background reading: https://vitess.io/docs/reference/features/table-lifecycle/

With this PR, the "timestamp" suggestion is ignored if the state is not in the set of predefined GC states. e.g. if the table is
_vt_HOLD_3ace8bcef73211ea87e9f875a4d24e90_20211201000000 but -table_gc_lifecycle="purge,evac,drop", then hold is not a lifecycle state, and so there's no point in waiting out until 2021-12-01 00:00:00, we just transition the table to the next specified state (purge in our example)

Related Issue(s)

Tracking: #6689

Todos

  • Tests
  • Documentation

Deployment Notes

Impacted Areas in Vitess

List general components of the application that this PR will affect:

  • Query Serving
  • VReplication
  • Cluster Management
  • Build

?

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
…pecified-states

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
if _, ok := collector.lifecycleStates[state]; ok {
// this state is in our expected lifecycle. Let's check table's time hint:
if timeNow.Before(t) {
// net yet time to operate on this table
Copy link
Collaborator

Choose a reason for hiding this comment

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

typo-nit: net yet?

@systay
Copy link
Collaborator

systay commented Dec 10, 2020

maybe add a unit test?

@shlomi-noach
Copy link
Contributor Author

Yes, will add unit tests.

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
@shlomi-noach
Copy link
Contributor Author

fixed typo and added tests

@shlomi-noach
Copy link
Contributor Author

🙏 request for additional review

…pecified-states

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
@shlomi-noach
Copy link
Contributor Author

Request for review

Copy link
Contributor

@rohit-nayak-ps rohit-nayak-ps left a comment

Choose a reason for hiding this comment

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

lgtm

@shlomi-noach shlomi-noach merged commit bf57b8c into vitessio:master Jan 4, 2021
@shlomi-noach shlomi-noach deleted the table-gc-skip-unspecified-states branch January 4, 2021 17:59
@shlomi-noach shlomi-noach restored the table-gc-skip-unspecified-states branch January 5, 2021 08:06
@shlomi-noach shlomi-noach deleted the table-gc-skip-unspecified-states branch January 5, 2021 08:06
@askdba askdba added this to the v9.0 milestone Jan 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants