The introduction of several vtables lets us resolve a few more
cyclic dependencies into `mongo/db/catalog/catalog`. Fully
resolved libraries have had their libdeps checking exemptions
removed.
The `DatabaseHolder` class and the `dbHolder` free function are
used in many libraries which are circularly dependent with `catalog`.
By adding a vtable to facilitate dynamically injectable implementations,
we can break those dependencies.
This workaround allows building MongoDB under Microsoft's upcoming
compiler, with the `/Zc:ternary` option enabled. This option would
be implied by the `/permissive-` option. The code fails to compile
under this mode when using Microsoft's existing `std::list`
implementation. This explicit cast can be removed once Microsoft's
`std::list` stops using inheritance between const and modifiable
iterators.
The issue arises because the `?:` ternary operator requires an
impossible conversion from a `const iterator &` to a
`const_iterator &&` or a `const_iterator &`. This occurs because
Microsoft's `std::list< ... >::iterator` inherits from
`std::list< ... >::const_iterator`. Were the `const iterator &`
non-constant (`iterator &`), this would work. Additionally, were the
`const_iterator &` constant (`const const_iterator &`), this would
also work.
Closes #1147
RangePreserver was an old way to ensure that necessary chunk
ranges are not deleted during query execution. This is now
handled by ScopedCollectionMetadata.
The MSVC compiler has warnings which alert users that the behavior
of the compiler has changed. In the case of C4383, the compiler
used to have non-conforming behavior to C++98. At some point this
behavior was fixed. MongoDB's code base should not have any code
which would be adversely affected by this change, as the code is
also compiled on platforms where the native compiler is conformant
to the standard in this point. Therefore it should be safe to
disable this warning.
The specific warning cautions that a derived class's inline
definition of a virtual function will now override a parent's
implementation, where formerly it would not. This would happen
when the derived class's implementation specified at least one
of the parameters `const` (in such a way that the actual signature
of the function isn't changed). MSVC incorrectly determines that
if there are two functions that differ only in a non-observable
`const` specifier, then they would have different signatures, in
many circumstances. This would mean that the compiler resorts to
treating such functions as overloads. The compiler now behaves
correctly for the case of override in a derived class; however,
it issues a warning. The warning is irrelevant to us.
The `CollectionInfoCache` class is used outside of the catalog
library in many places. This change slices that dependency
by providing an initializable vtable based pimpl class. This
should permit a further reduction in the number of cyclic
dependencies in the graph.
With the creation of many dependency slices using vtables, the
build graph can be altered to resolve libraries depending upon such
modules. Several incomplete libraries are completely resolved with
this change.