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

Projects
None yet
5 participants
@jitendrapurohit
Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor Author

commented Jun 27, 2017

This is how it looks -

image

@jitendrapurohit jitendrapurohit force-pushed the jitendrapurohit:indexfix branch from 5cff2b6 to f4f835e Jun 27, 2017

@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

This comment has been minimized.

@xurizaemon

This comment has been minimized.

Copy link
Member

commented Jun 27, 2017

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

This comment has been minimized.

Copy link
Contributor Author

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

This comment has been minimized.

Copy link
Contributor

commented Jun 28, 2017

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

This comment has been minimized.

Copy link
Contributor

commented Jun 28, 2017

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

@seamuslee001

This comment has been minimized.

Copy link
Contributor

commented Jun 28, 2017

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

@eileenmcnaughton

This comment has been minimized.

Copy link
Contributor

commented Jun 28, 2017

yep

@seamuslee001

This comment has been minimized.

Copy link
Contributor

commented Jun 28, 2017

Happy for this to be merged then

@eileenmcnaughton eileenmcnaughton merged commit b8fdc7b into civicrm:master Jun 28, 2017

1 check passed

default Build finished.
Details
@jitendrapurohit

This comment has been minimized.

Copy link
Contributor Author

commented Jun 28, 2017

Thanks all.

@jitendrapurohit jitendrapurohit deleted the jitendrapurohit:indexfix branch Jun 28, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.