how to fsync lock /unlock from pymongo : failed: no such cmd

1,043 views
Skip to first unread message

kevin

unread,
Sep 24, 2010, 8:19:02 PM9/24/10
to mongod...@googlegroups.com
getting this error

>>> conn.admin.command({'fsync':1})
{u'ok': 1.0, u'numFiles': 3}
>>> conn.admin.command({'fsync':1, 'lock':1})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.macosx-10.6-universal/egg/pymongo/database.py", line 292, in command
  File "build/bdist.macosx-10.6-universal/egg/pymongo/helpers.py", line 116, in _check_command_response
pymongo.errors.OperationFailure: command {'lock': 1, 'fsync': 1} failed: no such cmd
>>> pymongo.version
'1.8.1+'

mongodb version 1.6.2

can you tell how to lock+fsync and then unlock from pymongo without errors
thanks

kevin

unread,
Sep 24, 2010, 8:19:46 PM9/24/10
to mongod...@googlegroups.com

Michael Dirolf

unread,
Sep 24, 2010, 8:24:25 PM9/24/10
to mongod...@googlegroups.com
conn.admin.command("fsync", lock=True)

Try the pymongo docs for the command method - it talks about the
different ways to call the method.

> --
> You received this message because you are subscribed to the Google Groups
> "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to
> mongodb-user...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/mongodb-user?hl=en.
>

kevin

unread,
Sep 24, 2010, 8:26:19 PM9/24/10
to mongod...@googlegroups.com
and this to unlock?
conn.admin['$cmd'].sys.unlock.find_one()

Michael Dirolf

unread,
Sep 24, 2010, 8:27:34 PM9/24/10
to mongod...@googlegroups.com
yes

Adam Fields

unread,
Sep 24, 2010, 8:35:50 PM9/24/10
to mongod...@googlegroups.com
On Fri, Sep 24, 2010 at 08:24:25PM -0400, Michael Dirolf wrote:
> conn.admin.command("fsync", lock=True)
>
> Try the pymongo docs for the command method - it talks about the
> different ways to call the method.

This is such a common question, and such a common thing to want to do,
that it would be really nice if all of the various drivers had
universal top-level support for something like conn.lock and
conn.unlock.

It should not be this difficult to figure out how to safely back up
the db.

--

- Adam
----------
If you liked this email, you might also like:
"Here's a little bookmarklet for turning github into rdoc"
-- http://workstuff.tumblr.com/post/1036575859
"Sous Vide French Toast"
-- http://www.aquick.org/blog/2010/09/22/sous-vide-french-toast/
"Sous Vide French Toast"
-- http://www.flickr.com/photos/fields/5012057777/
"fields: 'Mid-App Collision': when two people are both typing on their phones o..."
-- http://twitter.com/fields/statuses/25413388498
----------
** I design intricate-yet-elegant processes for user and machine problems.
** Custom development project broken? Contact me, I can help.
** Some of what I do: http://workstuff.tumblr.com/post/70505118/aboutworkstuff

[ http://www.adamfields.com/resume.html ].. Experience
[ http://www.morningside-analytics.com ] .. Latest Venture
[ http://www.confabb.com ] ................ Founder

kevin

unread,
Sep 24, 2010, 8:48:29 PM9/24/10
to mongod...@googlegroups.com
On Fri, Sep 24, 2010 at 5:35 PM, Adam Fields <fie...@street86.com> wrote:
On Fri, Sep 24, 2010 at 08:24:25PM -0400, Michael Dirolf wrote:
> conn.admin.command("fsync", lock=True)
>
> Try the pymongo docs for the command method - it talks about the
> different ways to call the method.

This is such a common question, and such a common thing to want to do,
that it would be really nice if all of the various drivers had
universal top-level support for something like conn.lock and
conn.unlock.

It should not be this difficult to figure out how to safely back up
the db.

+10
please add this
conn.lock
conn.unlock

atleast for pymongo, would be great

Michael Dirolf

unread,
Sep 27, 2010, 11:02:58 AM9/27/10
to mongod...@googlegroups.com
Adding something like that might make sense - can you file a feature
request on jira for this please?

kevin

unread,
Sep 27, 2010, 11:09:28 AM9/27/10
to mongod...@googlegroups.com

Michael Dirolf

unread,
Sep 27, 2010, 11:13:24 AM9/27/10
to mongod...@googlegroups.com
Thanks!

Adam Fields

unread,
Sep 27, 2010, 2:46:13 PM9/27/10
to mongod...@googlegroups.com
On Mon, Sep 27, 2010 at 11:13:24AM -0400, Michael Dirolf wrote:
> Thanks!
>
> On Mon, Sep 27, 2010 at 11:09, kevin <kevincas...@gmail.com> wrote:
> > http://jira.mongodb.org/browse/PYTHON-164

Also:

http://jira.mongodb.org/browse/RUBY-184

--
- Adam
----------
If you liked this email, you might also like:
"Here's a little bookmarklet for turning github into rdoc"
-- http://workstuff.tumblr.com/post/1036575859
"Sous Vide French Toast"
-- http://www.aquick.org/blog/2010/09/22/sous-vide-french-toast/
"Sous Vide French Toast"
-- http://www.flickr.com/photos/fields/5012057777/

"fields: They finally found a good use for Elmo: http://bit.ly/aCUGpf"
-- http://twitter.com/fields/statuses/25688211830

Reply all
Reply to author
Forward
0 new messages