Skip to content

[4.1] Fixing "#__finder_tokens full" error#35995

Closed
Hackwar wants to merge 6 commits intojoomla:4.1-devfrom
Hackwar:4.1-finder-token-full
Closed

[4.1] Fixing "#__finder_tokens full" error#35995
Hackwar wants to merge 6 commits intojoomla:4.1-devfrom
Hackwar:4.1-finder-token-full

Conversation

@Hackwar
Copy link
Copy Markdown
Member

@Hackwar Hackwar commented Nov 9, 2021

Summary of Changes

Smart Search/Finder has a long standing issue that the #__finder_tokens table can run full and abort the indexing process. That table is of type "MEMORY", which can run full and there is an option to reduce the number of tokens to store in that table, which unfortunately doesn't work in all cases. The MEMORY table is used since it is a lot faster than a normal InnoDB table and since this is just used for temporary storage, writing speed is the main factor here. Anyway, enough rambling. ;) This change pushes the code of addTokenToDb to the tokenizeToDbShort() method and properly counts the number of tokens written to DB. This means, that now the option mentioned above works properly.
This removes the addTokenToDb method, but since this is a protected method in a class of a component, this would still be in accordance to our backwards compatibility promise.

Testing Instructions

  • Get a very long text and insert it into an article.
  • save it.

Actual result BEFORE applying this Pull Request

The indexing fails.

Expected result AFTER applying this Pull Request

The indexing works.

@richard67
Copy link
Copy Markdown
Member

@Hackwar I have tested this PR but it doesn't change anything for me. I get the error with and without the PR applied when trying to save an article with some 100 or 200 times the text from the site linked in the description of issue #34377 , https://whiletrue.neocities.org/lte.html .

@richard67
Copy link
Copy Markdown
Member

2021-11-20_2

@bembelimen
Copy link
Copy Markdown
Contributor

Just playing around with this thing: The problem of the whole thing is most likely that the number of the memory_table_limit parameter is too high + the check is on the wrong position.

So first the checks should be enough to have it that way: patch.zip

And second either set the parameter to a lower number (works for me with 20.000) or take the number from https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_max_heap_table_size

@Krshivam25
Copy link
Copy Markdown
Contributor

error

@bembelimen bembelimen marked this pull request as draft November 27, 2021 11:30
Comment on lines +920 to +926
$query->quote($token->term) . ', '
. $query->quote($token->stem) . ', '
. (int) $token->common . ', '
. (int) $token->phrase . ', '
. $db->quote($token->weight) . ', '
. $query->quote($token->weight) . ', '
. (int) $context . ', '
. $db->quote($token->language)
. $query->quote($token->language)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason to make it slower then needed? please use the quote function of the database as before, the quote function in the Query object is only a proxy, which is an overhead.

@bembelimen bembelimen modified the milestones: Joomla 4.1, Joomla 4.1.1 Jan 10, 2022
@bembelimen
Copy link
Copy Markdown
Contributor

It seems, this will not make it in 4.1.0, so I moved it to 4.1.1 to not forget it, as it should be fixed asap.

@Hackwar
Copy link
Copy Markdown
Member Author

Hackwar commented Jan 20, 2022

Closing this PR in favour of #36749

@Hackwar Hackwar closed this Jan 20, 2022
@Hackwar Hackwar deleted the 4.1-finder-token-full branch January 20, 2022 08:08
@zero-24 zero-24 removed this from the Joomla 4.1.1 milestone Feb 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants