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

Simplified Realloc and Refined Misc #261

Merged
merged 6 commits into from
Nov 11, 2020
Merged

Conversation

jschwinger233
Copy link
Member

inherited from #260

@tonicmuroq
Copy link
Contributor

... 这个 MR even more terrible than the original one .....

e = c.doDeployOneWorkload(ctx, node, opts, createMsg, seq+idx, deploy-1-idx)
}()
return e
Copy link
Contributor

Choose a reason for hiding this comment

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

return c.doDeployOneWorkload(ctx, node, opts, createMsg, seq+idx, deploy-1-idx)

Comment on lines 52 to 55
// if commit changes
func(ctx context.Context) (err error) {
for _, plan := range plans {
plan.ApplyChangesOnNode(node, 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

我认为应该先尝试修改容器资源,再做资源写入。。。

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

其实我安排顺序主要关注的是“哪个操作更容易回滚”. 试想一个无法回滚的操作, 比如 ContainerRemove, 那这个操作最好就安排在 then 里面而不是 if:

util.Txn(
// if
func(ctx context.Context) error {
    return store.UpdateNode()
},
// then
func(ctx context.Context) error {
    return engine.RemoveContainer()
},
// else 
func(ctx context.Context) error {
    return store.UpdateNode()
}
)

就比下面的顺序好:

util.Txn(
// if
func(ctx context.Context) error {
    return engine.RemoveContainer()
},
// then
func(ctx context.Context) error {
    return store.UpdateNode()
},
// else
nil,
)

return errors.Wrap(types.ErrBadMemory, "limit or request less than 0")
}
if a.memoryRequest == 0 && a.memoryLimit > 0 {
a.memoryRequest = a.memoryLimit
Copy link
Member Author

Choose a reason for hiding this comment

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

这个顺序不能改, 我改回去了.
否则对于 cpu limit >0 && cpu request =0 && cpu bind =true 的请求会报错 "unlimited request with bind"

@jschwinger233
Copy link
Member Author

realloc 测试1600行, 由于改了接口之后很多测试用例都没意义了, 我一个一个改吧....太难了

@jschwinger233
Copy link
Member Author

改完 cli 之后还需测试一番

@jschwinger233 jschwinger233 changed the title [WIP] Simplified Realloc and Refined Misc Simplified Realloc and Refined Misc Nov 11, 2020
@CMGS CMGS merged commit 6dadb17 into projecteru2:master Nov 11, 2020
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.

3 participants