Skip to content
This repository was archived by the owner on May 6, 2024. It is now read-only.

Add mongo read preference OPS-2440#4196

Merged
jdmulloy merged 1 commit intomasterfrom
jdmulloy/ops2440/mongo_read_secondaries
Nov 9, 2017
Merged

Add mongo read preference OPS-2440#4196
jdmulloy merged 1 commit intomasterfrom
jdmulloy/ops2440/mongo_read_secondaries

Conversation

@jdmulloy
Copy link
Contributor

@jdmulloy jdmulloy commented Nov 7, 2017

Configuration Pull Request

Make sure that the following steps are done before merging:

  • A DevOps team member has approved the PR.
  • Are you adding any new default values that need to be overridden when this change goes live? If so:
    • Update the appropriate internal repo (be sure to update for all our environments)
    • If you are updating a secure value rather than an internal one, file a DEVOPS ticket with details.
    • Add an entry to the CHANGELOG.
  • If you are making a complicated change, have you performed the proper testing specified on the Ops Ansible Testing Checklist? Adding a new variable does not require the full list (although testing on a sandbox is a great idea to ensure it links with your downstream code changes).

@jdmulloy jdmulloy force-pushed the jdmulloy/ops2440/mongo_read_secondaries branch from 029d9d3 to f1abd59 Compare November 7, 2017 16:58
CHANGELOG.md Outdated
`EDXAPP_MONGO_CONTENTSTORE_READ_PREFERENCE` to control MongoDB read
preference. If unset `EDXAPP_MONGO_MODULESTORE_READ_PREFERENCE` and
`EDXAPP_MONGO_CONTENTSTORE_READ_PREFERENCE` take the value of
`EDXAPP_MONGO_MODULESTORE_READ_PREFERENCE`, which is SECONDARY_PREFERED by
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you mean for this to be EDXAPP_MONGO_READ_PREFERENCE ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

@jdmulloy jdmulloy requested a review from feanil November 9, 2017 16:53
@jdmulloy jdmulloy force-pushed the jdmulloy/ops2440/mongo_read_secondaries branch from 539130c to a72becb Compare November 9, 2017 22:30
@jdmulloy jdmulloy merged commit 1f42600 into master Nov 9, 2017
@jdmulloy jdmulloy deleted the jdmulloy/ops2440/mongo_read_secondaries branch November 9, 2017 22:31
@mtyaka
Copy link
Contributor

mtyaka commented Nov 10, 2017

@jdmulloy After this change we're seeing our sandboxes fail with

/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility.execute()
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 346, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/base.py", line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/edx/app/edxapp/edx-platform/cms/djangoapps/contentstore/management/commands/import.py", line 38, in handle
    mstore = modulestore()
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/modulestore/django.py", line 333, in modulestore
    contentstore(),
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/contentstore/django.py", line 28, in contentstore
    _CONTENTSTORE[name] = class_(**options)
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/contentstore/mongo.py", line 42, in __init__
    port=port, tz_aware=tz_aware, user=user, password=password, proxy=proxy, **kwargs
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/mongo_utils.py", line 42, in connect_to_mongodb
    **kwargs
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/pymongo/mongo_client.py", line 311, in __init__
    option, value = common.validate(option, value)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/pymongo/common.py", line 446, in validate
    value = validator(option, value)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/pymongo/common.py", line 243, in validate_read_preference
    raise ConfigurationError("Not a valid read preference")
pymongo.errors.ConfigurationError: Not a valid read preference

Any idea why?

@mtyaka
Copy link
Contributor

mtyaka commented Nov 10, 2017

Could it be because we are not using mongo replica sets for our sandboxes?

@mtyaka
Copy link
Contributor

mtyaka commented Nov 13, 2017

I opened a PR with a proposed fix at https://github.com/edx/edx-platform/pull/16540.

@feanil
Copy link
Contributor

feanil commented Nov 13, 2017

@mtyaka we've reverted this for now while we figure out what's going on and fix the PR.

@feanil
Copy link
Contributor

feanil commented Nov 13, 2017

Sorry for the inconvenience.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants