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

standardize binder cache store #52

Merged
merged 1 commit into from
Jun 19, 2024

Conversation

yuey002
Copy link
Contributor

@yuey002 yuey002 commented May 31, 2024

Fist half of the second step of #45

Standardize binder cache implementation based on the common store interface.

@yuey002 yuey002 requested a review from binacs May 31, 2024 20:49
@yuey002 yuey002 force-pushed the dev/migrate-binder-cache branch 6 times, most recently from 19266f2 to fb148e5 Compare June 5, 2024 23:28
@yuey002 yuey002 changed the title WIP: standardize binder cache store standardize binder cache store Jun 5, 2024
pkg/binder/cache/commonstores/node_store/node_store.go Outdated Show resolved Hide resolved
pkg/binder/cache/commonstores/node_store/node_store.go Outdated Show resolved Hide resolved
@@ -260,6 +268,8 @@ func (binder *Binder) CheckAndBindUnit(ctx context.Context) bool {
klog.InfoS("Failed to check stage for unit", "stageIndex", i, "stageName", stage.stageName, "unitKey", unit.GetKey(), "err", err)
}

klog.V(4).InfoS("Finish to check stage for unit", "stageIndex", i, "stageName", stage.stageName, "unitKey", unit.GetKey())
Copy link
Member

Choose a reason for hiding this comment

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

good catch

@binacs
Copy link
Member

binacs commented Jun 10, 2024

lgtm overall, just nits

@yuey002 yuey002 force-pushed the dev/migrate-binder-cache branch from fb148e5 to bcf1995 Compare June 10, 2024 18:28
@yuey002
Copy link
Contributor Author

yuey002 commented Jun 10, 2024

@lzlaa Could you also help take a look at this PR when getting a chance? Thank you.

binacs
binacs previously approved these changes Jun 10, 2024

// TODO: Extend the metrics related.
// updateMetrics updates cache size metric values for pods, assumed pods, and nodes
func (cache *binderCache) updateMetrics() {
cache.mu.Lock()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just RLock、RUnlock is ok,since there no update operation for PodStore or NodeStore

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's only read operation for PodStore or NodeStore; however, there's update on binder cache size. If we use read lock, multiple threads can call updateMetrics() and modify the only binder cache size. Thoughts?

Copy link
Member

@binacs binacs Jun 15, 2024

Choose a reason for hiding this comment

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

I also prefer to keep the use of write lock.

pkg/binder/cache/cache.go Outdated Show resolved Hide resolved
@NickrenREN NickrenREN merged commit 114226d into kubewharf:main Jun 19, 2024
5 checks passed
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.

4 participants