Move attachment code into couch_att

This is moves a majority of the attachment representation
into the couch_att module. This serves to isolate the
current record to allow easier in-place upgrades as well as
a place to start collecting common attachment related
functionality.

The upgrades are handled lazily to allow rollbacks to older
code if the new attachment format has not yet been required
via storage of any of the new extended attributes supported
by the fetch/store APIs. There are some caveats to this in
that the extended attributes are not enforced by couch_att
at this time so it'd be quite easy to store garbage. As the
extent of attachment concerns becomes more stable, a set of
more permanent fetch_[field]/store_[field] functions may be
added to help enforce both field types as well as common
field names and defaults (all fields will default to
undefined except for those defaults present in the orignal
record definition, which carry over automatically).

Finally, while this patch does move a lot of code to
couch_att, it hasn't refined the interfaces much. These
changes will follow in later patches to improve and
simplify the organization of attachment code. This
includes the addition of more unit tests which currently
only cover some portions of the attachment functionality
related to upgrades and field fetching & storage.
Always report why couch_server crashes

On servers with a large number of open databases the couch_server state
is too large to be logged, and so when it crashes we miss the reason for
the crash.  This patch adds an extra message that redacts enough of the
server state to ensure a properly-formatted message.

BugzID: 26902
Add doc ID for last merged key tree to proc dict

This is for debugging purposes, ie. for operators to get the ID of a
heavily conflicted document which is taking a lot of time to merge.

BugzID: 28940
Make rev tree stemming for interactives optional

Documents with many conflicts and/or tombstones cause significant
performance degradation for couch_db_updater due to the stemming of rev
trees. This commit helps to fix this problem by making rev tree stemming
on interactive updates optional. This change makes it possible for rev
trees to temporarily become longer than revs_limit. When active, the
burden of rev tree stemming will fall on replication and compaction.

BugzID: 30438
Amend a too-restrictive pattern match

We were asserting that the subpath contains exactly one element, but in
reality the subpath can be empty (which will result in an immediate
failure to merge on the next recursion).

BugzID: 30686
Add couch_db_header:latest/1

This function returns false if it's supplied an integer less than the
?LATEST_DISK_VERSION, true if supplied ?LATEST_DISK_VERSION, and
undefined on any other input.

BugzID: 15762
[WIP] Add an event for each updated design doc

This sends an event for each design doc so we can include the document
id.
squashme! ignore all parameters in content-type, not just exactly one (grgrgrgrgrgrgrgrrr!!!)
Fix multipart PUTs for document attachments

Accidentally dropped some work for multipart attachments in clusters
when we merged couch_att.erl
Silence warnings for dict type
Match the old ordering for attachments

This affects when we're updating attachments and need to merge updated
attachments onto a non-deleted document. The old code useda  lists:map/2
where as the new code is a tail recursive approach. This just reverses
the accumulator to match the same order as we had previously.
Garbage collect OS process Pids

The amount of data flowing through these pids to the ports can cause a
significant amount of garbage to accumulate. This just reacts to a
request from the proc manager to occasionally garbage collect.
Use the correct record when updating ddoc_keys.
Remove old upgrade code.
Store the language as a binary in ets

This was breaking pattern matching and never reusing OS processes. The
new hard limit in CouchDB caused the bug to manifest where we'd not seen
it previously.
Remove duplicate couch_replicator processes

These are started by the couch_replicator application now.
Fix attachment revpos values
Update the task if any props change

This ignores the frequency setting and just updates forcefully on any
change to the task properties.
Remove upgrade code that was re-introduced during the merge
Remove debug logging