cherry-pick CASSANDRA-5816