File mongodb-2.6.12-git.patch of Package mongodb
diff --git a/buildscripts/setup_multiversion_mongodb.py b/buildscripts/setup_multiversion_mongodb.py
index 740bed8..b9294de 100644
--- a/buildscripts/setup_multiversion_mongodb.py
+++ b/buildscripts/setup_multiversion_mongodb.py
@@ -1,22 +1,41 @@
-#!/usr/bin/python
+#!/usr/bin/env python
import re
import sys
import os
import tempfile
-import urllib2
import subprocess
+import json
+import urlparse
import tarfile
+import signal
+import threading
+import traceback
import shutil
import errno
+from contextlib import closing
# To ensure it exists on the system
-import gzip
+import zipfile
#
# Useful script for installing multiple versions of MongoDB on a machine
# Only really tested/works on Linux.
#
+def dump_stacks(signal, frame):
+ print "======================================"
+ print "DUMPING STACKS due to SIGUSR1 signal"
+ print "======================================"
+ threads = threading.enumerate();
+
+ print "Total Threads: " + str(len(threads))
+
+ for id, stack in sys._current_frames().items():
+ print "Thread %d" % (id)
+ print "".join(traceback.format_stack(stack))
+ print "======================================"
+
+
def version_tuple(version):
"""Returns a version tuple that can be used for numeric sorting
of version strings such as '2.6.0-rc1' and '2.4.0'"""
@@ -24,6 +43,11 @@ def version_tuple(version):
RC_OFFSET = -100
version_parts = re.split(r'\.|-', version[0])
+ if version_parts[-1] == "pre":
+ # Prior to improvements for how the version string is managed within the server
+ # (SERVER-17782), the binary archives would contain a trailing "-pre".
+ version_parts.pop()
+
if version_parts[-1].startswith("rc"):
rc_part = version_parts.pop()
rc_part = rc_part.split('rc')[1]
@@ -32,21 +56,50 @@ def version_tuple(version):
# releases to be sorted in ascending order (e.g., 2.6.0-rc1,
# 2.6.0-rc2, 2.6.0).
version_parts.append(int(rc_part) + RC_OFFSET)
+ elif version_parts[0].startswith("v") and version_parts[-1] == "latest":
+ version_parts[0] = version_parts[0][1:]
+ # The "<branchname>-latest" versions are weighted the highest when a particular major
+ # release is requested.
+ version_parts[-1] = float("inf")
else:
# Non-RC releases have an extra 0 appended so version tuples like
# (2, 6, 0, -100) and (2, 6, 0, 0) sort in ascending order.
version_parts.append(0)
- return tuple(map(int, version_parts))
+ return tuple(map(float, version_parts))
+
+
+def download_file(url, file_name):
+ """Returns True if download was successful. Raises error if download fails."""
+ proc = subprocess.Popen(["curl",
+ "-L", "--silent",
+ "--retry", "5",
+ "--retry-max-time", "600",
+ "--max-time", "120",
+ "-o", file_name,
+ url],
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ proc.communicate()
+ error_code = proc.returncode
+ if not error_code:
+ error_code = proc.wait()
+ if not error_code:
+ return True
+
+ raise Exception("Failed to download %s with error %d" % (url, error_code))
+
class MultiVersionDownloader :
- def __init__(self, install_dir, link_dir, platform):
+ def __init__(self, install_dir, link_dir, edition, platform_arch):
self.install_dir = install_dir
self.link_dir = link_dir
- match = re.compile("(.*)\/(.*)").match(platform)
- self.platform = match.group(1)
- self.arch = match.group(2)
+ self.edition = edition
+ match = re.compile("(.*)\/(.*)").match(platform_arch)
+ if match:
+ self.platform_arch = match.group(1).lower() + "_" + match.group(2).lower()
+ else:
+ self.platform_arch = platform_arch.lower()
self._links = None
@property
@@ -56,31 +109,22 @@ class MultiVersionDownloader :
return self._links
def download_links(self):
- href = "http://dl.mongodb.org/dl/%s/%s" \
- % (self.platform.lower(), self.arch)
-
- attempts_remaining = 5
- timeout_seconds = 10
- while True:
- try:
- html = urllib2.urlopen(href, timeout = timeout_seconds).read()
- break
- except Exception as e:
- print "fetching links failed (%s), retrying..." % e
- attempts_remaining -= 1
- if attempts_remaining == 0 :
- raise Exception("Failed to get links after multiple retries")
+ temp_file = tempfile.mktemp()
+ download_file("https://downloads.mongodb.org/full.json", temp_file)
+ with open(temp_file) as f:
+ full_json = json.load(f)
+ os.remove(temp_file)
+ if 'versions' not in full_json:
+ raise Exception("No versions field in JSON: \n" + str(full_json))
links = {}
- for line in html.split():
- match = re.compile("http:\/\/downloads\.mongodb\.org\/%s/mongodb-%s-%s-([^\"]*)\.tgz" \
- % (self.platform.lower(), self.platform.lower(), self.arch)).search(line)
-
- if match == None: continue
-
- link = match.group(0)
- version = match.group(1)
- links[version] = link
+ for json_version in full_json['versions']:
+ if 'version' in json_version and 'downloads' in json_version:
+ for download in json_version['downloads']:
+ if 'target' in download and 'edition' in download and \
+ download['target'] == self.platform_arch and \
+ download['edition'] == self.edition:
+ links[json_version['version']] = download['archive']['url']
return links
@@ -95,13 +139,16 @@ class MultiVersionDownloader :
urls = []
for link_version, link_url in self.links.iteritems():
- if link_version.startswith(version):
- # If we have a "-" in our version, exact match only
- if version.find("-") >= 0:
- if link_version != version: continue
- elif link_version.find("-") >= 0:
- continue
-
+ if link_version.startswith(version) or link_version == "v%s-latest" % (version):
+ # The 'link_version' is a candidate for the requested 'version' if
+ # (a) it is a prefix of the requested version, or if
+ # (b) it is the "<branchname>-latest" version and the requested version is for a
+ # particular major release.
+ if "-" in version:
+ # The requested 'version' contains a hyphen, so we only consider exact matches
+ # to that version.
+ if link_version != version:
+ continue
urls.append((link_version, link_url))
if len(urls) == 0:
@@ -112,6 +159,7 @@ class MultiVersionDownloader :
full_version = urls[-1][0]
url = urls[-1][1]
extract_dir = url.split("/")[-1][:-4]
+ file_suffix = os.path.splitext(urlparse.urlparse(url).path)[1]
# only download if we don't already have the directory
already_downloaded = os.path.isdir(os.path.join( self.install_dir, extract_dir))
@@ -119,32 +167,50 @@ class MultiVersionDownloader :
print "Skipping download for version %s (%s) since the dest already exists '%s'" \
% (version, full_version, extract_dir)
else:
- temp_dir = tempfile.mkdtemp()
- temp_file = tempfile.mktemp(suffix=".tgz")
-
- data = urllib2.urlopen(url)
-
print "Downloading data for version %s (%s)..." % (version, full_version)
-
- with open(temp_file, 'wb') as f:
- f.write(data.read())
- print "Uncompressing data for version %s (%s)..." % (version, full_version)
-
- # Can't use cool with syntax b/c of python 2.6
- tf = tarfile.open(temp_file, 'r:gz')
-
- try:
- tf.extractall(path=temp_dir)
- except:
- tf.close()
- raise
-
- tf.close()
-
+ print "Download url is %s" % url
+
+ temp_dir = tempfile.mkdtemp()
+ temp_file = tempfile.mktemp(suffix=file_suffix)
+ download_file(url, temp_file)
+
+ print "Uncompressing data for version %s (%s)..." % (version, full_version)
+ first_file = ''
+ if file_suffix == ".zip":
+ # Support .zip downloads, used for Windows binaries.
+ with zipfile.ZipFile(temp_file) as zf:
+ # Use the name of the root directory in the archive as the name of the directory
+ # to extract the binaries into inside 'self.install_dir'. The name of the root
+ # directory nearly always matches the parsed URL text, with the exception of
+ # versions such as "v3.2-latest" that instead contain the githash.
+ first_file = zf.namelist()[0]
+ zf.extractall(temp_dir)
+ elif file_suffix == ".tgz":
+ # Support .tgz downloads, used for Linux binaries.
+ with closing(tarfile.open(temp_file, 'r:gz')) as tf:
+ # Use the name of the root directory in the archive as the name of the directory
+ # to extract the binaries into inside 'self.install_dir'. The name of the root
+ # directory nearly always matches the parsed URL text, with the exception of
+ # versions such as "v3.2-latest" that instead contain the githash.
+ first_file = tf.getnames()[0]
+ tf.extractall(path=temp_dir)
+ else:
+ raise Exception("Unsupported file extension %s" % file_suffix)
+
+ # Sometimes the zip will contain the root directory as the first file and
+ # os.path.dirname() will return ''.
+ extract_dir = os.path.dirname(first_file)
+ if not extract_dir:
+ extract_dir = first_file
temp_install_dir = os.path.join(temp_dir, extract_dir)
-
- shutil.move(temp_install_dir, self.install_dir)
-
+
+ # We may not have been able to determine whether we already downloaded the requested
+ # version due to the ambiguity in the parsed URL text, so we check for it again using
+ # the adjusted 'extract_dir' value.
+ already_downloaded = os.path.isdir(os.path.join(self.install_dir, extract_dir))
+ if not already_downloaded:
+ shutil.move(temp_install_dir, self.install_dir)
+
shutil.rmtree(temp_dir)
os.remove(temp_file)
@@ -162,11 +228,24 @@ class MultiVersionDownloader :
for executable in os.listdir(os.path.join(installed_dir, "bin")):
- link_name = "%s-%s" % (executable, version)
+ executable_name, executable_extension = os.path.splitext(executable)
+ link_name = "%s-%s%s" % (executable_name, version, executable_extension)
try:
- os.symlink(os.path.join(installed_dir, "bin", executable),\
- os.path.join(self.link_dir, link_name))
+ executable = os.path.join(installed_dir, "bin", executable)
+ executable_link = os.path.join(self.link_dir, link_name)
+ if os.name == "nt":
+ # os.symlink is not supported on Windows, use a direct method instead.
+ def symlink_ms(source, link_name):
+ import ctypes
+ csl = ctypes.windll.kernel32.CreateSymbolicLinkW
+ csl.argtypes = (ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_uint32)
+ csl.restype = ctypes.c_ubyte
+ flags = 1 if os.path.isdir(source) else 0
+ if csl(link_name, source.replace('/', '\\'), flags) == 0:
+ raise ctypes.WinError()
+ os.symlink = symlink_ms
+ os.symlink(executable, executable_link)
except OSError as exc:
if exc.errno == errno.EEXIST:
pass
@@ -175,13 +254,20 @@ class MultiVersionDownloader :
CL_HELP_MESSAGE = \
"""
-Downloads and installs particular mongodb versions (each binary is renamed to include its version)
-into an install directory and symlinks the binaries with versions to another directory.
+Downloads and installs particular mongodb versions (each binary is renamed to include its version)
+into an install directory and symlinks the binaries with versions to another directory. This script
+supports community and enterprise builds.
-Usage: setup_multiversion_mongodb.py INSTALL_DIR LINK_DIR PLATFORM_AND_ARCH VERSION1 [VERSION2 VERSION3 ...]
+Usage: setup_multiversion_mongodb.py INSTALL_DIR LINK_DIR EDITION PLATFORM_AND_ARCH VERSION1 [VERSION2 VERSION3 ...]
-Ex: setup_multiversion_mongodb.py ./install ./link "Linux/x86_64" "2.0.6" "2.0.3-rc0" "2.0" "2.2" "2.3"
-Ex: setup_multiversion_mongodb.py ./install ./link "OSX/x86_64" "2.4" "2.2"
+EDITION is one of the following:
+ base (generic community builds)
+ enterprise
+ targeted (platform specific community builds, includes SSL)
+PLATFORM_AND_ARCH can be specified with just a platform, i.e., OSX, if it is supported.
+
+Ex: setup_multiversion_mongodb.py ./install ./link base "Linux/x86_64" "2.0.6" "2.0.3-rc0" "2.0" "2.2" "2.3"
+Ex: setup_multiversion_mongodb.py ./install ./link enterprise "OSX" "2.4" "2.2"
After running the script you will have a directory structure like this:
./install/[mongodb-osx-x86_64-2.4.9, mongodb-osx-x86_64-2.2.7]
@@ -209,22 +295,33 @@ def parse_cl_args(args):
link_dir = args[0]
args = args[1:]
+ if len(args) == 0: raise_exception("Missing EDITION")
+
+ edition = args[0]
+ if edition not in ['base', 'enterprise', 'targeted']:
+ raise Exception("Unsupported edition %s" % edition)
+
+ args = args[1:]
if len(args) == 0: raise_exception("Missing PLATFORM_AND_ARCH")
- platform = args[0]
+ platform_arch = args[0]
args = args[1:]
- if re.compile(".*\/.*").match(platform) == None:
- raise_exception("PLATFORM_AND_ARCH isn't of the correct format")
if len(args) == 0: raise_exception("Missing VERSION1")
versions = args
- return (MultiVersionDownloader(install_dir, link_dir, platform), versions)
+ return (MultiVersionDownloader(install_dir, link_dir, edition, platform_arch), versions)
def main():
+ # Listen for SIGUSR1 and dump stack if received.
+ try:
+ signal.signal(signal.SIGUSR1, dump_stacks)
+ except AttributeError:
+ print "Cannot catch signals on Windows"
+
downloader, versions = parse_cl_args(sys.argv[1:])
for version in versions:
@@ -234,4 +331,3 @@ def main():
if __name__ == '__main__':
main()
-
diff --git a/doxygenConfig b/doxygenConfig
index 799528a..ab5a730 100644
--- a/doxygenConfig
+++ b/doxygenConfig
@@ -3,7 +3,7 @@
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = MongoDB
-PROJECT_NUMBER = 2.6.12
+PROJECT_NUMBER = 2.6.13-pre-
OUTPUT_DIRECTORY = docs/doxygen
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
diff --git a/etc/evergreen.yml b/etc/evergreen.yml
index 72da3d0..774c28a 100644
--- a/etc/evergreen.yml
+++ b/etc/evergreen.yml
@@ -22,6 +22,8 @@
# - 'builder_num'
# - 'builder_phase'
+disable_cleanup: true
+
functions:
"fetch source" :
command: git.get_project
@@ -32,7 +34,7 @@ functions:
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
- remote_file: ${build_variant}/${build_id}.tgz
+ remote_file: mongodb-mongo-v2.6/${build_variant}/${revision}/artifacts/${build_id}.tgz
bucket: mciuploads
extract_to: src
"get buildnumber":
@@ -57,7 +59,7 @@ pre:
silent: true
script: |
${killall_mci|pkill -9 mongod; pkill -9 mongos; pkill -9 mongo; pkill -9 bsondump; pkill -9 mongoimport; pkill -9 mongoexport; pkill -9 mongodump; pkill -9 mongorestore; pkill -9 mongostat; pkill -9 mongofiles; pkill -9 mongooplog; pkill -9 mongotop; pkill -9 mongobridge; pkill -9 mongod-2.6; pkill -9 mongos-2.6; pkill -9 mongo-2.6; pkill -9 bsondump-2.6; pkill -9 mongoimport-2.6; pkill -9 mongoexport-2.6; pkill -9 mongodump-2.6; pkill -9 mongorestore-2.6; pkill -9 mongostat-2.6; pkill -9 mongofiles-2.6; pkill -9 mongooplog-2.6; pkill -9 mongotop-2.6; pkill -9 mongobridge-2.6; pkill -9 mongod-2.4; pkill -9 mongos-2.4; pkill -9 mongo-2.4; pkill -9 bsondump-2.4; pkill -9 mongoimport-2.4; pkill -9 mongoexport-2.4; pkill -9 mongodump-2.4; pkill -9 mongorestore-2.4; pkill -9 mongostat-2.4; pkill -9 mongofiles-2.4; pkill -9 mongooplog-2.4; pkill -9 mongotop-2.4; pkill -9 buildlogger.py; pkill -9 smoke.py; pkill -9 python; pkill -9 cl; pkill -9 lock_mgr_test; pkill -9 background_job_test; pkill -9 repl_coordinator_impl_heartbeat_test} >/dev/null 2>&1
- rm -rf src /data/db/*
+ rm -rf src /data/db/* ~/.aws
exit 0
post:
@@ -69,6 +71,7 @@ post:
silent: true
script: |
${killall_mci|pkill -9 mongod; pkill -9 mongos; pkill -9 mongo; pkill -9 bsondump; pkill -9 mongoimport; pkill -9 mongoexport; pkill -9 mongodump; pkill -9 mongorestore; pkill -9 mongostat; pkill -9 mongofiles; pkill -9 mongooplog; pkill -9 mongotop; pkill -9 mongobridge; pkill -9 mongod-2.6; pkill -9 mongos-2.6; pkill -9 mongo-2.6; pkill -9 bsondump-2.6; pkill -9 mongoimport-2.6; pkill -9 mongoexport-2.6; pkill -9 mongodump-2.6; pkill -9 mongorestore-2.6; pkill -9 mongostat-2.6; pkill -9 mongofiles-2.6; pkill -9 mongooplog-2.6; pkill -9 mongotop-2.6; pkill -9 mongobridge-2.6; pkill -9 mongod-2.4; pkill -9 mongos-2.4; pkill -9 mongo-2.4; pkill -9 bsondump-2.4; pkill -9 mongoimport-2.4; pkill -9 mongoexport-2.4; pkill -9 mongodump-2.4; pkill -9 mongorestore-2.4; pkill -9 mongostat-2.4; pkill -9 mongofiles-2.4; pkill -9 mongooplog-2.4; pkill -9 mongotop-2.4; pkill -9 buildlogger.py; pkill -9 smoke.py; pkill -9 python; pkill -9 cl; pkill -9 lock_mgr_test; pkill -9 background_job_test; pkill -9 repl_coordinator_impl_heartbeat_test} >/dev/null 2>&1
+ rm -rf src /data/db/* ~/.aws
exit 0
### tasks to be run for the branch ###
@@ -133,7 +136,7 @@ tasks:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: target.tgz
- remote_file: ${build_variant}/${build_id}.tgz
+ remote_file: mongodb-mongo-v2.6/${build_variant}/${revision}/artifacts/${build_id}.tgz
bucket: mciuploads
permissions: public-read
content_type: application/tar
@@ -545,7 +548,7 @@ tasks:
${decompress|unzip} mongodb*.${ext|tgz}
cp mongodb*/bin/* .
rm -rf /data/install /data/multiversion
- ${python|python} buildscripts/setup_multiversion_mongodb.py /data/install /data/multiversion "Linux/x86_64" "1.8" "2.0" "2.2" "2.4"
+ ${python|python} buildscripts/setup_multiversion_mongodb.py /data/install /data/multiversion "base" "Linux/x86_64" "1.8" "2.0" "2.2" "2.4"
PATH=$PATH:/data/multiversion ${python|python} buildscripts/smoke.py --nopreallocj --with-cleanbb --mongod ./mongod --mongo ./mongo --report-file report.json ${test_flags|} multiVersion
- name: noPassthrough
@@ -1323,7 +1326,6 @@ buildvariants:
display_name: Linux 64-bit
modules: ~
run_on:
- - rhel55
- rhel55-test
expansions:
push_path: linux
@@ -1336,7 +1338,7 @@ buildvariants:
tasks:
- name: compile
distros:
- - rhel55
+ - rhel55-build
- name: aggregation
- name: aggregation_auth
- name: auth
@@ -1352,7 +1354,6 @@ buildvariants:
- name: jsCore_compatibility
- name: jsCore_small_oplog
- name: mongosTest
- - name: multiversion
- name: noPassthrough
- name: noPassthroughWithMongod
- name: parallel
@@ -1367,14 +1368,11 @@ buildvariants:
- name: slow2
- name: tool
- name: push
- distros:
- - rhel55-test
- name: linux-64-debug
display_name: Linux 64-bit DEBUG
modules: ~
run_on:
- - rhel55
- rhel55-test
expansions:
push_path: linux
@@ -1387,7 +1385,7 @@ buildvariants:
tasks:
- name: compile
distros:
- - rhel55
+ - rhel55-build
- name: aggregation
- name: aggregation_auth
- name: auth
@@ -1419,7 +1417,6 @@ buildvariants:
display_name: Linux 64-bit DUR OFF
modules: ~
run_on:
- - rhel55
- rhel55-test
expansions:
push_path: linux
@@ -1432,7 +1429,7 @@ buildvariants:
tasks:
- name: compile
distros:
- - rhel55
+ - rhel55-build
- name: aggregation
- name: aggregation_auth
- name: auth
@@ -1464,7 +1461,6 @@ buildvariants:
display_name: Linux 64-bit DEBUG DUR OFF
modules: ~
run_on:
- - rhel55
- rhel55-test
expansions:
push_path: linux
@@ -1477,7 +1473,7 @@ buildvariants:
tasks:
- name: compile
distros:
- - rhel55
+ - rhel55-build
- name: aggregation
- name: auth
- name: core
@@ -1529,8 +1525,6 @@ buildvariants:
- name: ssl
- name: sslSpecial
- name: push
- distros:
- - rhel55-test
- name: linux-32
display_name: Linux 32-bit
@@ -1608,7 +1602,7 @@ buildvariants:
tasks:
- name: compile
distros:
- - rhel55
+ - rhel55-build
- name: aggregation
- name: aggregation_auth
- name: auth
@@ -1683,7 +1677,7 @@ buildvariants:
- name: tool
- name: push
distros:
- - rhel55-test
+ - rhel70
- name: windows-64-debug
display_name: Windows 64-bit DEBUG
@@ -1763,7 +1757,7 @@ buildvariants:
- name: tool
- name: push
distros:
- - rhel55-test
+ - rhel70
- name: windows-64-2k8-debug
display_name: Windows 64-bit 2008R2+ DEBUG
@@ -1832,7 +1826,7 @@ buildvariants:
- name: sslSpecial
- name: push
distros:
- - rhel55-test
+ - rhel70
- name: windows-32
display_name: Windows 32-bit
@@ -1868,23 +1862,23 @@ buildvariants:
- name: tool
- name: push
distros:
- - rhel55-test
+ - rhel70
###########################################
# OSX buildvariants #
###########################################
-- name: osx-108
- display_name: OS X 10.8
+- name: osx-106
+ display_name: OS X 10.6
modules: ~
run_on:
- - osx-108
+ - osx-1010
expansions:
push_path: osx
push_bucket: downloads.mongodb.org
push_name: osx
push_arch: x86_64
- compile_flags: --allocator=system -j$(sysctl -n hw.logicalcpu) --release --osx-version-min=10.6
+ compile_flags: --allocator=system -j$(sysctl -n hw.logicalcpu) --release --osx-version-min=10.6 --disable-warnings-as-errors
test_flags: --continue-on-failure
tasks:
- name: compile
@@ -1912,20 +1906,20 @@ buildvariants:
- name: tool
- name: push
distros:
- - rhel55-test
+ - rhel70
-- name: osx-108-debug
- display_name: OS X 10.8 DEBUG
+- name: osx-1010-debug
+ display_name: OS X 10.10 DEBUG
modules: ~
run_on:
- - osx-108
+ - osx-1010
expansions:
push_path: osx
push_bucket: downloads.mongodb.org
push_name: osx-debug
push_arch: x86_64
test_flags: --continue-on-failure
- compile_flags: --dbg=on --opt=on --allocator=system -j$(sysctl -n hw.logicalcpu)
+ compile_flags: --dbg=on --opt=on --allocator=system -j$(sysctl -n hw.logicalcpu) --disable-warnings-as-errors
tasks:
- name: compile
- name: aggregation
@@ -1942,17 +1936,17 @@ buildvariants:
- name: sharding
- name: tool
-- name: osx-108-dur-off
- display_name: OS X 10.8 DUR OFF
+- name: osx-1010-dur-off
+ display_name: OS X 10.10 DUR OFF
modules: ~
run_on:
- - osx-108
+ - osx-1010
expansions:
push_path: osx
push_bucket: downloads.mongodb.org
push_name: osx-duroff
push_arch: x86_64
- compile_flags: --durableDefaultOff --allocator=system -j$(sysctl -n hw.logicalcpu)
+ compile_flags: --durableDefaultOff --allocator=system -j$(sysctl -n hw.logicalcpu) --disable-warnings-as-errors
test_flags: --continue-on-failure
tasks:
- name: compile
@@ -1982,17 +1976,17 @@ buildvariants:
- name: slow2
- name: tool
-- name: osx-108-cxx11-debug
- display_name: OS X 10.8 C++11 DEBUG
+- name: osx-107-cxx11-debug
+ display_name: OS X 10.7 C++11 DEBUG
run_on:
- - osx-108
+ - osx-1010
expansions:
push_path: osx
push_bucket: downloads.mongodb.org
push_name: osx-cxx11-debug
push_arch: x86_64
test_flags: --continue-on-failure
- compile_flags: --dbg=on --opt=on --osx-version-min=10.7 --cc=/usr/bin/clang --cxx=/usr/bin/clang++ --c++11 --allocator=system --libc++ --ssl -j$(sysctl -n hw.logicalcpu)
+ compile_flags: --dbg=on --opt=on --osx-version-min=10.7 --c++11 --allocator=system --libc++ --ssl -j$(sysctl -n hw.logicalcpu) --disable-warnings-as-errors
tasks:
- name: compile
- name: aggregation
@@ -2032,7 +2026,7 @@ buildvariants:
tasks:
- name: compile
distros:
- - rhel55
+ - rhel55-build
- name: audit
- name: jsCore_auth
- name: replicasets_auth
@@ -2042,8 +2036,6 @@ buildvariants:
- name: ssl
- name: sslSpecial
- name: push
- distros:
- - rhel55-test
- name: enterprise-rhel-62-64-bit
display_name: Enterprise RHEL 6.2 64-bit
@@ -2073,7 +2065,7 @@ buildvariants:
- name: sslSpecial
- name: push
distros:
- - rhel55-test
+ - rhel70
- name: enterprise-rhel-70-64-bit
display_name: Enterprise RHEL 7.0 64-bit
@@ -2100,8 +2092,6 @@ buildvariants:
- name: ssl
- name: sslSpecial
- name: push
- distros:
- - rhel55-test
- name: rhel70
display_name: SSL RHEL 7.0 64-bit
@@ -2150,8 +2140,6 @@ buildvariants:
- name: ssl
- name: sslSpecial
- name: push
- distros:
- - rhel55-test
###########################################
# Ubuntu buildvariants #
@@ -2184,8 +2172,6 @@ buildvariants:
- name: ssl
- name: sslSpecial
- name: push
- distros:
- - rhel55-test
- name: enterprise-ubuntu1404-64
display_name: Enterprise Ubuntu 1404 64-bit
@@ -2214,8 +2200,6 @@ buildvariants:
- name: ssl
- name: sslSpecial
- name: push
- distros:
- - rhel55-test
- name: cxx11-ubuntu1204-64
display_name: C++11 Ubuntu 1204 64-bit
@@ -2292,8 +2276,6 @@ buildvariants:
- name: ssl
- name: sslSpecial
- name: push
- distros:
- - rhel55-test
- name: enterprise-suse11-64
display_name: Enterprise SUSE 11 64-bit
@@ -2322,8 +2304,6 @@ buildvariants:
- name: ssl
- name: sslSpecial
- name: push
- distros:
- - rhel55-test
###########################################
# Solaris buildvariants #
@@ -2366,7 +2346,7 @@ buildvariants:
- name: tool
- name: push
distros:
- - rhel55-test
+ - rhel70
###########################################
# Debian buildvariants #
@@ -2399,5 +2379,3 @@ buildvariants:
- name: ssl
- name: sslSpecial
- name: push
- distros:
- - rhel55-test
diff --git a/jstests/core/regex.js b/jstests/core/regex.js
index f431d50..d698267 100644
--- a/jstests/core/regex.js
+++ b/jstests/core/regex.js
@@ -1,24 +1,40 @@
-t = db.jstests_regex;
+(function() {
+ 'use strict';
-t.drop();
-t.save( { a: "bcd" } );
-assert.eq( 1, t.count( { a: /b/ } ) , "A" );
-assert.eq( 1, t.count( { a: /bc/ } ) , "B" );
-assert.eq( 1, t.count( { a: /bcd/ } ) , "C" );
-assert.eq( 0, t.count( { a: /bcde/ } ) , "D" );
+ var t = db.jstests_regex;
-t.drop();
-t.save( { a: { b: "cde" } } );
-assert.eq( 1, t.count( { 'a.b': /de/ } ) , "E" );
+ t.drop();
+ t.save({a: "bcd"});
+ assert.eq(1, t.count({a: /b/}), "A");
+ assert.eq(1, t.count({a: /bc/}), "B");
+ assert.eq(1, t.count({a: /bcd/}), "C");
+ assert.eq(0, t.count({a: /bcde/}), "D");
-t.drop();
-t.save( { a: { b: [ "cde" ] } } );
-assert.eq( 1, t.count( { 'a.b': /de/ } ) , "F" );
+ t.drop();
+ t.save({a: {b: "cde"}});
+ assert.eq(1, t.count({'a.b': /de/}), "E");
-t.drop();
-t.save( { a: [ { b: "cde" } ] } );
-assert.eq( 1, t.count( { 'a.b': /de/ } ) , "G" );
+ t.drop();
+ t.save({a: {b: ["cde"]}});
+ assert.eq(1, t.count({'a.b': /de/}), "F");
-t.drop();
-t.save( { a: [ { b: [ "cde" ] } ] } );
-assert.eq( 1, t.count( { 'a.b': /de/ } ) , "H" );
+ t.drop();
+ t.save({a: [{b: "cde"}]});
+ assert.eq(1, t.count({'a.b': /de/}), "G");
+
+ t.drop();
+ t.save({a: [{b: ["cde"]}]});
+ assert.eq(1, t.count({'a.b': /de/}), "H");
+
+ // Disallow embedded null bytes when using $regex syntax.
+ t.drop();
+ assert.throws(function() {
+ t.find({a: {$regex: "a\0b", $options: "i"}}).itcount();
+ });
+ assert.throws(function() {
+ t.find({a: {$regex: "ab", $options: "i\0"}}).itcount();
+ });
+ assert.throws(function() {
+ t.find({key: {$regex: 'abcd\0xyz'}}).explain();
+ });
+})();
diff --git a/rpm/mongo.mdv.spec b/rpm/mongo.mdv.spec
index 96067aa..38abccb 100644
--- a/rpm/mongo.mdv.spec
+++ b/rpm/mongo.mdv.spec
@@ -1,5 +1,5 @@
%define name mongodb
-%define version 2.6.12
+%define version 2.6.13-pre-
%define release %mkrel 1
Name: %{name}
diff --git a/rpm/mongodb-enterprise-unstable.spec b/rpm/mongodb-enterprise-unstable.spec
index 989c699..3f5d302 100644
--- a/rpm/mongodb-enterprise-unstable.spec
+++ b/rpm/mongodb-enterprise-unstable.spec
@@ -1,7 +1,7 @@
Name: mongodb-enterprise-unstable
Conflicts: mongo-10gen, mongo-10gen-enterprise, mongo-10gen-enterprise-server, mongo-10gen-server, mongo-10gen-unstable, mongo-10gen-unstable-enterprise, mongo-10gen-unstable-enterprise-mongos, mongo-10gen-unstable-enterprise-server, mongo-10gen-unstable-enterprise-shell, mongo-10gen-unstable-enterprise-tools, mongo-10gen-unstable-mongos, mongo-10gen-unstable-server, mongo-10gen-unstable-shell, mongo-10gen-unstable-tools, mongo18-10gen, mongo18-10gen-server, mongo20-10gen, mongo20-10gen-server, mongodb, mongodb-server, mongodb-dev, mongodb-clients, mongodb-10gen, mongodb-10gen-enterprise, mongodb-10gen-unstable, mongodb-10gen-unstable-enterprise, mongodb-10gen-unstable-enterprise-mongos, mongodb-10gen-unstable-enterprise-server, mongodb-10gen-unstable-enterprise-shell, mongodb-10gen-unstable-enterprise-tools, mongodb-10gen-unstable-mongos, mongodb-10gen-unstable-server, mongodb-10gen-unstable-shell, mongodb-10gen-unstable-tools, mongodb-enterprise, mongodb-enterprise-mongos, mongodb-enterprise-server, mongodb-enterprise-shell, mongodb-enterprise-tools, mongodb-nightly, mongodb-org, mongodb-org-mongos, mongodb-org-server, mongodb-org-shell, mongodb-org-tools, mongodb-stable, mongodb18-10gen, mongodb20-10gen, mongodb-org-unstable, mongodb-org-unstable-mongos, mongodb-org-unstable-server, mongodb-org-unstable-shell, mongodb-org-unstable-tools
Obsoletes: mongodb-enterprise-unstable,mongo-enterprise-unstable
-Version: 2.6.12
+Version: 2.6.13-pre-
Release: 1%{?dist}
Summary: MongoDB open source document-oriented database system (enterprise metapackage)
License: Commercial
diff --git a/rpm/mongodb-enterprise.spec b/rpm/mongodb-enterprise.spec
index 5392496..365df95 100644
--- a/rpm/mongodb-enterprise.spec
+++ b/rpm/mongodb-enterprise.spec
@@ -2,7 +2,7 @@ Name: mongodb-enterprise
Conflicts: mongo-10gen, mongo-10gen-server, mongo-10gen-unstable, mongo-10gen-unstable-enterprise, mongo-10gen-unstable-enterprise-mongos, mongo-10gen-unstable-enterprise-server, mongo-10gen-unstable-enterprise-shell, mongo-10gen-unstable-enterprise-tools, mongo-10gen-unstable-mongos, mongo-10gen-unstable-server, mongo-10gen-unstable-shell, mongo-10gen-unstable-tools, mongo18-10gen, mongo18-10gen-server, mongo20-10gen, mongo20-10gen-server, mongodb, mongodb-server, mongodb-dev, mongodb-clients, mongodb-10gen, mongodb-10gen-enterprise, mongodb-10gen-unstable, mongodb-10gen-unstable-enterprise, mongodb-10gen-unstable-enterprise-mongos, mongodb-10gen-unstable-enterprise-server, mongodb-10gen-unstable-enterprise-shell, mongodb-10gen-unstable-enterprise-tools, mongodb-10gen-unstable-mongos, mongodb-10gen-unstable-server, mongodb-10gen-unstable-shell, mongodb-10gen-unstable-tools, mongodb-enterprise-unstable, mongodb-enterprise-unstable-mongos, mongodb-enterprise-unstable-server, mongodb-enterprise-unstable-shell, mongodb-enterprise-unstable-tools, mongodb-nightly, mongodb-org, mongodb-org-mongos, mongodb-org-server, mongodb-org-shell, mongodb-org-tools, mongodb-stable, mongodb18-10gen, mongodb20-10gen, mongodb-org-unstable, mongodb-org-unstable-mongos, mongodb-org-unstable-server, mongodb-org-unstable-shell, mongodb-org-unstable-tools
Obsoletes: mongodb-enterprise-unstable, mongo-enterprise-unstable, mongo-10gen-enterprise
Provides: mongo-10gen-enterprise
-Version: 2.6.12
+Version: 2.6.13-pre-
Release: 1%{?dist}
Summary: MongoDB open source document-oriented database system (enterprise metapackage)
License: Commercial
diff --git a/rpm/mongodb-org-unstable.spec b/rpm/mongodb-org-unstable.spec
index 6b0bb7f..67b7d76 100644
--- a/rpm/mongodb-org-unstable.spec
+++ b/rpm/mongodb-org-unstable.spec
@@ -1,6 +1,6 @@
Name: mongodb-org-unstable
Conflicts: mongo-10gen, mongo-10gen-enterprise, mongo-10gen-enterprise-server, mongo-10gen-server, mongo-10gen-unstable, mongo-10gen-unstable-enterprise, mongo-10gen-unstable-enterprise-mongos, mongo-10gen-unstable-enterprise-server, mongo-10gen-unstable-enterprise-shell, mongo-10gen-unstable-enterprise-tools, mongo-10gen-unstable-mongos, mongo-10gen-unstable-server, mongo-10gen-unstable-shell, mongo-10gen-unstable-tools, mongo18-10gen, mongo18-10gen-server, mongo20-10gen, mongo20-10gen-server, mongodb, mongodb-server, mongodb-dev, mongodb-clients, mongodb-10gen, mongodb-10gen-enterprise, mongodb-10gen-unstable, mongodb-10gen-unstable-enterprise, mongodb-10gen-unstable-enterprise-mongos, mongodb-10gen-unstable-enterprise-server, mongodb-10gen-unstable-enterprise-shell, mongodb-10gen-unstable-enterprise-tools, mongodb-10gen-unstable-mongos, mongodb-10gen-unstable-server, mongodb-10gen-unstable-shell, mongodb-10gen-unstable-tools, mongodb-enterprise, mongodb-enterprise-mongos, mongodb-enterprise-server, mongodb-enterprise-shell, mongodb-enterprise-tools, mongodb-nightly, mongodb-org, mongodb-org-mongos, mongodb-org-server, mongodb-org-shell, mongodb-org-tools, mongodb-stable, mongodb18-10gen, mongodb20-10gen, mongodb-enterprise-unstable, mongodb-enterprise-unstable-mongos, mongodb-enterprise-unstable-server, mongodb-enterprise-unstable-shell, mongodb-enterprise-unstable-tools
-Version: 2.6.12
+Version: 2.6.13-pre-
Release: 1%{?dist}
Summary: MongoDB open source document-oriented database system (metapackage)
License: AGPL 3.0
diff --git a/rpm/mongodb-org.spec b/rpm/mongodb-org.spec
index a2d4854..bb944fc 100644
--- a/rpm/mongodb-org.spec
+++ b/rpm/mongodb-org.spec
@@ -2,7 +2,7 @@ Name: mongodb-org
Conflicts: mongo-10gen-enterprise, mongo-10gen-enterprise-server, mongo-10gen-unstable, mongo-10gen-unstable-enterprise, mongo-10gen-unstable-enterprise-mongos, mongo-10gen-unstable-enterprise-server, mongo-10gen-unstable-enterprise-shell, mongo-10gen-unstable-enterprise-tools, mongo-10gen-unstable-mongos, mongo-10gen-unstable-server, mongo-10gen-unstable-shell, mongo-10gen-unstable-tools, mongo18-10gen, mongo18-10gen-server, mongo20-10gen, mongo20-10gen-server, mongodb, mongodb-server, mongodb-dev, mongodb-clients, mongodb-10gen, mongodb-10gen-enterprise, mongodb-10gen-unstable, mongodb-10gen-unstable-enterprise, mongodb-10gen-unstable-enterprise-mongos, mongodb-10gen-unstable-enterprise-server, mongodb-10gen-unstable-enterprise-shell, mongodb-10gen-unstable-enterprise-tools, mongodb-10gen-unstable-mongos, mongodb-10gen-unstable-server, mongodb-10gen-unstable-shell, mongodb-10gen-unstable-tools, mongodb-enterprise, mongodb-enterprise-mongos, mongodb-enterprise-server, mongodb-enterprise-shell, mongodb-enterprise-tools, mongodb-nightly, mongodb-org-unstable, mongodb-org-unstable-mongos, mongodb-org-unstable-server, mongodb-org-unstable-shell, mongodb-org-unstable-tools, mongodb-stable, mongodb18-10gen, mongodb20-10gen, mongodb-enterprise-unstable, mongodb-enterprise-unstable-mongos, mongodb-enterprise-unstable-server, mongodb-enterprise-unstable-shell, mongodb-enterprise-unstable-tools
Obsoletes: mongo-10gen
Provides: mongo-10gen
-Version: 2.6.12
+Version: 2.6.13-pre-
Release: 1%{?dist}
Summary: MongoDB open source document-oriented database system (metapackage)
License: AGPL 3.0
diff --git a/src/mongo/db/matcher/expression_leaf.cpp b/src/mongo/db/matcher/expression_leaf.cpp
index 6800263..9b325b1 100644
--- a/src/mongo/db/matcher/expression_leaf.cpp
+++ b/src/mongo/db/matcher/expression_leaf.cpp
@@ -204,6 +204,16 @@ namespace mongo {
return Status( ErrorCodes::BadValue, "Regular expression is too long" );
}
+ if (regex.find('\0') != std::string::npos) {
+ return Status(ErrorCodes::BadValue,
+ "Regular expression cannot contain an embedded null byte");
+ }
+
+ if (options.find('\0') != std::string::npos) {
+ return Status(ErrorCodes::BadValue,
+ "Regular expression options string cannot contain an embedded null byte");
+ }
+
_regex = regex.toString();
_flags = options.toString();
_re.reset( new pcrecpp::RE( _regex.c_str(), flags2options( _flags.c_str() ) ) );
diff --git a/src/mongo/db/matcher/expression_leaf_test.cpp b/src/mongo/db/matcher/expression_leaf_test.cpp
index b28f3f1..6f2e028 100644
--- a/src/mongo/db/matcher/expression_leaf_test.cpp
+++ b/src/mongo/db/matcher/expression_leaf_test.cpp
@@ -850,57 +850,6 @@ namespace mongo {
ASSERT_EQUALS( "1", details.elemMatchKey() );
}
- /**
- TEST( GteOp, MatchesIndexKeyScalar ) {
- BSONObj operand = BSON( "$gte" << 6 );
- GteOp gte;
- ASSERT( gte.init( "a", operand[ "$gte" ] ).isOK() );
- IndexSpec indexSpec( BSON( "a" << 1 ) );
- ASSERT( MatchMatchExpression::PartialMatchResult_True ==
- gte.matchesIndexKey( BSON( "" << 6 ), indexSpec ) );
- ASSERT( MatchMatchExpression::PartialMatchResult_False ==
- gte.matchesIndexKey( BSON( "" << 5 ), indexSpec ) );
- ASSERT( MatchMatchExpression::PartialMatchResult_False ==
- gte.matchesIndexKey( BSON( "" << BSON_ARRAY( 7 ) ), indexSpec ) );
- }
-
- TEST( GteOp, MatchesIndexKeyMissing ) {
- BSONObj operand = BSON( "$gte" << 6 );
- GteOp gte;
- ASSERT( gte.init( "a", operand[ "$gte" ] ).isOK() );
- IndexSpec indexSpec( BSON( "b" << 1 ) );
- ASSERT( MatchMatchExpression::PartialMatchResult_Unknown ==
- gte.matchesIndexKey( BSON( "" << 6 ), indexSpec ) );
- ASSERT( MatchMatchExpression::PartialMatchResult_Unknown ==
- gte.matchesIndexKey( BSON( "" << 4 ), indexSpec ) );
- ASSERT( MatchMatchExpression::PartialMatchResult_Unknown ==
- gte.matchesIndexKey( BSON( "" << BSON_ARRAY( 8 << 6 ) ), indexSpec ) );
- }
-
- TEST( GteOp, MatchesIndexKeyArray ) {
- BSONObj operand = BSON( "$gte" << BSON_ARRAY( 4 << 5 ) );
- GteOp gte;
- ASSERT( gte.init( "a", operand[ "$gte" ] ).isOK() );
- IndexSpec indexSpec( BSON( "a" << 1 ) );
- ASSERT( MatchMatchExpression::PartialMatchResult_Unknown ==
- gte.matchesIndexKey( BSON( "" << 6 ), indexSpec ) );
- }
-
- TEST( GteOp, MatchesIndexKeyArrayValue ) {
- BSONObj operand = BSON( "$gte" << 6 );
- GteOp gte;
- ASSERT( gte.init( "a", operand[ "$gte" ] ).isOK() );
- IndexSpec indexSpec( BSON( "loc" << "mockarrayvalue" << "a" << 1 ) );
- ASSERT( MatchMatchExpression::PartialMatchResult_True ==
- gte.matchesIndexKey( BSON( "" << "dummygeohash" << "" << 6 ), indexSpec ) );
- ASSERT( MatchMatchExpression::PartialMatchResult_False ==
- gte.matchesIndexKey( BSON( "" << "dummygeohash" << "" << 3 ), indexSpec ) );
- ASSERT( MatchMatchExpression::PartialMatchResult_True ==
- gte.matchesIndexKey( BSON( "" << "dummygeohash" <<
- "" << BSON_ARRAY( 8 << 6 << 4 ) ), indexSpec ) );
- }
- */
-
TEST( RegexMatchExpression, MatchesElementExact ) {
BSONObj match = BSON( "a" << "b" );
BSONObj notMatch = BSON( "a" << "c" );
@@ -1097,44 +1046,51 @@ namespace mongo {
ASSERT( !r1.equivalent( &r4 ) );
}
- /**
- TEST( RegexMatchExpression, MatchesIndexKeyScalar ) {
- RegexMatchExpression regex;
- ASSERT( regex.init( "a", "xyz", "" ).isOK() );
- IndexSpec indexSpec( BSON( "a" << 1 ) );
- ASSERT( MatchMatchExpression::PartialMatchResult_True ==
- regex.matchesIndexKey( BSON( "" << "z xyz" ), indexSpec ) );
- ASSERT( MatchMatchExpression::PartialMatchResult_False ==
- regex.matchesIndexKey( BSON( "" << "xy" ), indexSpec ) );
- ASSERT( MatchMatchExpression::PartialMatchResult_False ==
- regex.matchesIndexKey( BSON( "" << BSON_ARRAY( "xyz" ) ), indexSpec ) );
- }
+ TEST(RegexMatchExpression, RegexCannotContainEmbeddedNullByte) {
+ RegexMatchExpression regex;
+ {
+ StringData embeddedNull("a\0b", StringData::LiteralTag());
+ ASSERT_NOT_OK(regex.init("path", embeddedNull, ""));
+ }
- TEST( RegexMatchExpression, MatchesIndexKeyMissing ) {
- RegexMatchExpression regex;
- ASSERT( regex.init( "a", "xyz", "" ).isOK() );
- IndexSpec indexSpec( BSON( "b" << 1 ) );
- ASSERT( MatchMatchExpression::PartialMatchResult_Unknown ==
- regex.matchesIndexKey( BSON( "" << "z xyz" ), indexSpec ) );
- ASSERT( MatchMatchExpression::PartialMatchResult_Unknown ==
- regex.matchesIndexKey( BSON( "" << "xy" ), indexSpec ) );
- ASSERT( MatchMatchExpression::PartialMatchResult_Unknown ==
- regex.matchesIndexKey( BSON( "" << BSON_ARRAY( 8 << "xyz" ) ), indexSpec ) );
- }
+ {
+ StringData singleNullByte("\0", StringData::LiteralTag());
+ ASSERT_NOT_OK(regex.init("path", singleNullByte, ""));
+ }
- TEST( RegexMatchExpression, MatchesIndexKeyArrayValue ) {
- RegexMatchExpression regex;
- ASSERT( regex.init( "a", "xyz", "" ).isOK() );
- IndexSpec indexSpec( BSON( "loc" << "mockarrayvalue" << "a" << 1 ) );
- ASSERT( MatchMatchExpression::PartialMatchResult_True ==
- regex.matchesIndexKey( BSON( "" << "dummygeohash" << "" << "xyz" ), indexSpec ) );
- ASSERT( MatchMatchExpression::PartialMatchResult_False ==
- regex.matchesIndexKey( BSON( "" << "dummygeohash" << "" << "z" ), indexSpec ) );
- ASSERT( MatchMatchExpression::PartialMatchResult_True ==
- regex.matchesIndexKey( BSON( "" << "dummygeohash" <<
- "" << BSON_ARRAY( "r" << 6 << "xyz" ) ), indexSpec ) );
- }
- */
+ {
+ StringData leadingNullByte("\0bbbb", StringData::LiteralTag());
+ ASSERT_NOT_OK(regex.init("path", leadingNullByte, ""));
+ }
+
+ {
+ StringData trailingNullByte("bbbb\0", StringData::LiteralTag());
+ ASSERT_NOT_OK(regex.init("path", trailingNullByte, ""));
+ }
+ }
+
+ TEST(RegexMatchExpression, RegexOptionsStringCannotContainEmbeddedNullByte) {
+ RegexMatchExpression regex;
+ {
+ StringData embeddedNull("a\0b", StringData::LiteralTag());
+ ASSERT_NOT_OK(regex.init("path", "pattern", embeddedNull));
+ }
+
+ {
+ StringData singleNullByte("\0", StringData::LiteralTag());
+ ASSERT_NOT_OK(regex.init("path", "pattern", singleNullByte));
+ }
+
+ {
+ StringData leadingNullByte("\0bbbb", StringData::LiteralTag());
+ ASSERT_NOT_OK(regex.init("path", "pattern", leadingNullByte));
+ }
+
+ {
+ StringData trailingNullByte("bbbb\0", StringData::LiteralTag());
+ ASSERT_NOT_OK(regex.init("path", "pattern", trailingNullByte));
+ }
+ }
TEST( ModMatchExpression, MatchesElement ) {
BSONObj match = BSON( "a" << 1 );
diff --git a/src/mongo/db/ops/modifier_rename.cpp b/src/mongo/db/ops/modifier_rename.cpp
index 3942d11..79ecce7 100644
--- a/src/mongo/db/ops/modifier_rename.cpp
+++ b/src/mongo/db/ops/modifier_rename.cpp
@@ -84,6 +84,12 @@ namespace mongo {
<< modExpr);
}
+ StringData valueStringData(modExpr.valuestr(), modExpr.valuestrsize() - 1);
+ if (valueStringData.find('\0') != std::string::npos) {
+ return Status(ErrorCodes::BadValue,
+ "The 'to' field for $rename cannot contain an embedded null byte");
+ }
+
// Extract the field names from the mod expression
_fromFieldRef.parse(modExpr.fieldName());
diff --git a/src/mongo/db/ops/modifier_rename_test.cpp b/src/mongo/db/ops/modifier_rename_test.cpp
index 6d889bb..37b1a6f 100644
--- a/src/mongo/db/ops/modifier_rename_test.cpp
+++ b/src/mongo/db/ops/modifier_rename_test.cpp
@@ -107,6 +107,33 @@ namespace {
ModifierInterface::Options::normal()));
}
+ TEST(InvalidInit, ToFieldCannotContainEmbeddedNullByte) {
+ ModifierRename mod;
+ {
+ StringData embeddedNull("a\0b", StringData::LiteralTag());
+ ASSERT_NOT_OK(mod.init(BSON("a" << embeddedNull).firstElement(),
+ ModifierInterface::Options::normal()));
+ }
+
+ {
+ StringData singleNullByte("\0", StringData::LiteralTag());
+ ASSERT_NOT_OK(mod.init(BSON("a" << singleNullByte).firstElement(),
+ ModifierInterface::Options::normal()));
+ }
+
+ {
+ StringData leadingNullByte("\0bbbb", StringData::LiteralTag());
+ ASSERT_NOT_OK(mod.init(BSON("a" << leadingNullByte).firstElement(),
+ ModifierInterface::Options::normal()));
+ }
+
+ {
+ StringData trailingNullByte("bbbb\0", StringData::LiteralTag());
+ ASSERT_NOT_OK(mod.init(BSON("a" << trailingNullByte).firstElement(),
+ ModifierInterface::Options::normal()));
+ }
+ }
+
TEST(MissingFrom, InitPrepLog) {
Document doc(fromjson("{a: 2}"));
Mod setMod(fromjson("{$rename: {'b':'a'}}"));
diff --git a/src/mongo/s/balance.cpp b/src/mongo/s/balance.cpp
index d0b892a..727d5f9 100644
--- a/src/mongo/s/balance.cpp
+++ b/src/mongo/s/balance.cpp
@@ -321,17 +321,6 @@ namespace mongo {
DistributionStatus status(shardInfo, shardToChunksMap.map());
// load tags
- Status result = clusterCreateIndex(TagsType::ConfigNS,
- BSON(TagsType::ns() << 1 << TagsType::min() << 1),
- true, // unique
- WriteConcernOptions::AllConfigs,
- NULL);
-
- if ( !result.isOK() ) {
- warning() << "could not create index tags_1_min_1: " << result.reason() << endl;
- continue;
- }
-
cursor = conn.query(TagsType::ConfigNS,
QUERY(TagsType::ns(ns)).sort(TagsType::min()));
diff --git a/src/mongo/s/config.cpp b/src/mongo/s/config.cpp
index f1d27e0..60ebb1e 100644
--- a/src/mongo/s/config.cpp
+++ b/src/mongo/s/config.cpp
@@ -51,6 +51,7 @@
#include "mongo/s/type_lockpings.h"
#include "mongo/s/type_settings.h"
#include "mongo/s/type_shard.h"
+#include "mongo/s/type_tags.h"
#include "mongo/util/net/message.h"
#include "mongo/util/stringutils.h"
@@ -1164,6 +1165,16 @@ namespace mongo {
warning() << "couldn't create lockping ping time index on config db: "
<< result.reason() << endl;
}
+
+ result = clusterCreateIndex(TagsType::ConfigNS,
+ BSON(TagsType::ns() << 1 << TagsType::min() << 1),
+ true, // unique
+ WriteConcernOptions::AllConfigs,
+ NULL);
+
+ if (!result.isOK()) {
+ warning() << "could not create index ns_1_min_1: " << causedBy(result);
+ }
}
string ConfigServer::getHost( const std::string& name , bool withPort ) {
diff --git a/src/mongo/tools/dump.cpp b/src/mongo/tools/dump.cpp
index 7f8c6b4..744bbac 100644
--- a/src/mongo/tools/dump.cpp
+++ b/src/mongo/tools/dump.cpp
@@ -275,6 +275,8 @@ public:
LogIndentLevel lil2;
set<DiskLoc> seen;
+ const DiskLoc extentBegin = e->myLoc;
+ const DiskLoc extentEnd = DiskLoc(extentBegin.a(), extentBegin.getOfs() + e->length);
DiskLoc loc = forward ? e->firstRecord : e->lastRecord;
while ( ! loc.isNull() ){
@@ -318,9 +320,7 @@ public:
loc = forward ? rec->getNext( loc ) : rec->getPrev( loc );
// break when new loc is outside current extent boundary
- if ( ( forward && loc.compare( e->lastRecord ) > 0 ) ||
- ( ! forward && loc.compare( e->firstRecord ) < 0 ) )
- {
+ if (loc.compare(extentBegin) < 0 || loc.compare(extentEnd) > 0) {
break;
}
}
diff --git a/src/mongo/util/version.cpp b/src/mongo/util/version.cpp
index 3f7b648..6d93837 100644
--- a/src/mongo/util/version.cpp
+++ b/src/mongo/util/version.cpp
@@ -31,7 +31,7 @@ namespace mongo {
* 1.2.3-rc4-pre-
* If you really need to do something else you'll need to fix _versionArray()
*/
- const char versionString[] = "2.6.12";
+ const char versionString[] = "2.6.13-pre-";
// See unit test for example outputs
BSONArray toVersionArray(const char* version){