In the function `ts_hypercube_from_constraints` a hypercube is build
from constraints which reference dimension slices in `dimension_slice`.
As part of a run of `drop_chunks` or when a chunk is explicitly dropped
as part of other operations, dimension slices can be removed from this
table causing the dimension slices to be removed, which makes the
hypercube reference non-existent dimension slices which subsequently
causes a crash.
This commit fixes this by adding a tuple lock on the dimension slices
that are used to build the hypercube.
If two `drop_chunks` are running concurrently, there can be a race if
dimension slices are removed as a result removing a chunk. We treat
this case in the same way as if the dimension slice was updated: report
an error that another session locked the tuple.
Fixes#1986
If a hypertable accidentally broke because a dimension slice is
missing, a segmentation fault will result when an attempt is made to
remove a chunk that references the dimension slice. This happens
because no check if the dimension slice was found is made and the
assumption is that it should be there (by design). Instead of crashing
the server, this commit adds code that prints a warning that the
dimension slice did not exist and proceed with removing the chunk. This
is safe since the chunk should be removed anyway and the missing
dimension slice does not change this.