function realname_update_index() {
...
$result = db_query_range("SELECT uid, name FROM {users} WHERE status=1 AND uid>=%d", $start, 0, $limit);
while ($account = db_fetch_object($result)) {
...
variable_set('realname_last_index', $account->uid);
}
}
}
realname_update_index() function re-index items and remembers last reindexed user. Unfortunately, "select ..." query does not use "ORDER BY" clause so order of re-indexing is not defined. It means if there are 10 users to be reindexed and their UIDs are 1..10 then MySQL can return these in any order, for example 2,3,4,5,6,7,8,9,10,1. As result, 'realname_last_index' variable will remember 1 as last re-indexed user and it will cause full re-indexing of the same data again.
Proposed change - order users by UID before re-indexing, i.e.
function realname_update_index() {
...
$result = db_query_range("SELECT uid, name FROM {users} WHERE status=1 AND uid>=%d ORDER BY uid", $start, 0, $limit);
Best regards, Alexander Pavlov.
Comments
Comment #1
gappleRolled into a patch
Comment #3
gappleRTBC, since I just created the patch from @avpavlov's code snippets. Simple and logical fix.
Comment #5
gappleWasn't expecting testbot here...
Here's a patch with UNIX line endings for testbot.
Comment #6
gapplestatus...
Comment #7
dave reidThanks for the patch. Committed as a part of http://drupal.org/cvs?commit=442626