Replication between clusters

Please do not merge this pull request.
I would like to discuss some design issues which are commented by "TODO" in code.
partition_size should be fetched in while because the partition size may be changed during iteration.