? Pending

User tests: Successful: Unsuccessful:

avatar alikon
alikon
2 Aug 2020

Redo of #21871 .

Summary of Changes

performance
the $table->reorder() was insanely invoked in the artcle model

Support for updates existed articles in joomla 3.x to 4.0:

  • reversing the order in the featured/frontpage table
  • reversing the order in the article table per category.

Two indexes have been added to speed up the order change.

Testing Instructions

JDEBUG ? $time = microtime(true) : null;
JDEBUG ? Log::addLogger(array('text_file' => 'testPR8576.php', ), Log::INFO) : null;
JDEBUG ? Log::add('prepareTable():' . round(microtime(true) - $time, 3), Log::INFO) : null;

then

  • apply the pr
  • run the query in the update path
  • delete configuration.php
  • reinstall
  • discover com_overload
  • create 1000 article in 1 category
  • look at the log file /administrators/log/testPR8576.php

Actual result BEFORE applying this Pull Request

the time needed for create an article is more huge than the time with this pr

Expected result AFTER applying this Pull Request

the time for create an article is less with this pr

Documentation Changes Required

No

avatar alikon alikon - open - 2 Aug 2020
avatar alikon alikon - change - 2 Aug 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 2 Aug 2020
Category SQL Administration com_admin Postgresql com_content Installation
avatar alikon alikon - change - 3 Aug 2020
Labels Added: ?
avatar SharkyKZ
SharkyKZ - comment - 6 Aug 2020

I ran the update SQL and it set all ordering values to 1. Also generates a deprecation notice:

Warning: #1287 Setting user variables within expressions is deprecated and will be removed in a future release. Consider alternatives: 'SET variable=expression, ...', or 'SELECT expression(s) INTO variables(s)'.

Using MySQL 8.0.16.

avatar pabloarias
pabloarias - comment - 6 Aug 2020

Hello:

I'm sorry but I'm not able to run com_overload:

"Error. Your Overload installation is broken; please re-install. Alternatively, extract the installation archive and copy the fof directory inside your site's libraries directory."

I've reinstalled but not sure where fof directory is.

I've tested too with overload CLI, from Nicolas, but not log file was created.


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

avatar wilsonge
wilsonge - comment - 10 Aug 2020

You need to use the 4.0-dev branch in my fork :)

avatar alikon
alikon - comment - 11 Aug 2020

@pabloarias i've attached in the Testing Instructions an installable .zip files

avatar alikon
alikon - comment - 11 Aug 2020

@SharkyKZ the query should be fixed now

for the warning on mysql 8 we should run this on mysql 8

UPDATE `#__content` AS n
INNER JOIN (
	SELECT id, ROW_NUMBER() OVER (PARTITION BY catid ORDER BY ordering DESC) AS new_ordering
	FROM `#__content`
) AS n2
SET n.ordering = n2.new_ordering
WHERE n.id = n2.id;

but ROW_NUMBER() is not present in 5.x and we still support those versions....
i'm open to suggestion

avatar sandewt
sandewt - comment - 12 Aug 2020

When I try to create 1000 (or 1) articles, the following error message appears:
Localhost reports the following: AJAX Loading Error: Internal Server Error

System information:
PHP Version 7.4.8
Web Server Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.8
WebServer to PHP Interface apache2handler
Joomla! Version Joomla! 4.0.0-beta4-dev Development [ Mañana ] 29-July-2020 18:21 GMT

Are there any suggestions?


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

avatar alikon
alikon - comment - 16 Aug 2020

that's weird
can you check on your browser console to check what it is going wrong
Screenshot from 2020-08-16 11-06-49

avatar SharkyKZ
SharkyKZ - comment - 18 Aug 2020

Now getting #1048 - Column 'ordering' cannot be null when running the query.

avatar alikon
alikon - comment - 18 Aug 2020

@SharkyKZ what query and under what circumstances ?

avatar SharkyKZ
SharkyKZ - comment - 18 Aug 2020

The update query in administrator/components/com_admin/sql/updates/mysql/4.0.0-2020-08-02.sql .

avatar pabloarias
pabloarias - comment - 20 Aug 2020

Hello:

I've changed file ArticleModel.php but adding 7 decimals in such of 3. I added use Joomla\CMS\Log\Log in line 38;

I see that adding an article (after generating 1000) time is 0.0024579 s.

After applying path time is 0.0004079 s. Small than before!

I don't understand, why have I to delete configuration.php and reinstall in testing process?

Thank you and best regards

avatar richard67
richard67 - comment - 20 Aug 2020

