Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixed "got not my vb error" problem that was causing a "30 second timeou... #14

Closed
wants to merge 5 commits into from

3 participants

@defcube

...t" from the memcached client.

The code that was in there just had a little bug. I fixed a broken if statement and things started working. I tested this during a rebalance, saw the errors, and also saw my client continue to function fine.

@defcube

What does "The Travis build failed" mean? I think those unit tests are failing from other problems not related to my patch.

@defcube

If you want me to break up my other improvements, I can. I'm not sure if anyone is even checking github so I'm not gonna do the work until a committer requests it.

@dustin

The "Details" link above links to the details. It's possible the build setup itself is broken.

I don't work on this project, but lots of people (some of whom do) notice all of the messages that come through here. I can say your commit summaries are entirely too long, though. I'd be good if you rewrote them to be shorter. This is a good guide that comes up quickly in a google search and makes sense to me: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html

@defcube

Thanks Dustin. I appreciate the tips about the git commit messages. I had the right idea about a header line followed by a blank line, then paragraph. My header lines are just too long.

@defcube

And present tense. I have to break the habit of writing "Fixed XYZ"

defcube added some commits
@defcube defcube Fix broken "if" causing "got not my vb error" problem. effb673
@defcube defcube Raising better error in get_design_document. eac0421
@defcube defcube Improve view_results() in rest.client.
The rest client isn't doing json encoding on "startkey" and
"endkey" variables when calling view_results.  During the fix,
refactored to urllib.urlencode instead of constructing the url
by string concatenation.
276a808
@defcube

Dustin, I took your advice and edited my 3 commits.

@dustin

Thanks. I'm not sure who actually maintains this client, but they'll get back around to it and appreciate your cleanup effort.

defcube added some commits
@defcube defcube Fix startkey_docid problem
It was being json_encoded, so wrapped with quotes in most cases. This
prevented it from working properly.
2926291
@defcube defcube Improve design doc error parsing 449ae66
@ingenthr
Owner

This has been addressed with the new 0.10 and 0.11 releases, which change the library internals too.

@ingenthr ingenthr closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 14, 2012
  1. @defcube
  2. @defcube
  3. @defcube

    Improve view_results() in rest.client.

    defcube authored
    The rest client isn't doing json encoding on "startkey" and
    "endkey" variables when calling view_results.  During the fix,
    refactored to urllib.urlencode instead of constructing the url
    by string concatenation.
Commits on Dec 18, 2012
  1. @defcube

    Fix startkey_docid problem

    defcube authored
    It was being json_encoded, so wrapped with quotes in most cases. This
    prevented it from working properly.
  2. @defcube
This page is out of date. Refresh to see the latest.
Showing with 22 additions and 18 deletions.
  1. +1 −1  couchbase/couchbaseclient.py
  2. +21 −17 couchbase/rest_client.py
View
2  couchbase/couchbaseclient.py
@@ -86,7 +86,7 @@ def dispatch(self):
# if we get a not_my_vbucket then requeue item
# with fast forward map vbucket
self.log.error(ex)
- if 'vbucket' in ex:
+ if hasattr(ex, 'vbucket'):
self.reconfig_callback(ex.vbucket)
self.start_connection_callback(ex.vbucket)
else:
View
38 couchbase/rest_client.py
@@ -31,6 +31,10 @@
log = logger("rest_client")
+class DesignDocNotFoundError(Exception):
+ pass
+
+
#helper library methods built on top of RestConnection interface
class RestHelper(object):
def __init__(self, rest_connection):
@@ -207,7 +211,13 @@ def get_design_doc(self, bucket, design_doc):
json_parsed = json.loads(content)
if not status:
- raise Exception("unable to get design doc")
+ if json_parsed['reason'] == 'missing':
+ raise DesignDocNotFoundError(json_parsed)
+ elif json_parsed['reason'] == 'deleted':
+ raise DesignDocNotFoundError(json_parsed)
+ else:
+ raise Exception("unable to get design doc: {0}".format(
+ json_parsed))
return json_parsed
@@ -236,25 +246,19 @@ def get_view(self, bucket, design_doc, view):
return self.view_results(bucket, design_doc, view, {})
def view_results(self, bucket, design_doc, view, params, limit=100):
- api = '{0}/_design/{1}/_view/{2}'.format(bucket, design_doc, view)
- num_params = 0
+ myparams = dict()
if limit is not None:
- num_params = 1
- api += "?limit=%s" % (limit)
- for param in params:
- if num_params > 0:
- api += "&"
- else:
- api += "?"
- num_params += 1
- if param in ["key", "start_key", "end_key",
- "startkey_docid", "endkey_docid"] or \
- params[param] is True or \
+ myparams['limit'] = str(limit)
+ args_needing_jsonify = ["key", "start_key", "end_key",
+ "startkey", "endkey", "keys"]
+ for param, value in params.iteritems():
+ if param in args_needing_jsonify or params[param] is True or \
params[param] is False:
- api += "%s=%s" % (param, json.dumps(params[param]))
- else:
- api += "%s=%s" % (param, params[param])
+ value = json.dumps(value)
+ myparams[param] = value
+ api = '{0}/_design/{1}/_view/{2}?{3}'.format(bucket, design_doc, view,
+ urllib.urlencode(myparams))
headers = self._create_capi_headers()
status, content = self._http_request(api, headers=headers,
base=self.couch_api_base)
Something went wrong with that request. Please try again.