-
-
Notifications
You must be signed in to change notification settings - Fork 467
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
Marten keeps recreating indexes #3596
Comments
Based on your comments, I am assuming the names are not truncated in the Postgres index definition added in db. I will take a look and revert, most likely a delta detection which is seeing a difference causing it to recreate the indexes. Edit: A minimal repro would help. |
Thanks a lot for your swift feedback, on my side i'll look into making the repro |
Okay, I have been able to create a repro if you run drop index if exists marten_repro_schema.bwsp_idx_goho705dg4q_poho705d;
CREATE INDEX bwsp_idx_Goho705dg4q_poho705d ON marten_repro_schema.mt_doc_abccorp_people_documents USING btree ((data ->> 'Goho705dg4q33r68'), (data ->> 'Poho705dg4q33r68dfgr')); |
@nkosi23 Thanks for the repro, will take it from here |
@nkosi23 Quick note, I had troubleshooted and spent time, yet to zero in on it. I will keep you posted. |
@mysticmind Thanks a lot for your efforts! |
I encounter the same issue not only with indexes, but also with sequences.
is what the validation returns. |
@WilvanBil I am still troubleshooting to figure out a fix for the original issue raised, will also look at the issue what you have outlined with sequences. Can you please provide a repro? |
@mysticmind have you been able to find any clue about a possible root cause? |
@nkosi23 I spent a lot of time troubleshooting, unable to zero in as yet. I will take a look again with a fresh pair of eyes this week, will revert. |
Hi @nkosi23, I looked a bit into this and based on what i found your initial hunch that casing was the problem seems pretty spot on, i have reduced your reproduction to this: `using Marten; public class Tests{
}` The lowercase example suceeds whereas the mixed casing in the indexname fails (It keeps creating the index). This is a weasel problem, there is a test case already here https://github.com/JasperFx/weasel/blob/master/src/Weasel.Postgresql.Tests/Tables/detecting_table_deltas.cs#L729 Which fails if you change the indexname to mixed case like below: I would think that its in the lookup in the below line that we are failing to get the correct index and add it as a difference: A bit unsure if there is a risk of breaking things by making this case insensitive comparison and how that fits with the strategy of weasel and the comment in the readme that states:
|
@jakobt thanks for the details. What you are suggesting will break things for others. I will see how to remediate this in terms of delta checks. |
I have a fix for this - JasperFx/weasel#165 |
I have about 10 indexes for which Marten keeps creating a migration script looking like the below even though the indexes have been successfully created in the DB:
While I have changed the names for privacy reason, their length is pretty much intact as I suspect that this problem may be somehow related to the one where Marten didn't detect that objects with truncated names (because the name was too long) have been created in the DB. Some observations:
Since the objects are correctly created in postgresql, this looks like a Marten-side change detection issue.
The text was updated successfully, but these errors were encountered: