Cannot mark an unqueryable datasources segments used
zachjsh opened this issue · comments
Description
It seems that Druid has a check that short circuits the work to mark segments used if it thinks that the datasource does not exist. However, if all of the data in the table has been soft deleted (markUnused), then Druid thinks the datasource doesnt exist, which consequently means that if all data in a datasource in soft deleted, it cannot be recovered:
Here is the Druid check:
It seems that this logic has been here since the inception of the markUsed api #7490.
My thought is that the check for datasource existence was copied from the MarkAsUnused api logic, and used to save potentially unnecessary metadata ops . For markingAsUnused, I believe it does make sense to check for queryable datasource, because if there are any segments to mark as unused, then they are presumably used now, which would make the datasource queryable. However this same check is not appropriate when marking segments used, as there may be no queryable segments.
Motivation
Without fixing this, users cannot easily recover the data for a datasource for which all data has been previously marked unused.