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

Introduce support for sharded collections #1385

Merged
merged 49 commits into from
May 24, 2016

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Mar 14, 2016

This PR mainly builds on top of the work done by @clslrns in #1025. Changes include running travis tests on sharded cluster and some more relaxed error handling to account for different error messages depending on the MongoDB server version used. It also adds documentation for the sharding mapping as well as the @ShardKey annotation.

This also supersedes the work done in #691 and #325 which have been too long-running to be useful at this stage.

One feature that will be added at a later stage is the support for denormalizing the shard key values in non-simple references; this is not required but can greatly improve query times when fetching references on a sharded collection. This will be another PR as I'm waiting for #1349 to finalize the changes made to simple/full references.

TODO:

  • Proofread and possibly expand documentation
  • Re-visit checks for storage strategies in shard keys; currently fields using an increment strategy are excluded from shard keys. While this is technically a valid solution it might make more sense to just not update these fields in the query builder instead of throwing an error in the mapping.
  • Store shard key values along with dbRef objects (waiting on storeAs option for references #1349)

@alcaeus alcaeus self-assigned this Mar 14, 2016
@alcaeus alcaeus added this to the 1.1 milestone Mar 14, 2016
@notrix
Copy link
Contributor

notrix commented Mar 14, 2016

👍

*/
public function setShardKey(array $keys, array $options = array())
{
if ($this->inheritanceType == self::INHERITANCE_TYPE_SINGLE_COLLECTION && !is_null($this->shardKey)) {
Copy link
Member

Choose a reason for hiding this comment

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

=== should be used

@alcaeus alcaeus force-pushed the sharding-support branch 2 times, most recently from 90447c3 to 60e11cd Compare May 18, 2016 09:22
@@ -489,3 +489,54 @@ it on a per query basis:
$qb->requireIndexes(true);
$query = $qb->getQuery();
$results = $query->execute();

Shard keys
Copy link
Member

Choose a reason for hiding this comment

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

Capital "K" here.

* @param object $document
* @throws \BadMethodCallException
*/
protected function processDocumentCollection(SchemaManager $sm, $document)
Copy link
Member

Choose a reason for hiding this comment

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

What is the purpose of this and methods below?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Oh wow I had no idea we have something like this 👍

@malarzm
Copy link
Member

malarzm commented May 24, 2016

Good to go once tests are green, yay! 👍

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