Implement data record merging.

When a node would end up with two records pointing to the same data we instead
want to move the data record up to the parent node. This can greatly shrink
trees that would otherwise be pointlessly large.