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

start etcd compactor in background #25010

Merged
merged 1 commit into from
May 6, 2016

Conversation

hongchaodeng
Copy link
Contributor

@hongchaodeng hongchaodeng commented Apr 30, 2016

ref: #22448

What's in this PR?

  • StartCompactor starts a compactor in the background in order to compact keys older than fixed time. We need to compact keys because we can't let on disk data grow forever. We save the most recent 10 minutes data. It should be enough for slow watchers and to tolerate burst. We might keep a longer history (12h) in the future once storage API can take advantage of multi-version key.
  • Have only one compaction job for each cluster. Use endpoints from user input to differentiate clusters.

@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-label-needed labels Apr 30, 2016
@hongchaodeng
Copy link
Contributor Author

We actually don't need e2e for this

@hongchaodeng
Copy link
Contributor Author

Sorry, I accidentally pushed some testing code and caused above e2e failure.. Branching is complicated.

@hongchaodeng
Copy link
Contributor Author

I don't think we need e2e testing for this though.
It's not used in any e2e tests.

@hongchaodeng hongchaodeng force-pushed the cp branch 2 times, most recently from 10f266f to cd1921a Compare May 2, 2016 07:59
// older than fixed time.
// We need to compact keys because we can't let on disk data grow forever.
// We save the most recent 10 minutes data. It should be enough for slow watchers and to tolerate burst.
// We might keep a longer history (12h) in the future once storage API can take
Copy link
Contributor

Choose a reason for hiding this comment

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

make this a todo

@xiang90
Copy link
Contributor

xiang90 commented May 3, 2016

LGTM after fixing the comments.

@hongchaodeng
Copy link
Contributor Author

Great comments. All addressed.


var (
endpointsMap map[string]struct{}
endpointsMapLock sync.Mutex
Copy link
Contributor

Choose a reason for hiding this comment

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

move the lock before the map it protects. also rename it to endpointMapMu probably.

@hongchaodeng
Copy link
Contributor Author

Addressed.

@hongchaodeng
Copy link
Contributor Author

Note that e2e test doesn't go through this currently

@hongchaodeng
Copy link
Contributor Author

Fixed failure due to the removal of "endpoints" in parameter (dismissed in caller).

@k8s-bot
Copy link

k8s-bot commented May 5, 2016

GCE e2e build/test passed for commit 3144ebc.

}
}
for _, ep := range client.Endpoints() {
endpointsMap[ep] = emptyStruct
Copy link
Contributor

Choose a reason for hiding this comment

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

why not put row59 behind row56?

Copy link
Contributor

Choose a reason for hiding this comment

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

it is incorrect to put it under line56. see #25010 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

ok. i see.

@xiang90 xiang90 added ok-to-merge lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed needs-ok-to-merge labels May 6, 2016
@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 6, 2016
@xiang90 xiang90 added release-note Denotes a PR that will be considered when it comes time to generate release notes. lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed release-note-label-needed labels May 6, 2016
@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 79a9a14 into kubernetes:master May 6, 2016
@hongchaodeng hongchaodeng deleted the cp branch May 10, 2016 18:21
@mqliang
Copy link
Contributor

mqliang commented May 11, 2016

@hongchaodeng @xiang90 Did this PR take multi API server into mind? If I have 3 API servers for HA, and I start those three API server every three minutes, will the actual compact interval becomes 3.3 minutes(instead of 10 minute)?

@timothysc
Copy link
Member

Come to think of it, we should probably input option all the way through the api-server.

@mqliang
Copy link
Contributor

mqliang commented May 11, 2016

May be it's a better choice to config the compact interval at etcd's server side, and only leader member could make compaction. Otherwise, when we have multi client, even we config them with same compact interval, the actual compact interval may doesn't agree with what we want, since those client may start at different time.

@hongchaodeng
Copy link
Contributor Author

One etcd cluster should only have one compactor.

Re. potential config possibilities, I don't want to add too much complexity but make it work at first. Will tackle it once having more use cases.

@timothysc
Copy link
Member

We should open a separate issue on this now.

@violalu
Copy link

violalu commented Jun 1, 2017

This will result in kube api server log:

E0531 13:59:04.624372 2949 watcher.go:188] watch chan error: etcdserver: mvcc: required revision has been compacted
E0531 16:49:23.451694 2949 watcher.go:188] watch chan error: etcdserver: mvcc: required revision has been compacted

@timothysc
Copy link
Member

@violalu we know this. Is there an issue that you are seeing?

@edevil
Copy link
Contributor

edevil commented Aug 1, 2017

Just to make it clear, are these messages benign?

I'm also seeing these "Warning" messages but have found no issue yet.

@kaybinwong
Copy link

is it better to set the api log level Warning, but not error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.