User tests: Successful: Unsuccessful:
Pull Request for Issue #41156 .
See also issues #17580 and #39479 , discussion #42198 and support forum thread https://forum.joomla.org/viewtopic.php?f=811&t=995872 .
This pull request (PR) changes the SQL query in the extension helper to get the extension_id
s of all core extensions from using a giant "WHERE" clause with a lot of "( ... AND ... AND ...) OR ( ... AND ... AND ...) OR ..." conditions to a query which uses the concatenation of the 4 relevant columns and one single "WHERE ... IN (...)" condition, which is much shorter.
Currently the SQL query looks like this on MySQL/MariaDB (with ...
for "and so on"):
SELECT `extension_id`
FROM `#__extensions`
WHERE (`type` = :preparedArray1 AND `element` = :preparedArray2 AND `folder` = :preparedArray3 AND `client_id` = :preparedArray4)
OR (`type` = :preparedArray5 AND `element` = :preparedArray6 AND `folder` = :preparedArray7 AND `client_id` = :preparedArray8)
...
OR (`type` = :preparedArray929 AND `element` = :preparedArray930 AND `folder` = :preparedArray931 AND `client_id` = :preparedArray932);
with :preparedArray1
='component'
, :preparedArray2
='com_actionlogs'
, :preparedArray3
=''
, :preparedArray4
=1
, :preparedArray5
='component'
, :preparedArray6
='com_admin'
, :preparedArray7
=''
, :preparedArray8
=1
and so on.
With this PR applied the query looks like this on MySQL/MariaDB (with ...
for "and so on"):
SELECT `extension_id`
FROM `#__extensions`
WHERE CONCAT_WS('|', `type`, `element`, `folder`, `client_id`)
IN (:preparedArray1,
:preparedArray2,
...
:preparedArray233);
with :preparedArray1
='component|com_actionlogs||1'
and :preparedArray2
='component|com_admin||1'
and so on.
On PostgreSQL it looks like this;
SELECT "extension_id"
FROM "j3ux0_extensions"
WHERE "type" || '|' || "element" || '|' || "folder" || '|' || "client_id"
IN (:preparedArray1,
:preparedArray2,
...
:preparedArray233);
This solves the SQL error "1104 The SELECT would examine more than MAX_JOIN_SIZE rows" happening on MariaDB databases where the sql_big_select
server variable is set to "OFF" and the max_join_size
has a value like e.g. 67108864, which seems to be the default on some hosting environments, when a core update has been found so the pre-update check is shown or when you are using the filter for core or non-core extensions in the Extensions Manager.
And I have the feeling that the new query is also faster.
Requirements: It needs a MariaDB database to reproduce the issue. I could reproduce it on a MariaDB 10.4.32, and the issue was also reported for MariaDB 10.6.12. With MySQL 8 I was not able to reproduce it.
In addition to testing with MariaDB, it needs to test with MySQL and PostgreSQL that nothing is broken and everything works as before.
Packages for new installation and update with this PR applied and a custom update URL can be found here: https://artifacts.joomla.org/drone/joomla/joomla-cms/4.4-dev/42576/downloads/72566 .
This test needs a MariaDB database to reproduce the issue and an installation with a clean, current 4.4-dev branch or recent 4.4 nightly build or a 4.4.0 or 4.4.1 stable, preferably without any 3rd party extensions to rule out any side effects coming from those.
In addition it needs the "sql_big_selects" variable to be set to "OFF" (0) and the "max_join_size" to "67108864" in the session. If you don't have that you can set these variables when using a database user with administrator privileges, e.g. user "root", with the following 2 SQL statements in a client like e.g. phpMyAdmin:
SET GLOBAL sql_big_selects=0;
SET GLOBAL max_join_size=67108864;
This will persist until the next restart of the database server and result in these values be set for every session.
This test needs to be done on all possible kinds of databases (MySQL, MariaDB and PostgreSQL).
If using MariaDB, make sure to have the sql_big_selects
server variable switched "ON" (1) so you don't get the SQL error tested with the previous test 1.
This can be done as a database user with administrator privileges (e.g. user "root") with the following SQL statement in a client like e.g. phpMyAdmin: SET GLOBAL sql_big_selects=1;
.
defined('_JEXEC') or die;
, e.g. in case of Cassiopeia at line 12 of the "templates/cassiopeia/index.php" file:var_dump(\Joomla\CMS\Extension\ExtensionHelper::getCoreExtensionIds());
die;
var_dump
statement into a text editor and save that in a text file.var_dump
statement with the one saved in step 2.When a MariaDb database is used which has the "sql_big_selects" variable set to "OFF" (0) and the "max_join_size" to "67108864" or lower, and there is a core update available for which the pre-update checks are shown, you get an SQL error "1104 The SELECT would examine more than MAX_JOIN_SIZE rows" when going to the Joomla Update component in backend.
The same error happens when you are using the filter for core or non-core extensions in the Extensions Manager.
No SQL error "1104 The SELECT would examine more than MAX_JOIN_SIZE rows" for the cases mentioned above.
Everything works as well as before for all other cases.
Please select:
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
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Labels |
Added:
PR-4.4-dev
|
Labels |
Added:
bug
|
I have tested this item ✅ successfully on ad2edfc
Is this fixed for Joomla 5 as well ?
Is this fixed for Joomla 5 as well ?
@ssnobben As usual for bug fixes which affect 4.4.x and 5.y, it will be merged up into 5.0-dev after it has been merged into 4.4-dev. Hopefully this will be the case soon so it can go into the upcoming 4.4.2 and 5.0.2 releases, which are scheduled for Tuesday, January 9.
Is this fixed for Joomla 5 as well ?
@ssnobben As usual for bug fixes which affect 4.4.x and 5.y, it will be merged up into 5.0-dev after it has been merged into 4.4-dev. Hopefully this will be the case soon so it can go into the upcoming 4.4.2 and 5.0.2 releases, which are scheduled for Tuesday, January 9.
Great! many thanks Joomlers and Happy New Year to you all!
I've used a clean J4.4.1 with no extensions, using XAMPP with MariaDB 10.4.32 and PHP 8.2.12.
I applied the two SQL statements as in alikon's comment above. I could reproduce the error using the filter for core/non-core extensions (same as alikon's screenshot).
After application of the patch, the error was gone.
I have tested this item ✅ successfully on ad2edfc
Status | Pending | ⇒ | Ready to Commit |
RTC
Ok great.
I have another issue to delete users but that I think is releated to EasySocial too but strange you cant delete users from Joomla 5.0.1 backend bcs of this.
Got this error:
0
Joomla\CMS\Event\Model\DeleteEvent::onSetSubject(): Argument #1 ($value) must be of type object, array given, called in /libraries/src/Event/AbstractEvent.php on line 225
@ssnobben Switching on "Debug System" in Global Configuration should give a stack trace which shows where the error happens. If that contains something from a 3rd party extension then it comes from that extension. Anyway this PR here has already 2 successful tests, so hopefully it will go into 4.4.2 and 5.0.2.
I did the test for MariaDB OK. I never used Postgres but just installed it and have no idea how to use it. I guess it does not matter as two tests are in and the PR is RTC. Good show!
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-12-31 12:45:17 |
Closed_By | ⇒ | MacJoom | |
Labels |
Added:
RTC
|
Seems to work fine, no more 1104 errors
Hurray, no more refusing to find updates on current Joomla!
That is indeed a great improvement, thank you for your efforts.
Could you add that fix to the "Joomla Version Update Status" (status-report after updating) too?
Because it does update fine, but will give (inappropriate) error-messages afterwards.
Could you add that fix to the "Joomla Version Update Status" (status-report after updating) too? Because it does update fine, but will give (inappropriate) error-messages afterwards.
This will happen only one time after updating from 4.4.2 or older to 4.4.3 or 5.0.2 or older to 5.0.3 and then never again. I don't think we can fix that with reasonable effort.
Ok, if it's only once then I agree not too much effort should be put in.
I encountered it several times, but then again I have multiple Joomla websites running and indeed it might have been only once per site...
Once again thanks for your efforts.
Site 1: No remark, no error message
Site 2: Error message (see screen shot Feb 25, 2024 above in this thread). Site works as normal.
Site 1: Error message as above.
Site 2: No remark, no error message.
Site 1 and 2: Error message as above.
I think all other releases, if I have not missed anything in my notes.
For some reason, the error message has been there after most of the updates, including upgrade from Joomla 4 to 5. Because everything works fine, I have not seen any trouble, I have let this issue rest. I do not have competence to investigate myself. And I do not request it to be reviewed, at least not with any important priority. I am very happy that the fix has fixed the actual issue. But as information I want to file this note to developers and any admin who experience the issue.
so i've setted up a local test env with 10.6.7-MariaDB-1:10.6.7+maria~focal
runned
SET GLOBAL sql_big_selects=0; SET GLOBAL max_join_size=67108864;
and i was able to reproduce the error
using the filter for core or non-core extensions in the Extensions Manager
after applying the pr no more error
p.s
tested on Mysql 8 and Postgresql where issue don't arise, and all is working fine as before the pr