Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The queue API is designed to be scalable. People apparently want to do ACID stuff with it as witnessed in #89181: Use queue API for node and comment, user, node multiple deletes . We should provide a way to make sure you get yourself a ACID queue. One way is to simple use SystemQueue directly. Another is that queue classes tell whether they scale or they are ACID and tasks are allowed to pick.
Comment | File | Size | Author |
---|---|---|---|
#32 | 782616-32.DrupalQueueReliableInterface.patch | 5.68 KB | dww |
#28 | 782616-28.DrupalQueueReliableInterface.patch | 5.68 KB | dww |
#26 | 782616-25.patch | 13.81 KB | chx |
#23 | 782616-23.patch | 13.81 KB | chx |
#12 | strict_queue.patch | 5.73 KB | chx |
Comments
Comment #1
chx CreditAttribution: chx commentedOnce again: we might want to say that for Drupal 7 the only way to is to adjust the documentation to say use SystemQueue if you dont care scalability but need things done 100%. Yay, CAP theorem.
Comment #2
chx CreditAttribution: chx commentedImplementing this is very very easy: just create another interface.
Comment #3
chx CreditAttribution: chx commentedUh oh :)
Comment #4
mr.baileysLike the approach and would help move #89181: Use queue API for node and comment, user, node multiple deletes forward (if we decide to go with the Queue implementation).
Only had time for a quick review, sorry:
...the queue being...
Classes implementing ...
edit: wrong link.
Powered by Dreditor.
Comment #5
dwwThis would be a good change. update.module definitely uses the Queue API in a way that would be better using the "strict" interface. Sometimes you need different queue semantics, and there's no way for the API to know that -- only the "customer" of the API can decide what semantics they need and what tradeoffs they're willing to make. Given that update.module wants a strict queue, we want strict for #89181: Use queue API for node and comment, user, node multiple deletes, and yet we want non-strict for aggregator feeds, etc, it'd be good to make this interface change directly to the Queue API itself in D7 core -- we've already got "customers" in core that want both interfaces...
However, this at least needs work for:
A) The typos mr.baileys points out in #4.
B) It seems like the queue_default_strict_class variable should to be documented somewhere in the PHPDoc, probably the block for DrupalQueueStrictInterface. I'm also wondering about adding a @see to the block for DrupalQueueInterface that points to DrupalQueueStrictInterface, since otherwise it's not obvious how developers will know they have a choice in what kind of queue semantics they want to use.
C) I'm a bit concerned about calling this parameter and interface "Strict". I'm not sure that's the most self-documenting name for it, but I don't have a better alternative right now...
Comment #6
Crell CreditAttribution: Crell commentedThis is why we should always have a definition hook for swappable components like this, even if it doesn't seem like we need it immediately; that's where this sort of metadata belongs. Not implementing it that way originally was a mistake. Unfortunately, I doubt we can fix that at this stage. Let this be an object lesson for later. (Pun very much intended. :-) )
With that said, using an interface will work and is probably the best we can do even if yet-another-variable and an empty interface is kind of a hack. I agree that this is an important designation to have. We can switch it to a definition hook and get rid of the flagging interface in Drupal 8.
I'd probably put all of the documentation about strict mode in the DrupalQueueInterface doblock, so that it's all in one place. Unless we have a @group definition for it already.
As for "strict", maybe "ordered"? True insists on getting back an order-guaranteed queue, False doesn't care.
Comment #7
chx CreditAttribution: chx commentedToooooons of comments.
Comment #9
chx CreditAttribution: chx commented#7: strict_queue.patch queued for re-testing.
Comment #11
mr.baileysPatch prevents installation with fatal errors:
Comment #12
chx CreditAttribution: chx commentedLess is more, apparently
Comment #13
aspilicious CreditAttribution: aspilicious commentedSrry to interupt but the doxygen police is back in town.
Chx already knows what to adjust ;).
Ow btw the *new* class doxygen style proposal (for classes, interfaces, ...) is almost accepted.
So if you wonna be übercool you can read that proposal to ;)
==> http://drupal.org/node/718596
Comment #14
dwwI'm tempted by Crell's proposal in #6 to use "ordered" instead of "strict" for the interface and get() argument. In some ways, it's more self-documenting, since "strict" could mean just about anything. However, "ordered" doesn't necessarily have to imply "we execute everything in the queue". There are certainly systems that run in order but don't guarantee that nothing is ever dropped. Furthermore, if you know anything about queues and you have to choose between "ordered" vs. "unordered", you're going to think "FIFO" vs. "set". You'd probably assume that the only consequence of selecting a "non-ordered" queue is that your tasks could execute in any order. You wouldn't necessarily assume that "unordered" really means "best effort, we might loose some of your work". So, I think "ordered" would do more harm to developer expectations than it would help clarify WTF "strict" means.
So, we still don't have a good name for this. :( You'd think after dealing with job schedulers and queue systems for over a decade for my previous day job, I'd have a ton of potential terms to use for this, but sadly I'm mostly drawing a blank. ;) "(Non)deterministic" comes to mind, but it's not great, either. Unless we find a better name, I'm prepared to support this as "strict", but I'm not RTBC'ing yet.
Comment #15
aspilicious CreditAttribution: aspilicious commentedWell apparently he doesn't....
could you change get to gets (I know it was there before the patch)
And put a newline after the @param block
Comment #16
chx CreditAttribution: chx commentedGuaranteed queue maybe?
Comment #17
dwwYeah, that's pretty good. I'd certainly prefer "guaranteed" to "strict", even if it is a few more keystrokes to type. It's still unclear what's being guaranteed, but I don't think we'll get the perfect one word that covers all the semantics we're offering. If nothing better comes along, I'd be okay with that...
Thanks,
-Derek
Comment #18
mr.baileysWhat about "reliable"?
Comment #19
jbrown CreditAttribution: jbrown commentedThis seems analogous to UDP vs. TCP.
TCP is often described as "reliable".
Comment #20
dwwIt's funny, I was going to mention UDP in my comment #14. ;) I like "reliable" even more than "guaranteed", and therefore definitely much more than "strict". I don't want this to turn into a monster bikeshed (bikethread?) ;) so let's just go with "reliable". It's certainly the best option we have so far, and while self-documenting names are important, it's even more important that we get this change in ASAP. ;)
So, needs work for s/strict/reliable/ to the patch in #12. After that, and fixing the PHPDoc conventions from #15, this is RTBC.
Thanks, everyone!
Comment #21
Crell CreditAttribution: Crell commentedJust to be annoying, I will point out that if it is not a guaranteed ordered FIFO data structure then it's not really a queue. It's technically a "sac" or "bag" depending on if it's unique or not. Queues by definition are FIFO data structures.
Comment #22
dwwYes, yes, we know. ;) Hence, an "Unreliable" queue.
Besides, "queue" is used to describe lots of things that aren't strictly FIFO, e.g. the "issue queue".
Comment #23
chx CreditAttribution: chx commentedI am not changing get to gets,
Gets a queue object for a given name.
does not make any sense. I have changed toReturn the queue object for a given name.
other parts of core use the exact same wording. So if this is a problem then we can tackle them together in a followup issue. This holds up a critical.Comment #24
Dries CreditAttribution: Dries commented#823500: $is_https should always reflect $_SEVER['HTTPS'] even if $base_url is http seems to have been merged in the latest patch.
Comment #25
dwwRight, #23 isn't RTBC at all. ;)
Yay for "reliable".
Not to split hairs, but I wonder if "DrupalQueueReliableInterface" or "DrupalReliableQueueInterface" makes more sense. It's an interface for a reliable queue, not a reliable interface for a queue... ;)
Comment #26
chx CreditAttribution: chx commentedComment #27
dww@chx: you've done it again. This issue is just for the reliable queue interface and doc changes. Please don't set this to RTBC yourself. I promise we'll RTBC quickly once you post the right patch. ;)
Comment #28
dwwHere's the patch just for DrupalQueueReliableInterface. Still not sure if I like that or would prefer "DrupalReliableQueueInterface", but I don't think it's worth holding this up any longer over...
Comment #29
chx CreditAttribution: chx commentedAnd what now that you posted the right patch? Am I still forbidden from setting to RTBC :) ?
Comment #30
aspilicious CreditAttribution: aspilicious commentedReturn => Returns
(I wish I just could edit that in your patch without making a new one...)
Comment #31
chx CreditAttribution: chx commented#30, read #23 we are not fixing this in this issue but in a followup together with other same wording.
Comment #32
dwwFixes #30... whatever. Someone please RTBC. ;)
Comment #33
aspilicious CreditAttribution: aspilicious commentedOk chx missed that one... I'm ok with that.
I can't rtbc.
Comment #34
moshe weitzman CreditAttribution: moshe weitzman commentedseems like everyone likes this patch but is too chickenshit to rtbc. hah. rtbc it is.
Comment #35
Dries CreditAttribution: Dries commentedLooks clean and works. Committed to CVS HEAD. Thanks.
Comment #36
dwwThanks for the commit. FYI: #827150: Use DrupalQueueReliableInterface for update manager queue operations if anyone's interested. Also, better title for people who don't know WTF "ACID" means in this context... ;)