Project

General

Profile

Actions

Support #19998

closed

librados aio callbacks thread safety

Added by Alexey Knyshev almost 7 years ago. Updated almost 7 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
librados
Target version:
-
% Done:

0%

Tags:
Reviewed:
Affected Versions:
Pull request ID:

Description

As stated in documentation (http://docs.ceph.com/docs/master/rados/api/librados/#asychronous-io):

The callbacks are called in order of receipt, so the safe callback may be triggered before the complete callback, and vice versa.

Does it mean the following: if I want to react only on ack event as soon as possible should I register both callbacks (cb_complete, cb_safe) and do the needful in the first called whether complete or safe called. If so, should I protect some non-thread safe data in this callbacks or in other words: "Is it possible that this two callbacks would be called in different threads inside librados?"

And in addition, does it apply to libradosstripper too?

Actions #1

Updated by Greg Farnum almost 7 years ago

  • Status changed from New to Resolved

The librados API does not specify an order to the callbacks or guarantee you will only get one at a time. You should protect them.
I presume the same applies to libradosstriper but that was a pretty drive-by contribution so you'd have to dig through the code to check (it might pass everything through a single-threaded Finisher or something).

In practice, I think we have a single Finisher thread that all callbacks get activated through. But you definitely can't count on that as it's pretty likely to change in the future to enable faster throughput.

Actions

Also available in: Atom PDF