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

BUGFIX: Fix projection database schema #4847

Merged
merged 4 commits into from
Jan 23, 2024
Merged

Conversation

bwaidelich
Copy link
Member

@bwaidelich bwaidelich commented Jan 21, 2024

This is a follow-up to #4730 fixing the database schema for binary columns.

Without this fix, calling ProjectionInterface::setUp() will drop and re-add a lot of columns!

Furthermore, this fixes the origindimensionspacepointhash column of the AssetUsageRepository to correctly use the DbalSchemaFactory::columnForDimensionSpacePointHash. Previously it used TEXT without a length wich lead to the index from being recreated every setup.

This is a follow-up to #4730 fixing the database schema
for binary columns.

Without this fix, calling `ProjectionInterface::setUp()` will drop and re-add a lot of columns!

Furthermore, this adds a length limit to the `origindimensionspacepointhash` column of the `AssetUsageRepository` (follow-up to #4088) to prevent the index from getting recreated on each set up
@bwaidelich
Copy link
Member Author

This is a draft because it depends on #4845

Copy link
Contributor

@dlubitz dlubitz left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you!

@bwaidelich bwaidelich force-pushed the task/eventstore-1.0 branch 3 times, most recently from ae20335 to e9d2bdf Compare January 21, 2024 14:25
bwaidelich added a commit that referenced this pull request Jan 21, 2024
Those are extracted to #4847
bwaidelich added a commit that referenced this pull request Jan 21, 2024
Those are extracted to #4847
Base automatically changed from task/eventstore-1.0 to 9.0 January 22, 2024 13:30
@bwaidelich bwaidelich marked this pull request as ready for review January 22, 2024 13:31
@@ -73,8 +73,7 @@ private function databaseSchema(): Schema
->addIndex(['originalassetid'])
->addIndex(['contentstreamid'])
->addIndex(['nodeaggregateid'])
->addIndex(['origindimensionspacepointhash']);
;
->addIndex(['origindimensionspacepointhash'], options: ['lengths' => [768]]);
Copy link
Member

Choose a reason for hiding this comment

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

wait why do we need that much length here?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's just what the db applied if it was not specified.
I was surprised that the hash column was changed to TEXT that is basically unbound.. Maybe we can limit the max length in our PHP VOs already to a sensible value. Then we could reduce column and index sizes, too

Copy link
Member

Choose a reason for hiding this comment

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

Good that we talked about it then :) Apparently an oversight on my side, see
https://github.com/neos/neos-development-collection/pull/4847/files/73e4d80eae3d584422c09c0ab5837e81050faf9f#diff-9139cc843ef200a3a9ed44f6f009526aecf42bb03934f02722e2d93e0fb2cc47R66

both ODSP and the hash column use the columnForDimensionSpacePoint spec, which is clearly wrong for the hash, sorry!

Copy link
Member

Choose a reason for hiding this comment

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

Added a commit to fix it

Copy link
Member

Choose a reason for hiding this comment

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

So with your fix @kitsunet dc6c9e1 should bastis be reverted?

Also ci fails now:

PDOException: SQLSTATE[HY000]: General error: 1089 Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys in /home/runner/work/neos-development-collection/neos-development-collection/neos-development-distribution/Packages/Libraries/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:55

Copy link
Member

Choose a reason for hiding this comment

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

right, yeah, it must

@kitsunet
Copy link
Member

Much betterer I think

@mhsdesign
Copy link
Member

Adjusted the description above and will merge this ;)

@mhsdesign mhsdesign merged commit 34afad4 into 9.0 Jan 23, 2024
11 checks passed
@mhsdesign mhsdesign deleted the bugfix/fix-projection-db-schemas branch January 23, 2024 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants