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

CRM-20774 - Add check for existing key index in table #10566

Merged
merged 3 commits into from
Jun 28, 2017

Conversation

jitendrapurohit
Copy link
Contributor

@jitendrapurohit jitendrapurohit commented Jun 27, 2017

getMissingIndices() retrieves the indices based on the value and not on the key. So there is a possibility that it'll also fetch the value -

  • if they exist in wrong order.
  • some column missing for the index key.

For eg.

$requiredIndex = index_all - (cacheKey, entity1, entity2, entity3, is_selected).

$existingIndex = index_all - (cacheKey, entity1, entity2, entity3).

As is_selected is not in the table, updateindices would attempt to re-create the index which will lead to duplicate index_all key error.

This PR displays the existing keys on system status page and ask the user to drop the index so that civi creates the correct one with all columns again.

Test added.


@jitendrapurohit
Copy link
Contributor Author

This is how it looks -

image

@jitendrapurohit jitendrapurohit changed the title CRM-20774 - Add check for existing key index in table wip - CRM-20774 - Add check for existing key index in table Jun 27, 2017
@seamuslee001
Copy link
Contributor

@xurizaemon
Copy link
Member

Oh, I thought we'd fixed "Update Incices" but I see it in the screenshot above.

Make sure you haven't brought back "Incices" instead of "Indices"!

(I don't think you have by looking at the changes, but ...)

@jitendrapurohit
Copy link
Contributor Author

jitendrapurohit commented Jun 27, 2017

No, the screenshot is from one of our dev site(inz) which is on 4.7.19 and the typo fix was done in 4.7.20. I've checked on local(master) and the button looks correct there.

@jitendrapurohit jitendrapurohit changed the title wip - CRM-20774 - Add check for existing key index in table CRM-20774 - Add check for existing key index in table Jun 27, 2017
@seamuslee001
Copy link
Contributor

This looks good to me, my only thoughts is perhaps there should be a message about reporting it to your administrator if you cannot alter the database or do not know now? ping @eileenmcnaughton

@eileenmcnaughton
Copy link
Contributor

I'm inclined to think this is good to merge & we could cover the messaging as a follow up?

@seamuslee001
Copy link
Contributor

I would be ok with that but do you think that would be a good text addition?

@eileenmcnaughton
Copy link
Contributor

yep

@seamuslee001
Copy link
Contributor

Happy for this to be merged then

@eileenmcnaughton eileenmcnaughton merged commit b8fdc7b into civicrm:master Jun 28, 2017
@jitendrapurohit
Copy link
Contributor Author

jitendrapurohit commented Jun 28, 2017

Thanks all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants