Skip to content

Unique system ids for cached initdb #35

New issue

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

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

Already on GitHub? # to your account

Merged

Conversation

funbringer
Copy link
Collaborator

If enabled, generate unique system ids for nodes spawned from initdb cache.

@funbringer funbringer requested review from ildus and arssher February 21, 2018 15:38
@codecov-io
Copy link

codecov-io commented Feb 21, 2018

Codecov Report

Merging #35 into master will decrease coverage by <.01%.
The diff coverage is 95.34%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #35      +/-   ##
==========================================
- Coverage   97.17%   97.17%   -0.01%     
==========================================
  Files          13       13              
  Lines        1167     1202      +35     
==========================================
+ Hits         1134     1168      +34     
- Misses         33       34       +1
Impacted Files Coverage Δ
testgres/config.py 97.05% <100%> (+0.04%) ⬆️
testgres/consts.py 100% <100%> (ø) ⬆️
tests/test_simple.py 99.73% <100%> (+0.01%) ⬆️
testgres/utils.py 98% <100%> (+0.17%) ⬆️
testgres/cache.py 87.87% <81.81%> (-3.04%) ⬇️
testgres/backup.py 96.55% <0%> (ø) ⬆️
testgres/node.py 97.55% <0%> (+0.29%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5bd8d48...636d0f9. Read the comment docs.

@funbringer funbringer merged commit 56f79aa into postgrespro:master Feb 22, 2018
@funbringer funbringer deleted the unique_system_ids_for_cached_initdb branch February 22, 2018 15:12
@arssher
Copy link
Contributor

arssher commented Feb 24, 2018

I've modified shardman to use this stuff and it works great, thanks.

system_id |= (os.getpid() & 0xFFF)

# pack ULL in native byte order
return struct.pack('=Q', system_id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will probably bail out with struct.error: argument out of range after 19 January 2038, but for now it is fine :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arssher Why? We have 32 bits for seconds, and that's ~136 years.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, =Q is unsigned. Yes, then we have 68 years more.

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

Successfully merging this pull request may close these issues.

4 participants