Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: CleanupBrickTables maintenance task does not recognize bricks with capitalization in name #10427

Closed
CountZero1981 opened this issue Sep 27, 2021 · 3 comments · Fixed by #15058
Assignees
Milestone

Comments

@CountZero1981
Copy link
Contributor

CountZero1981 commented Sep 27, 2021

Expected behavior

CleanupBrickTables runs smoothly, without any errors.

Actual behavior

I've managed to reproduce the problem from #5824.
Our devops used this manual and added lower_case_table_names=1 in accordance with it.
Unfortunately, he did it on the production DB, on Linux and on AWS, so I didn't even have access to mysql system settings and I wasn't aware of the changes.
My next morning started with shouts of angry users, who were completely unable to work with the website. After some research, I changed the actual table names to lower case (luckily, I had access to mysqldump/mysql on production).
So I appreciate the decision taken in Mysql 8 to disallow changing this setting if DB directory has already been initialized.
But now we're getting the error with CleanupBrickTables mentioned in #5824, and I was able to reproduce it on a fresh installation, see the steps to reproduce.

Steps to reproduce

Use Linux, set lower_case_table_names=1 in Mysql config. Create a new DataObject class, named with a capital letter. This creates tables with lower_case, but actual class files are still created case-sensitive. So CleanupBrickTables gets lower_cased Mysql table name and tries to look up a class with a lower_cased filename on a case-sensitive linux filesystem.
But even if we lower_case the filename of the class, datatype definitions (which are string literals in Pimcore) cannot be lower_cased - and Pimcore on Linux still tries to look them up in case-sensitive mode. It should not be a problem on Windows, though - datatype definitions and filenames can be CamelCased there, but CleanupBrickTables should still be able to get them, because the filesystem is case-insensitive there.

I've made a test using fresh & clean Pimcore installation, the result is shown here

@stale
Copy link

stale bot commented Mar 14, 2022

Thanks a lot for reporting the issue. The issue was not considered by us as "Priority" or "Backlog", so we're not gonna work on that anytime soon. In case this is a bug report, please create a pull request fixing the issue, we'll then review it as soon as possible. If you're interested in contributing a feature, please contact us first here before creating a pull request, we'll then decide whether we'd accept it or not. Thanks for your understanding.

@stale stale bot added the PR Welcome label Mar 14, 2022
@jdreesen
Copy link
Contributor

Is this related: #12391 ?

@aKugler
Copy link

aKugler commented Sep 1, 2022

Hi @jdreesen!

Sorry for my english.
In my opinion this belongs together. In the code it is searched for the brick tables. If the value is set, then the table is called e.g. object_brick_mybrick_1. Then iterate over the tables and operate out the name of the trick. In this case mybrick remains. Finally mybrick is searched in the cache. But if you have created the brick with the key MyBrick, then it will not be found. At least with the fieldcollections it is the same.

https://github.com/pimcore/pimcore/blob/11.x/lib/Maintenance/Tasks/CleanupBrickTablesTask.php#L51

florian25686 pushed a commit to florian25686/pimcore that referenced this issue Mar 16, 2023
MySQL 8 stores all tables names in lower case by default. ObjectBricks and fieldcollections are created case-sensitiv on the filesystem. The cleanup task uses names from the database, which are lower cased, and tries to find filenames, which are casesensitive.
@fashxp fashxp added this to the 10.5.23 milestone May 12, 2023
@lukmzig lukmzig removed this from the 10.5.23 milestone May 16, 2023
@fashxp fashxp added Backlog and removed PR Welcome labels Jun 12, 2023
@lukmzig lukmzig self-assigned this Jun 20, 2023
@lukmzig lukmzig modified the milestones: 11.0.1, 11.1.0 Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants