Turns out #2286 introduced a race, when datashard allows local database to compact borrowed data before all borrowed data is actually loaded and merged into the table. This may cause local database compaction to later fail due to unexpected epoch invariant violations.