After i search for strings they are often shown to have suggestions. If i click on the "Show detailed information" button no suggestion is displayed. What's wrong here?

Comments

hass’s picture

I cannot look inside the DB to say for sure, but it could be possible that this comes from duplicate suggestions with completely same wording.

gábor hojtsy’s picture

If there is duplicate suggestions, then there would be at least two suggestions, or otherwise they would not be duplicates, right? The "has_suggestions" flag in the database and on the user interface is "cached" data, and ideally should always reflect the current state. This is to avoid to do a count query on all suggestions for each string. So it is possible the data is somehow out of sync, in which case this should be investigated.

hass’s picture

You can log on yourself with drupal.org account and see at http://de.kkaefer.com/. After login, go to "Edit" > Search for 'drupal' and release '6.0' and 'has suggestions'. Then the orange marker is shown on the first two strings "php" and "MySQL database" (only two examples). If i click the orange marker I see the string - *no* suggestion and "Translated by: admin at 8. February 2008 - 22:33"... must be a ~2 month cache :-)

gábor hojtsy’s picture

Well, cache might not be the right word. This flag is not regenerated from time to time but only when there is some actions regarding suggestions (one is added, approved or deleted). If you removed suggestions from the database by hand, the flag was not updated obviously, because it is updated as part of the process of doing the action with the suggestion in l10n_server. One option might be to have a "consistency update" of this flag on crons, with something like (pseudo code):

UPDATE has suggestion on all strings to 0;
UPDATE has suggestion on strings WHERE string id in (SELECT UNIQUE string id FROM translations WHERE is suggestion);

This has an obvious data inconsistency point between the two queries, where the UI would display bad data, so if you can build this to one reasonable query, then feel free :) Updating all strings one by one with COUNT() subqueries sounds like very bad performance wise (this is why we have this cached flag).

hass’s picture

I pleased kkaefer some minutes ago to join this case and take a look to the DB first.

The strings i wrote about above are only strings from the very first import... and in the case of such strings with fake suggestions i tried some days ago, to add a blank to the end and then remove the blank again. It hasn't helped...

Not sure how this behavior fit in the caching logic you described...

kkaefer’s picture

My solution to this:

CREATE TEMPORARY TABLE _l10n_temp SELECT DISTINCT sid FROM l10n_community_translation WHERE is_suggestion = 1 AND is_active = 1;
UPDATE l10n_community_translation SET has_suggestion = 0;
UPDATE l10n_community_translation SET has_suggestion = 1 WHERE sid IN (SELECT sid FROM _l10n_temp);
kkaefer’s picture

Btw, this inconsistency is due to me deleting manually translations directly in the database because someone imported a foreign translation into the German language translation.

hass’s picture

I don't think so. This problem was already there before we deleted this foreign language suggestions!

gábor hojtsy’s picture

hass: Konstantin's explanation on the manual deletion is exactly what makes this "cached" flag outdated, so if it did not happen earlier, it surely happened with that manual deletion. If it happened earlier (before any manual tweaking in the database), then you need to find out what has happened, or try to reproduce it. I have not heard this report from others, who don't work directly on their databases.

hass’s picture

I would close this case for now, but would please Konstantin to post the SQL he executed to fix this issue. I'm sure others are also interested...

Maybe you are able to add a checkbox like "Re-build translation statistics" :-).

gábor hojtsy’s picture

As I said in #4, we can add an update on cron, if it looks workable to make this fix automated.

kkaefer’s picture

Status: Active » Closed (fixed)

The SQL queries are posted above.

hass’s picture

Status: Closed (fixed) » Active

Ups... overlooked #6. Let this stay open, maybe others need this too and maybe Gabor likes to integrate the SQL into a cron job!?

meba’s picture

Status: Active » Postponed (maintainer needs more info)

Let's close this since it's more than a year old?

hass’s picture

Status: Postponed (maintainer needs more info) » Active

Not yet fixed as I know.

gábor hojtsy’s picture

Status: Active » Fixed

No inconsistencies arise from the normal use of the server and the moderate page now allows for mass-moderation. Therefore I'm not going to add one-time hacks like creating temporary tables for cleanups which are not needed on normal operation to the module.

We can either mark this fixed (as in fixed for the German server) or won't fix (as in this hack is not getting into l10n_server as the underlying error was not in the server).

gábor hojtsy’s picture

Title: Have suggestion is shown, but nothing dislayed after a click » Out of app database modifications invalidate cached values

Also retitling for the correct problem at hand.

hass’s picture

Yeah, until someone imports Turkish into Hungarian and you need to fix on DB level :-).

Status: Fixed » Closed (fixed)

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