Skip to content

feat: add time travel experiment #131

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

Merged
merged 1 commit into from
Aug 30, 2022

Conversation

Icesource
Copy link
Contributor

Signed-off-by: Icesource [email protected]

Describe what this PR does / why we need it

新增Time Travel故障类型,可修改系统时间

时钟偏移可以让节点看到的系统时间出现偏移,验证分布式系统下依赖于时间同步的逻辑是否会由于单点时间异常而出现异常
例如验证Mysql主从复制下,会不会由于从节点时间错误导致数据不一致
或者分布式数据库的时钟一致性能否在节点系统时间异常的情况下正常工作

Describe how you did it

执行date命令修改系统时间,销毁则通过hwclock将硬件时钟同步到系统时间
TODO:date指令仅能粗粒度修改系统时间,之后需要探索实现容器进程维度修改时间的方法

Describe how to verify it

time travel 至 10m30s之后

date
2022年 08月 25日 星期四 15:36:06 CST

./target/chaosblade-1.6.1/bin/chaos_os create time travel --offset 10m30s
{"code":200,"success":true,"result":"2022年 08月 25日 星期四 15:47:08 CST\n"}
// 系统时间修改为了10分30秒之后,执行chaos_os destroy time travel --offset 10m30s可恢复

./target/chaosblade-1.6.1/bin/chaos_os create time travel --offset -4m27s
{"code":200,"success":true,"result":"2022年 08月 25日 星期四 15:34:22 CST\n"}
// 系统时间修改为了4分27秒之前

@xcaspar xcaspar self-requested a review August 30, 2022 05:58
@xcaspar xcaspar added this to the v1.7.0 milestone Aug 30, 2022
@xcaspar xcaspar merged commit ca022c9 into chaosblade-io:master Aug 30, 2022
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.

2 participants