@pabloarias You have to make a new install in order to get the structural changes in the database (new indexes). Alternatively you could apply the changes of this PR and then run the update SQL script for your database type, e.g. either administrator/components/com_admin/sql/updates/mysql/4.0.0-2020-08-02.sql if you have MySQL or MariaDB, or administrator/components/com_admin/sql/updates/postgresql/4.0.0-2020-08-02.sql if you have PostgreSQL. But you have to replace the leading #__in the table names by your real database prefix.

@alikon Correct me if there is something wrong in my statement.

avatar pabloarias pabloarias - test_item - 3 Sep 2020 - Tested successfully
avatar pabloarias
pabloarias - comment - 3 Sep 2020

I have tested this item successfully on 7091d90

Hello:

I've changed a little bit testing instructions.

PHP Version 7.3.21.
MariaDB 10.3.22-MariaDB-1ubuntu1

Testing instructions followed:

  • Installed Joomla Beta 4 nightly build (date: 03 sep 2020).
  • Added lines of code to administrator/components/com_content/src/Model/ArticleModel.php
  • Added this code on line 38 too: use Joomla\CMS\Log\Log;
  • Enabled the debug plugin.
  • Installed com_overload 4.0-dev and created 1000 articles in 1 category.
  • Applied the PR.
  • Applied update patch on System -> Database -> Joomla CMS.
  • Added lines of code again to administrator/components/com_content/src/Model/ArticleModel.php
  • Added this code on line 38 too: use Joomla\CMS\Log\Log;

First articles are created quickly but later creation last a little bit more.

Not able to create another 1000 articles with com_overload, so:

  • Installed Joomla Beta 4 again.
  • Enabled the debug plugin.
  • Installed Patch tester and applied patch.
  • Added lines of code to administrator/components/com_content/src/Model/ArticleModel.php
  • Added this code on line 38 too: use Joomla\CMS\Log\Log;
  • Installed com_overload 4.0-dev and created 1000 articles in 1 category.

I see that time to create all 1000 are so quick, from 1 to 1000.

Thank you and best regards


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

avatar pabloarias
pabloarias - comment - 3 Sep 2020

Hello:

I've tested successfully but changing a little bit testing instructions.

PHP Version 7.3.21.
MariaDB 10.3.22-MariaDB-1ubuntu1

Testing instructions followed:

  • Installed Joomla Beta 4 nightly build (date: 03 sep 2020).
  • Added lines of code to administrator/components/com_content/src/Model/ArticleModel.php
  • Added this code on line 38 too: use Joomla\CMS\Log\Log;
  • Enabled the debug plugin.
  • Installed com_overload 4.0-dev and created 1000 articles in 1 category.
  • Applied the PR.
  • Applied update patch on System -> Database -> Joomla CMS.
  • Added lines of code again to administrator/components/com_content/src/Model/ArticleModel.php
  • Added this code on line 38 too: use Joomla\CMS\Log\Log;

First articles are created quickly but later creation last a little bit more.

Not able to create another 1000 articles with com_overload, so:

  • Installed Joomla Beta 4 again.
  • Enabled the debug plugin.
  • Installed Patch tester and applied patch.
  • Added lines of code to administrator/components/com_content/src/Model/ArticleModel.php
  • Added this code on line 38 too: use Joomla\CMS\Log\Log;
  • Installed com_overload 4.0-dev and created 1000 articles in 1 category.

I see that time to create all 1000 are so quick, from 1 to 1000.

Thank you and best regards


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

avatar maikol-ortigueira maikol-ortigueira - test_item - 3 Sep 2020 - Tested successfully
avatar maikol-ortigueira
maikol-ortigueira - comment - 3 Sep 2020

I have tested this item successfully on 7091d90

I've tested using the next configurations:

  • Database Type and version: Mysql 5.7.29
  • PHP Version 7.4.9

I followed the same steps as Pablo and the result of the test is that it took less time to generate the 1000 items.
In the first attempt (before applying the patch) 2 minutes and 9 seconds had elapsed, while in the second and always according to the log file the time elapsed was 1 minute and 53 seconds.


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

avatar Quy
Quy - comment - 5 Sep 2020

@alikon Please comment #30258 (comment) before going RTC.

avatar alikon
alikon - comment - 9 Sep 2020

i've missed 1 line SET @row_number :=0 from the previuos commit
@SharkyKZ , @Quy now should be OK

avatar alikon alikon - change - 26 Jun 2021
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2021-06-26 08:08:11
Closed_By alikon
avatar alikon alikon - close - 26 Jun 2021

Add a Comment

Login with GitHub to post a comment