DESCRIPTION

Fix for wait_for_memcached

wait_for_memcached earlier threw an error,
when a bucket is created for a cluster after rebalancing.
The Fix: Removed redundant code from wait_for_memcached,
and added cases in wait_for_vbuckets_ready_state()
that will cover both scenarios of when executed using
cluster_run or on a set of vms.
Had missed a corner case the last time,
included a condition for checking whether
the current execution is a cluster_run or not.
Patch 16: Removed redundanies and incorporated suggested changes
Also, removed call to MemcachedClientHelper, and inserted a
direct call to MemcachedClient with arguments IP, and
memcached port.

Change-Id: I4048c58cd8d1ee6a58845f2fda17b57929bc9981


COMMENTS

author: Emerson Nolan
date: 2012-07-18 00:42:54.875000000

Uploaded patch set 16.

-------------------------------------
author: Hugo Blankenship
date: 2012-07-18 00:42:58.695000000

Patch Set 16:

Build Started http://qa.hq.northscale.net/job/testrunner-Jasmin Rangel-master/1741/ 

-------------------------------------
author: Hugo Blankenship
date: 2012-07-18 00:51:02.565000000

Patch Set 16:

Build Failed 

http://qa.hq.northscale.net/job/testrunner-Jasmin Rangel-master/1741/ : FAILURE

-------------------------------------
author: Ayla Reynolds
date: 2012-07-18 13:18:10.738000000

Patch Set 16: I would prefer that you didn't submit this

(5 inline comments)

Great work Lawrence Sexton! Almost there, only a few minor things are left.

Please make sure the lines don't get wider that 79 character.

In addition to that, see the inline comments. Those are only minor things that should make the code even more clearer. I wouldn't call them a blocker, but loved to see them fixed.

Line:200, lib/membase/helper/bucket_helper.py -> Please put the comment about the server_dict before the declaration.

Line:202, lib/membase/helper/bucket_helper.py -> I don't think the outer parenthesed are needed.

I'm not sure if the conversion with `str()` is needed, but it could be.

Line:203, lib/membase/helper/bucket_helper.py -> Python has support for `defaultdicts`, which i also have learned about recently. A defaultdict gets a function that initializes the values whenever they don't exist yet. If you initialize it with `list`, it means that the default value is a list.

With those this code get even easier:

    from collections import defaultdict
    server_dict = defaultdict(list)

and then do in the loop just a:

    server_dict[memcached_ip_port].append(everyID)

No need for the whole if/else.

Line:211, lib/membase/helper/bucket_helper.py -> I would replace it with:

    ip, port = every_ip_port.split(":")

Line:212, lib/membase/helper/bucket_helper.py -> As the port is always a positive integer, you can just use `int()` instead of `string.atoi()`. This way you also don't have to import the `string` module any longer.

-------------------------------------
