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

Funnel peerAdd and peerDelete in a channel #1861

Merged
merged 1 commit into from
Jul 31, 2017

Conversation

fcrisciani
Copy link

Remove the need for the wait group and avoid new
locks

Signed-off-by: Flavio Crisciani flavio.crisciani@docker.com

@fcrisciani fcrisciani force-pushed the waitgrp_channel branch 4 times, most recently from 213758a to 4b78d93 Compare July 27, 2017 22:05
Copy link
Contributor

@mavenugo mavenugo left a comment

Choose a reason for hiding this comment

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

LGTM

common/caller.go Outdated

func callerInfo(i int) (string, string, int, bool) {
ptr, file, line, ok := runtime.Caller(i)
var funName string
Copy link
Contributor

Choose a reason for hiding this comment

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

nit : "fun"Name ? :) .... is fName good enough ?

Copy link
Author

Choose a reason for hiding this comment

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

ok, no fun in production code :P

funName, _, _, ok = fun5()
if !ok || funName != "fun5" {
t.Fatalf("error on fun5 caller %t, %s", ok, funName)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

These are certainly fun tests.. hence am okay for the fun%d function names ;)

@fcrisciani fcrisciani force-pushed the waitgrp_channel branch 2 times, most recently from 110607b to 70fa7f2 Compare July 29, 2017 00:18
@fcrisciani
Copy link
Author

Addressed the review comments, submitted the new patch, but let's wait to merge, I will test it locally to be safe, will post here once I've done that

@fcrisciani
Copy link
Author

fcrisciani commented Jul 29, 2017

@mavenugo ok tested the following way:

  1. vendored this patch on latest moby master and build the binaries
  2. created a 3 node cluster (1 manager, 2 workers)
  3. created 100 services with 1 replica each
  4. validate for each container:
    a) nslookup tasks count for each service
    b) number of ipvs rules in each namespace
    c) icmp to all the services

The result is PASS, grep also for error messages from the peer go routine, did not find any
LMK if you want to test something else specifically

common/caller.go Outdated

// CallerName returns the name of the function at the specified level with additional information
// level == 0 means current method name
func CallerName(level int) (string, string, int, bool) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can this just return the function name. I don't think we will be using file and line number at all. We can use this directly in other debugs we have. I have closed the context PR #1835 because we can use this instead.

Copy link
Author

@fcrisciani fcrisciani Jul 31, 2017

Choose a reason for hiding this comment

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

ok will change it then

@@ -0,0 +1,49 @@
package common
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO I don't think we need tests for this because runtime.Caller() and runtime.FuncForPC() is part of runtime package. I don't think we should test the runtime package in libnetwork library.

Copy link
Author

Choose a reason for hiding this comment

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

CallerName is not coming from the runtime, but is simply using some of the runtime functions, so I should be verified that the method results respects the method description

Remove the need for the wait group and avoid new
locks
Added utility to print the method name and the caller name

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
@thaJeztah
Copy link
Member

thaJeztah commented Aug 4, 2017

back ported to 17.06: #1869 and 17.03: #1870

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