RTC Release Blocker bug PR-5.3-dev Pending

User tests: Successful: Unsuccessful:

avatar joomdonation
joomdonation
25 Jan 2025

Pull Request for Issue # .

Summary of Changes

There is an SQL error in smart search which only happens in certain database version. In the test site which I helped a user, it is 10.6.15-MariaDB. The reason is because alias is not allowed in DELETE statements when deleting from a single table.

Update by richard67: It seems to apply also to later versions of MariaDB, e.g. 10.11.7, and it needs some orphan nodes in the finder taxonomy table to run into it.

Testing Instructions

  • Use Joomla 5.3.0-alpha2 or 5.3.0-alpha3 or a current 5.3 nightly build or a current 5.3-dev branch.
  • Edit an article, save it

Actual result BEFORE applying this Pull Request

With certain database version, there is an error displayed, article is not saved properly. You might not see this error yourself because as mentioned, the error only happens with certain database version

Expected result AFTER applying this Pull Request

No error while saving article. So in your test, just please make sure article can be saved without any error.

Link to documentations

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar joomdonation joomdonation - open - 25 Jan 2025
avatar joomdonation joomdonation - change - 25 Jan 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 25 Jan 2025
Category Administration com_finder
avatar richard67 richard67 - change - 25 Jan 2025
The description was changed
avatar richard67 richard67 - edited - 25 Jan 2025
avatar richard67
richard67 - comment - 25 Jan 2025

In can confirm that it's a bug specific for 5.3-dev which was introduced with 5.3.0-alpha2. 5.3.0-alpha1 and 5.2-dev are ok.

avatar richard67
richard67 - comment - 25 Jan 2025

By review I can confirm that this PR is right, the table alias is not needed in the DELETE statement, and whereIn can be used here.

avatar richard67
richard67 - comment - 25 Jan 2025

I think the bug is severe enough to set the "Release Blocker" label.

avatar richard67 richard67 - change - 25 Jan 2025
The description was changed
avatar richard67 richard67 - edited - 25 Jan 2025
avatar web-eau-net
web-eau-net - comment - 25 Jan 2025

Test OK article can be saved now.

avatar web-eau-net web-eau-net - test_item - 25 Jan 2025 - Tested successfully
avatar web-eau-net
web-eau-net - comment - 25 Jan 2025

I have tested this item ✅ successfully on 287e679

Test OK article can be saved now.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44778.

avatar richard67
richard67 - comment - 25 Jan 2025

Unfortunately I cannot reproduce the issue, not with MySQL 8.0 nor PostgreSQL nor MariaDB 10.11.

As the error is in the removeOrphanNodes method of the Taxonomy, it might need some orphan node for the error happening. @Hackwar Do you know how to produce some taxonomy orphan nodes in com_finder?

avatar Hackwar
Hackwar - comment - 25 Jan 2025

The simplest solution would be to delete a row from the #__finder_links table and then to run the maintenance task from the Index view. The link entry should of course have a taxonomy related to it and be the only entry which has this taxonomy. For example an article in a category and this would be the only article in that category.

avatar richard67
richard67 - comment - 26 Jan 2025

Meanwhile I've tested the DELETE statement as it is without this PR for some not existing IDs in phpMyAdmin and for Postgres in phpPgAdmin:

DELETE FROM `#__finder_taxonomy` AS `t` WHERE `t`.`id` IN (97,98,99);

(in phpPgAdmin with PostgreSQL of course with the right name quotes).

Results:

  • On MySQL 8 and PostgreSQL the statement works.
  • On MariaDB 10.11.7 and MariaDB 10.6.15 I get an SQL syntax error.

The fixed statement from this PR works on all.

avatar richard67 richard67 - change - 26 Jan 2025
The description was changed
avatar richard67 richard67 - edited - 26 Jan 2025
avatar richard67
richard67 - comment - 26 Jan 2025

I still cannot reproduce the issue on MariaDB on a "normal" Joomla 5.3-alpha3.

The reason for that is that the first query in the removeOrphanNodes method will never return any records because of the AND m.link_id IS NULL condition in the WHERE clause.

I don't know yet since which Joomla version, but from memory I would say it's 4.0.0, there is a NOT NULL constraint on the link_id column of the #__finder_taxonomy_map.

So the only explanation which I have right now for the issue is that the site has a long update history and some old records in the #__finder_taxonomy_map table which have a NULL value for the link_id.

But anyway, regarding the SQL syntax the fix from this PR is right.

@Hackwar Am I on the right track, or am I missing something?

avatar alikon
alikon - comment - 26 Jan 2025

the DELETE syntax doesn't need the alias nor having it is wrong strictly sql speaking
btw, if there are some strange behaviours with some "strange" MariaDB versions this PR is correct anyway

avatar richard67 richard67 - test_item - 26 Jan 2025 - Tested successfully
avatar richard67
richard67 - comment - 26 Jan 2025

I have tested this item ✅ successfully on 287e679

I was able to reproduce the issue with MariaDB 10.11.7, but only with some kind of a hack.

I have created a new category and a new article so that article was the only one in that category.

Then I have investigated the record in the #__finder_taxonomy_map table which belongs to that article and have deleted that record, so that the following SQL statement returned one record as result:

SELECT `t`.`id`
  FROM `#__finder_taxonomy` AS `t`
  LEFT JOIN `#__finder_taxonomy_map` AS `m` ON `m`.`node_id` = `t`.`id`
 WHERE `t`.`parent_id` > 1
   AND `t`.`lft` + 1 = `t`.`rgt`
   AND `m`.`link_id` IS NULL;

Then I have tried to change and save any other article.

Without this PR it failed as described.

With this PR it succeeded. After that, the above query did not return any result, and Smart Search indexing and index optimization still work.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44778.

avatar richard67 richard67 - change - 26 Jan 2025
Status Pending Ready to Commit
Labels Added: bug Release Blocker PR-5.3-dev
avatar richard67
richard67 - comment - 26 Jan 2025

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44778.

avatar QuyTon QuyTon - change - 27 Jan 2025
Labels Added: RTC
avatar laoneo laoneo - change - 3 Feb 2025
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2025-02-03 17:28:44
Closed_By laoneo
avatar laoneo laoneo - close - 3 Feb 2025
avatar laoneo laoneo - merge - 3 Feb 2025

Add a Comment

Login with GitHub to post a comment