Backport replication_stats to 1.4