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

add tikvGCLifeTime option #835

Merged
merged 10 commits into from
Aug 29, 2019
Merged

add tikvGCLifeTime option #835

merged 10 commits into from
Aug 29, 2019

Conversation

weekface
Copy link
Contributor

What problem does this PR solve?

What is changed and how does it work?

Check List

Tests

Code changes

  • Has Helm charts change

Side effects

Related changes

  • Need to cherry-pick to the release branch

Does this PR introduce a user-facing change?:

add tikvGCLifeTime option

@weekface
Copy link
Contributor Author

/run-e2e-in-kind

@@ -56,6 +56,9 @@ backupOptions: "--verbose=3"
initialCommitTs: ""
# restoreOptions is the options of loader https://www.pingcap.com/docs-cn/tools/loader/
restoreOptions: "-t 16"
# The time limit during which data is retained for each GC when backup, in the format of Go Duration.
# When a GC happens, the current time minus this value is the safe point.
tikvGCLifeTime: 3h
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would better to use a long gc life time that impossible to reach as the default, e.g. 720h, which effectively "disable" the GC when backup in progress.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I think this should not even be an option: the controller should automatically hold open the GC. Here we can have a timeout option to timeout the backup if it does not complete and document that it helps limit performance degradation during backup due to maintaining the GC. TiDB is supposed to get a backup lock feature eventually.

@weekface
Copy link
Contributor Author

/run-e2e-in-kind

1 similar comment
@weekface
Copy link
Contributor Author

/run-e2e-in-kind

charts/tidb-backup/values.yaml Outdated Show resolved Hide resolved
charts/tidb-cluster/values.yaml Outdated Show resolved Hide resolved
@weekface
Copy link
Contributor Author

/run-e2e-in-kind

@weekface
Copy link
Contributor Author

@tennix @aylei comments addressed PTAL

@@ -15,8 +15,8 @@ fi
gc_life_time=`/usr/bin/mysql -h${host} -P4000 -u${TIDB_USER} ${password_str} -Nse "select variable_value from mysql.tidb where variable_name='tikv_gc_life_time';"`
echo "Old TiKV GC life time is ${gc_life_time}"

echo "Increase TiKV GC life time to 3h"
/usr/bin/mysql -h${host} -P4000 -u${TIDB_USER} ${password_str} -Nse "update mysql.tidb set variable_value='3h' where variable_name='tikv_gc_life_time';"
echo "Increase TiKV GC life time to {{ .Values.tikvGCLifeTime }}"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
echo "Increase TiKV GC life time to {{ .Values.tikvGCLifeTime }}"
echo "Increase TiKV GC life time to {{ .Values.tikvGCLifeTime | default 720 }}"

Copy link
Member

Choose a reason for hiding this comment

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

When adding new variable to chart, always remember to set a default in case of users not providing the variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

aylei
aylei previously approved these changes Aug 29, 2019
Copy link
Contributor

@aylei aylei left a comment

Choose a reason for hiding this comment

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

LGTM

@weekface
Copy link
Contributor Author

/run-e2e-in-kind

@@ -15,8 +15,8 @@ fi
gc_life_time=`/usr/bin/mysql -h${host} -P4000 -u${TIDB_USER} ${password_str} -Nse "select variable_value from mysql.tidb where variable_name='tikv_gc_life_time';"`
echo "Old TiKV GC life time is ${gc_life_time}"

echo "Increase TiKV GC life time to 3h"
/usr/bin/mysql -h${host} -P4000 -u${TIDB_USER} ${password_str} -Nse "update mysql.tidb set variable_value='3h' where variable_name='tikv_gc_life_time';"
echo "Increase TiKV GC life time to {{ .Values.tikvGCLifeTime | default 720h }}"
Copy link
Member

Choose a reason for hiding this comment

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

This reports error when the value is not set:

Error: parse error in "tidb-cluster/templates/scripts/_start_scheduled_backup.sh.tpl": template: tidb-cluster/templates/scripts/_start_scheduled_backup.sh.tpl:22: bad number syntax: "720h"

echo "Increase TiKV GC life time to 3h"
/usr/bin/mysql -h${host} -P4000 -u${TIDB_USER} ${password_str} -Nse "update mysql.tidb set variable_value='3h' where variable_name='tikv_gc_life_time';"
echo "Increase TiKV GC life time to {{ .Values.tikvGCLifeTime | default 720h }}"
/usr/bin/mysql -h${host} -P4000 -u${TIDB_USER} ${password_str} -Nse "update mysql.tidb set variable_value='{{ .Values.tikvGCLifeTime | default 720h }}' where variable_name='tikv_gc_life_time';"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/usr/bin/mysql -h${host} -P4000 -u${TIDB_USER} ${password_str} -Nse "update mysql.tidb set variable_value='{{ .Values.tikvGCLifeTime | default 720h }}' where variable_name='tikv_gc_life_time';"
/usr/bin/mysql -h${host} -P4000 -u${TIDB_USER} ${password_str} -Nse "update mysql.tidb set variable_value='{{ .Values.tikvGCLifeTime | default "720h" }}' where variable_name='tikv_gc_life_time';"

@weekface
Copy link
Contributor Author

/run-e2e-in-kind

Copy link
Member

@tennix tennix left a comment

Choose a reason for hiding this comment

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

LGTM

@weekface weekface merged commit e22e480 into pingcap:master Aug 29, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Aug 29, 2019

cherry pick to release-1.0 failed

weekface added a commit to weekface/tidb-operator that referenced this pull request Aug 29, 2019
weekface added a commit that referenced this pull request Aug 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants