Skip to content

Remove ensureIndex from MongoLock constructor.#3

Open
razielgn wants to merge 2 commits intomasterfrom
remove-ensure-index-from-mongo-lock-constructor
Open

Remove ensureIndex from MongoLock constructor.#3
razielgn wants to merge 2 commits intomasterfrom
remove-ensure-index-from-mongo-lock-constructor

Conversation

@razielgn
Copy link
Contributor

@razielgn razielgn commented Aug 4, 2016

This causes major issues when the lock is written to a replicaSet: somehow it puts a great deal of pressure on it.

This patch removes the ensureIndex that keeps banging at a primary's door, while still checking wether the index (which is vital) is present or not before lock acquirement.


foreach ($this->collection->getIndexInfo() as $index) {
if ($index['name'] === 'program_unique') {
$present = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

break
or better extract method and use return

@razielgn razielgn force-pushed the remove-ensure-index-from-mongo-lock-constructor branch from 879818a to ec0df9e Compare August 4, 2016 11:52
@MirkoBonadei
Copy link
Contributor

👍

@razielgn razielgn force-pushed the remove-ensure-index-from-mongo-lock-constructor branch from ec0df9e to 772ac60 Compare August 4, 2016 14:50
@razielgn razielgn force-pushed the remove-ensure-index-from-mongo-lock-constructor branch from 772ac60 to 5678867 Compare August 4, 2016 14:58
@giorgiosironi
Copy link
Contributor

Doing the job that should have been done by the driver's since 1942 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments