consistent icon indicating copy to clipboard operation
consistent copied to clipboard

Use a delimiter between host name and it's replication index

Open LopatkinEvgeniy opened this issue 5 years ago • 2 comments

fmt.Sprintf("%s%d", host, i)

What if host names will be: host1, host2, ... host21, host22. Current mechanism of replications naming will produce a lot of collisions. Some sort of delimiter is required:

const delimiter = "æ" // some rare utf-8 symbol
...

fmt.Sprintf("%s%s%d", host, delimiter, i)

For example unicode 'SYMBOL FOR UNIT SEPARATOR' may be used: https://www.fileformat.info/info/unicode/char/241f/index.htm

LopatkinEvgeniy avatar Jan 20 '20 13:01 LopatkinEvgeniy

Why would it produce collisions?

lafikl avatar Jan 21 '20 12:01 lafikl

Oh, sorry. It will not produce collisions. I reproduce this because i tune replicationFactor in my copy of code.

If replicationFactor will be greater than 10 it may produce collisions:

  • "host1" + "10" = "host110"
  • "host11" + "0" = "host110"

But maybe a delimiter is still not a bad idea. Because it will help to avoid collisions that i receive when i try to tune this library.

LopatkinEvgeniy avatar Jan 21 '20 14:01 LopatkinEvgeniy