Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
LopatkinEvgeniy opened this issue Jan 20, 2020 · 2 comments
Open

Comments

@LopatkinEvgeniy
Copy link

LopatkinEvgeniy commented Jan 20, 2020

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 LopatkinEvgeniy changed the title Add a delimiter between host name and it's replication ID Use a delimiter between host name and it's replication index Jan 20, 2020
@lafikl
Copy link
Owner

lafikl commented Jan 21, 2020

Why would it produce collisions?

@LopatkinEvgeniy
Copy link
Author

LopatkinEvgeniy commented Jan 21, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants