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

set WatchListPageSize when WatchError #13461

Open
4 tasks done
fyp711 opened this issue Aug 13, 2024 · 2 comments · May be fixed by #13466
Open
4 tasks done

set WatchListPageSize when WatchError #13461

fyp711 opened this issue Aug 13, 2024 · 2 comments · May be fixed by #13466
Labels
area/controller Controller issues, panics type/bug

Comments

@fyp711
Copy link
Contributor

fyp711 commented Aug 13, 2024

Pre-requisites

  • I have double-checked my configuration
  • I have tested with the :latest image tag (i.e. quay.io/argoproj/workflow-controller:latest) and can confirm the issue still exists on :latest. If not, I have explained why, in detail, in my description below.
  • I have searched existing issues and could not find a match for this bug
  • I'd like to contribute the fix myself (see contributing guide)

What happened? What did you expect to happen?

This submission is an optimization based on this #11343
Optimize two key points:

  1. Only set to empty when resourceVersion = 0
  2. Set the WatchListPageSize property to ensure pagination

Version(s)

3.4.9

Paste a minimal workflow that reproduces the issue. We must be able to run the workflow; don't enter a workflows that uses private images.

None

Logs from the workflow controller

None

Logs from in your workflow's wait container

None
@fyp711 fyp711 changed the title Always set ResourceVersion="" may make etcd overload 【discuss】Always set ResourceVersion="" may make etcd overload Aug 13, 2024
@fyp711 fyp711 changed the title 【discuss】Always set ResourceVersion="" may make etcd overload [discuss] Always set ResourceVersion="" may make etcd overload Aug 13, 2024
@agilgur5 agilgur5 added the area/controller Controller issues, panics label Aug 13, 2024
@agilgur5 agilgur5 changed the title [discuss] Always set ResourceVersion="" may make etcd overload [discuss] Setting ResourceVersion="" may overload etcd Aug 13, 2024
@fyp711
Copy link
Contributor Author

fyp711 commented Aug 27, 2024

Could someone help review this? #13466 Thanks!

@fyp711 fyp711 changed the title [discuss] Setting ResourceVersion="" may overload etcd fix(controller): set WatchListPageSize when WatchError Sep 18, 2024
@fyp711
Copy link
Contributor Author

fyp711 commented Sep 18, 2024

Setting WatchListPageSize can better ensure the use of pagination queries.

Below code is a part of reflector.go.

         ...
	switch {
	case r.WatchListPageSize != 0:
		pager.PageSize = r.WatchListPageSize
	case r.paginatedResult:
		// We got a paginated result initially. Assume this resource and server honor
		// paging requests (i.e. watch cache is probably disabled) and leave the default
		// pager size set.
	case options.ResourceVersion != "" && options.ResourceVersion != "0":
		// User didn't explicitly request pagination.
		//
		// With ResourceVersion != "", we have a possibility to list from watch cache,
		// but we do that (for ResourceVersion != "0") only if Limit is unset.
		// To avoid thundering herd on etcd (e.g. on master upgrades), we explicitly
		// switch off pagination to force listing from watch cache (if enabled).
		// With the existing semantic of RV (result is at least as fresh as provided RV),
		// this is correct and doesn't lead to going back in time.
		//
		// We also don't turn off pagination for ResourceVersion="0", since watch cache
		// is ignoring Limit in that case anyway, and if watch cache is not enabled
		// we don't introduce regression.
		pager.PageSize = 0
	}

	list, paginatedResult, err = pager.List(context.Background(), options)
	...

@agilgur5 agilgur5 changed the title fix(controller): set WatchListPageSize when WatchError set WatchListPageSize when WatchError Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/controller Controller issues, panics type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants