couchbaselabs / cbfs

Distributed Blobstore using Couchbase Server
http://dustin.github.com/2012/09/27/cbfs.html
Apache License 2.0
188 stars 40 forks source link

Error updating space used: Expected 1 result, got [] #136

Closed tleyden closed 9 years ago

tleyden commented 9 years ago

I'm following these instructions to run cbfs, and when I startup the first node, I see these errors:

2014/11/14 23:18:58 Error checking view version: MCResponse status=KEY_ENOENT, opcode=GET, opaque=0, msg: Not found
2014/11/14 23:18:58 Error removing 10.51.177.81's task list: MCResponse status=KEY_ENOENT, opcode=DELETE, opaque=0, msg: Not found
2014/11/14 23:19:05 Error updating space used: Expected 1 result, got []

full logs here

Should I be worried about these errors? In particular, the "Error updating space used: Expected 1 result, got []" error?

They don't seem to cause any issues.

mschoch commented 9 years ago

First,

2014/11/14 23:18:58 Error checking view version: MCResponse status=KEY_ENOENT, opcode=GET, opaque=0, msg: Not found

This is expected when you start the first cbfs node against an empty bucket. The view marker does not exist yet. If you see this unexpectedly its a good indication you might have pointed to the wrong bucket.

Likewise I believe,

2014/11/14 23:18:58 Error removing 10.51.177.81's task list: MCResponse status=KEY_ENOENT, opcode=DELETE, opaque=0, msg: Not found

is somewhat similar. When nodes boot up, one of the first things they try to do is clear their own task list. On first launch, their task list doesn't exist yet. On subsequent launches it will exist from previous runs.

The last message:

2014/11/14 23:19:05 Error updating space used: Expected 1 result, got []

is the only one that looks like it might be a bug. The message happens when the node looks at the contents of a view containing spaced used statistics, keyed with the nodes own ID. This should always be length1, but in this case it was length zero. It looks like we didn't set stale=false, so probably the first time we hit this the index hadn't been built yet, so we got an empty result. We could try adding stale=false here, but its pretty minor unless you're seeing it repeatedly.

See https://github.com/couchbaselabs/cbfs/blob/8497f58401392162be931b716885306c565d6774/heartbeat.go#L43-L65

tleyden commented 9 years ago

I'm trying to wrap my head around the cbfs design .. so had a few questions on your comments.

the view marker does not exist yet

What is the view marker and what does it do?

one of the first things they try to do is clear their own task list.

What kinds of things would be on a node's task list?

We could try adding stale=false here, but its pretty minor unless you're seeing it repeatedly.

Ok good to know. That makes sense .. it also explains why I saw it when I started the first cbfs node, but not subsequent nodes.

mschoch commented 9 years ago

What is the view marker and what does it do?

It records which version of the design documents are deployed. If the node has newer versions (in code) than are currently deployed, it will update them. See my Couchbase Connect presentation for examples.

What kinds of things would be on a node's task list?

A healthy cbfs cluster is maintained by all of the nodes periodically running various jobs. I don't have all the details in front of me, but I believe when nodes are running a job, they record this job as being in the running state in their task list.

On a running cluster you can see the task list of all the nodes in the cluster using the URL:

http://cbfs:8484/.cbfs/tasks/

Here is a sample output I see on our clutser:

{
  "node1": {
    "checkTime": {
    "state": "running",
    "ts": "2014-11-12T08:31:19.1665174Z"
    }
  },
  "node2": {
    "validateLocal": {
    "state": "running",
    "ts": "2014-11-08T12:29:31.581193182Z"
    }
  }
}