SERVER-8802 SERVER-8814 Don't build indexes from inserts into collection names ending in ".system.indexes"

Conflicts:
	src/mongo/db/cloner.cpp
	src/mongo/db/oplog.cpp
	src/mongo/db/pdfile.cpp
	src/mongo/db/repl/rs_sync.cpp
	src/mongo/tools/dump.cpp
	src/mongo/tools/restore.cpp
SERVER-8597 The presence of invalid roles shouldn't prevent privilege acquisition from valid roles
SERVER-10596 Globalize formerly per-thread Pool of JS Scopes

This ensures that the limit of 10 pooled scopes is actually enforced.
With a per-thread Pool, long-lived connections could cause very high
memory usage (both real and virtual) even if they haven't used JS in a
long time.

Manually fixed backport of commit 73841f7a1ec1322d96179eb2712ab438f56add00

Conflicts:
	jstests/auth/js_scope_leak.js
	src/mongo/db/auth/auth_external_state.h
	src/mongo/db/auth/auth_external_state_d.cpp
	src/mongo/db/auth/auth_external_state_d.h
	src/mongo/db/auth/auth_external_state_s.cpp
	src/mongo/db/auth/auth_external_state_s.h
	src/mongo/db/auth/authorization_session.cpp
	src/mongo/db/auth/authorization_session.h
	src/mongo/db/commands/group.cpp
	src/mongo/db/matcher/expression_where.cpp
	src/mongo/scripting/engine.cpp

Conflicts:
	src/mongo/db/commands/mr.cpp
	src/mongo/db/matcher.cpp
SERVER-8217 Write test for id logging
SERVER-8625 Allow dbAdmins to view index definitions
SERVER-8540 Add test that non-dbAdmins can't read system.profile
SERVER-8540 Only dbAdmin should be able to read system.profile
SERVER-8623 Don't allow renameCollection to bypass auth checks on system namespaces
SERVER-8217 Fix regex for timestamp
SERVER-8217 Better fix for regex
SERVER-8217 Write test for id logging

Make tests allocate port dynamically
SERVER-9983 Test verifying that internal user privileges do not mask those of similarly named users.
Fix segfault when logout command runs on a database with no authenticated users.
SERVER-8328 Make naming for roles consistent
SERVER-9649 Make writeBacksQueued be granted by clusterAdmin
SERVER-9983 Do not needlessly lock when looking up privileges for the __system@local user.

Uncorrected, this can cause replica set heartbeats to stall behind operations
that hold the read lock for a long time.
SERVER-8486 prevent empty dbnames in command params from crashing auth'd mongod

The crux of the issue is that we don't do command param checking until after
we've set up auth, but for certain commands we need their params to set up auth.
 This might be fixed/avoided if we had a more formalized structure for
sanitizing input to commands.

Conflicts:
	src/mongo/db/dbcommands.cpp
SERVER-8527 Do not try to read the non-existent "$external" database during privilege acquisition.

It is the attempt to acquire privileges stored in "$external.system.users" that is causing the
the DatabaseHolder to construct a Database object for the non-existent "$external" database during
normal operation.  This change aleviates that on the acquire privileges code path, without fixing
the more general problem of creating database objects for illegal database names.  That problem
is far stickier, and this limited solution ameliorates the "can't add shards" symptom.
SERVER-9111 Do not try to find user documents in $CLUSTER or $SERVER pseudodatabases.
SERVER-8597 Fix AuthorizationManager unit test now that invalid roles no longer prevent privilege acquisition