Multiple load comments

catch - June 26, 2009 - 00:47
Project:Drupal
Version:7.x-dev
Component:comment.module
Category:task
Priority:normal
Assigned:catch
Status:closed
Description

Patch needs docs for hook_comment_load() and some cleanup - we should should remove hook_comment_view() entirely most likely. This patch is a prerequisite to fieldable comments.

One fail locally which I can't reproduce manually.

AttachmentSizeStatusTest resultOperations
comment_load_multiple.patch6.01 KBIdleFailed: 11788 passes, 1 fail, 0 exceptionsView details

#1

catch - June 28, 2009 - 01:46
Status:needs work» needs review

Fixed a join coming after an addField() pointed out by sun in irc. Setting to CNR so the test bot can knock back for that weird test failure - the issue is that when deleting a tree of comments, simpletest can still see the replies - however I can't reproduce this at all manually.

AttachmentSizeStatusTest resultOperations
comment_load_multiple.patch6.29 KBIdleFailed: 11771 passes, 1 fail, 0 exceptionsView details

#2

sun - June 28, 2009 - 01:48

+      $comment = current(comment_load_multiple(array('cid' => $cid, 'status' => COMMENT_PUBLISHED)));

What about that comment_load() stub function?

#3

catch - June 28, 2009 - 01:56

That'd mean adding either a $status parameter to comment_load(), or always setting status within the function. Not sure about that inconsistency vs. node/user/file/taxonomy term/vocabulary loading.

#4

catch - June 28, 2009 - 02:08

Here's a version with additional assertion in the test showing that the cid for the deleted comment which is displaying is no longer in the database. Very odd.

AttachmentSizeStatusTest resultOperations
comment_load_multiple.patch8.77 KBIdleFailed: 11789 passes, 1 fail, 0 exceptionsView details

#5

System Message - June 28, 2009 - 02:25
Status:needs review» needs work

The last submitted patch failed testing.

#6

catch - June 28, 2009 - 10:21
Assigned to:Anonymous» catch
Status:needs work» needs review

Fixed the test - needed to make sure either $cids or $conditions were populated in the query. Also added docs for the new hook_comment_load().

AttachmentSizeStatusTest resultOperations
comment_load_multiple.patch7.28 KBIdleFailed: 11661 passes, 17 fails, 11 exceptionsView details

#7

System Message - June 28, 2009 - 11:05
Status:needs review» needs work

The last submitted patch failed testing.

#8

andypost - June 28, 2009 - 11:06
Status:needs work» needs review

bot failed, retest

#9

System Message - June 28, 2009 - 11:20
Status:needs review» needs work

The last submitted patch failed testing.

#10

catch - June 28, 2009 - 11:24
Status:needs work» needs review

#11

andypost - June 28, 2009 - 11:25

retest again

#12

System Message - June 28, 2009 - 12:07
Status:needs review» needs work

The last submitted patch failed testing.

#13

moshe weitzman - June 28, 2009 - 12:08
Status:needs work» needs review

foreach (module_implements('comment_load') as $module) {

I think a module_invoke_all() would be more effective here. The implementations can still alter $comments by reference. module_invoke_all() does a drupal_function_exists() which this code lacks.

Otherwise, looks very nice.

#14

catch - June 28, 2009 - 19:21

Re-rolled with module_invoke_all() and a slight cleanup. I'd like to see this go in fairly quickly so work on #504666: Make comments fieldable can begin.

AttachmentSizeStatusTest resultOperations
comment_load_multiple.patch7.18 KBIdleFailed: Failed to apply patch.View details

#15

catch - June 28, 2009 - 21:01

Having trouble both with the D6/7 upgrade path and devel generate which makes it hard to benchmark, so this is on one node and one comment:

ab -c1 -n500 node/72

HEAD:
Requests per second:    9.46 [#/sec] (mean)
Time per request:       105.719 [ms] (mean)
Time per request:       105.719 [ms] (mean, across all concurrent requests)
Transfer rate:          79.96 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:    94  106  11.0    101     153
Waiting:       74   97  10.9     94     148
Total:         95  106  11.0    101     153

Patch:

Requests per second:    9.39 [#/sec] (mean)
Time per request:       106.475 [ms] (mean)
Time per request:       106.475 [ms] (mean, across all concurrent requests)
Transfer rate:          79.57 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:    96  106  11.9    100     159
Waiting:       73   99  11.7     94     146
Total:         96  106  11.9    101     159

#16

moshe weitzman - June 29, 2009 - 02:25
Status:needs review» reviewed & tested by the community

looks strong to me.

making comments fieldable sure sounds like lipstick on a pig to me. comment's code is so tangled.

#17

catch - June 29, 2009 - 08:59

Well it is and it isn't. Having to either run an extra module just to get file uploads on comments (like Drupal.org does) adds a lot of cruft, making comments fieldable should be a very small amount of code hopefully, and means we'd be able to use a core filefield module for the issue queue on Drupal.org for example. See #504678: Use objects in the comments API for the other pre-requisite cleanup patch.

#18

System Message - July 2, 2009 - 03:00
Status:reviewed & tested by the community» needs work

The last submitted patch failed testing.

#19

catch - July 2, 2009 - 08:57
Status:needs work» needs review

Re-rolled.

AttachmentSizeStatusTest resultOperations
comment_load_multiple.patch6.68 KBIdlePassed: 11567 passes, 0 fails, 0 exceptionsView details

#20

catch - July 2, 2009 - 09:42
Status:needs review» reviewed & tested by the community

Back to RTBC.

#21

webchick - July 10, 2009 - 05:50
Status:reviewed & tested by the community» needs work

This patch is consistent with other _load_multiple() patches, and coding style looks good. Committed to HEAD.

Needs upgrade docs.

#22

catch - July 10, 2009 - 07:27
Status:needs work» fixed

Thanks!

Added to upgrade docs.

#24

System Message - August 3, 2009 - 06:50
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.