The pager does not count source strings per page but seems to count destination strings.
Example:
Pager setting 5 -> page 1: 2 src, 5 dst, page 2: 2 src, 6 dst
Pager setting 10 -> page 1: 4 src, 11 dst, page 2: 6 src, 12 dst
Pager setting 20 -> page 1: 9 src, 21 dst, page 2: 13 src, 21 dst
Pager setting 30 -> page 1: 16 src, 31 dst, page 2: 18 src, 30 dst
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | pager.patch | 3.48 KB | droplet |
| #16 | translation-pager-query.patch | 3.47 KB | gábor hojtsy |
| #13 | query.patch | 2.54 KB | droplet |
| #11 | query_count.patch | 2.55 KB | droplet |
| #7 | 745358-l10n-count-d6.patch | 1.72 KB | andypost |
Comments
Comment #1
gábor hojtsyHm, I'm seeing what you mean, and it is definitely not intended. I could not tell the reason from a quick look at the code. The count query starts off with
"SELECT COUNT(DISTINCT(s.sid)) FROM {l10n_community_string} s"and then adds any join and where conditions the same way as it applies to the lookup query. So theoretically it should count by the source string (s.sid), not the suggestion/translation (t.tid) count.Comment #2
linulo commentedI did not do any more tests and am not sure if this helps but from what I remember the pager did not seem to count my own suggestions which I cannot approve. Probably the problem can only be resolved by staring long and hard at the SQL queries (any GROUP BY?). As long as there are no distination strings are missing in the last enty usability is not affected.
Comment #3
andypostConfirm that count is wrong, but cant say actually what it counts. Pager sometimes is not visible but after translation new lines appear from hidden page
Comment #4
droplet commentedafter N times left join, it isn't returns DISTINCT results.
Comment #5
droplet commentedtry this, tested on local, looks fine (but bad performance ??)
Comment #6
gábor hojtsyLooks promising. Anybody else can help test?
Comment #7
andypostTested with local server - works great! Counts exactly and no performance loss.
re-roll without CR and against module's folder
Comment #8
droplet commentedsome new idea & test.
GROUP BY will using temp file on my side that make it slowly. around 9s for the query
split it into 2 query. 0.9~2ms
1. Query string #sid (0.x ms)
2. Query SELECT .........WHERE s.sid IN (#sid), remove LIMIT row here. (0.x ms)
It will return all row with/without suggestions. so we can save some query for suggestions too.
Comment #9
andypost@droplet Thats a great idea! Strings-per-page are limited by a fixed list of limits so this query should be a much faster
Comment #10
gábor hojtsyWell, we still need to build in all the options for the first query. Can you look into doing a patch?
Comment #11
droplet commentedquickly patched.
hope someone have time dig into deeply and test.
Thanks.
Comment #12
andypostelse - should start from new line. http://drupal.org/coding-standards
Comment #13
droplet commentedreroll patch format
Comment #14
droplet commentedComment #15
andypostThis works for me, but still need another review about performance
Comment #16
gábor hojtsyWell, I looked into this. I reworked the patch to eliminate the optionality of the pager, since that was pretty scary... Letting that query run without a pager could end up with a list of sids in an IN condition with hundred, thousands of items... Bad. So this basically worked again :)
However, I was not happy that we just tack on yet another conditional and run with all the joins and conditions of the sid query, while we really should not do that. My understanding is that we can just skip the conditionals (but we do need to use the joins to get all the data we need). So at the end I'm overriding the where conditionals and the sql args with shorter appropriate items. This looks to be good in my local testing, hope it will work great on l.d.o too.
Comment #17
gábor hojtsyYes, seems to be working fine online.
Comment #18
gábor hojtsyOne of the Hungarian translation team leads pointed out to be (and I reproduced), that big projects got WSOD when you filtered for things such as "has suggestion". Smaller projects filtered for the same worked fine. So looks like this is not yet ready for deployment and I needed to roll back. The filter now works properly. An example URL that was WSOD with this patch (without error messages in the logs unfortunately): http://localize.drupal.org/translate/languages/hu/translate?project=drup...
I'm not at all ruling out that the WSOD was maybe due to my changes, but I could not figure out why it happens, so a rollback was important to keep the service running proper.
The exact patch I rolledback was: http://drupalcode.org/project/l10n_server.git/patch/9d7ca95
Comment #19
droplet commentedpretty hard to debug without info & sql dump.
run out of memory ??
old & wrong result always return fixed number of suggestions but new changes could end up much more result.
require DISTINCT on $select query:
+ $select = "SELECT s.sid, s.value, s.context, t.tid, t.language, t.translation, t.uid_entered, t.time_entered, t.time_changed, t.is_suggestion, t.is_active, u.name as username, ts.has_suggestion, ts.has_translation FROM {l10n_server_string} s";
to
$select = "SELECT DISTINCT s.sid, s.value, s.context, t.tid, t.language, t.translation, t.uid_entered, t.time_entered, t.time_changed, t.is_suggestion, t.is_active, u.name as username, ts.has_suggestion, ts.has_translation FROM {l10n_server_string} s";
Comment #20
aturetta commentedWait, I'really can't think of an out of memory condition in the patched code.
At maximum you can have page_size sids loaded at any time, regardless of the complexity of the original query.
There must be some hidden bug/corner case...
Have you checked what happens if the query returns 0 strings.
Comment #21
droplet commented@aturetta,
on my end it works very well. Unluckily, no chance look into LDO DB.
Comment #22
droplet commentedGot the LDO DB, loaded the DB into my small virtualbox,
I patched the l10n_server to show 500 strings each page..on a page has 600 translation
Patched:
(Patched load more strings, so the query time & page execution time are normal.)