[8.x] Backport clustering fixes from master