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

Replace shm.map with separate create() and open() #794

Merged
merged 4 commits into from
Mar 6, 2016

Conversation

wingo
Copy link
Contributor

@wingo wingo commented Mar 1, 2016

Currently shm.map() will create the file and any containing directories
if it does not exist. This is not so great, so I split it into separate
open() and create() functions, adapt all callers, and remove map() from
the public interface of the shm module.

Currently shm.map() will create the file and any containing directories
if it does not exist.  This is not so great, so I split it into separate
open() and create() functions, adapt all callers, and remove map() from
the public interface of the shm module.
@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @lukego, @eugeneia and @llelf to be potential reviewers

@eugeneia eugeneia self-assigned this Mar 1, 2016
@lukego
Copy link
Member

lukego commented Mar 1, 2016

"hierarchical", "brevity", "artefact", "bureaucracy"... damn these words :)

@eugeneia
Copy link
Member

eugeneia commented Mar 1, 2016

This is not so great

I fail to see why. Can you elaborate? As far as I am concerned this changes the API around file system semantics that are not relevant to the API. E.g. before you could first map an object read only, then another process could map that object, write to it, and it would work. Now you need to make sure that you open an object only after it was created by another process. Correct me if I am wrong.

@lukego
Copy link
Member

lukego commented Mar 1, 2016

I should consider whether this helps solve the problem with #767.

@wingo
Copy link
Contributor Author

wingo commented Mar 1, 2016

E.g. before you could first map an object read only, then another process could map that object, write to it, and it would work. Now you need to make sure that you open an object only after it was created by another process. Correct me if I am wrong.

This is correct. It could be that we always want to be using create(). It seems wrong to me though in some deep way :) Like, a process that is just reading data doesn't want to create it if it doesn't exist. The fact that a counter doesn't exist could be interesting information that would be perturbed by the reader. For example if there is counter data that has some kind of complicated interior structure I would want to be sure to initialize it correctly; dunno.

Concretely snabb top will show latency information if the latency histogram is there, and not otherwise.

Perhaps this is worrying too much though; other thoughts are welcome.

@wingo
Copy link
Contributor Author

wingo commented Mar 1, 2016

Added on a couple commits I found while porting the histogram to use this.

@wingo
Copy link
Contributor Author

wingo commented Mar 3, 2016

I would like to have the histogram stuff off my plate by the end of the week, so review here would be appreciated @eugeneia :)

@eugeneia
Copy link
Member

eugeneia commented Mar 3, 2016

@wingo Sorry, somehow I missed the previous comments. I gave this a lot of thought and while I generally feel bad about extending an API based on gut feeling, I do share the same gut feeling and feel that this new API is more hygienic.

What is missing though is the adaption of snabb top. As it is now this PR would break snabb top as far as I can tell?

@wingo
Copy link
Contributor Author

wingo commented Mar 3, 2016

Thanks for the review. I am not sure how snabb top would break; it does seem to work for me in #795, but I will check tomorrow to make sure.

@eugeneia
Copy link
Member

eugeneia commented Mar 3, 2016

It works because #795 updates snabb top to use open instead of map I presume. Please keep PRs atomic in the future (if there was a CI test for snabb top this would not have passed).

@eugeneia eugeneia added the merged label Mar 3, 2016
@wingo
Copy link
Contributor Author

wingo commented Mar 3, 2016

Hmm, OK. I don't see the change you refer to in #795; would you mind pointing it out? I do try to keep these things atomic but I occasionally make mistakes :)

eugeneia added a commit to eugeneia/snabb that referenced this pull request Mar 3, 2016
@eugeneia
Copy link
Member

eugeneia commented Mar 3, 2016

@wingo Oops, my bad. Somehow I was absolutely sure that snabb top uses shm.map (while it doesn't).

@wingo
Copy link
Contributor Author

wingo commented Mar 3, 2016

Thanks very much for the review and merge; cheers :)

@lukego lukego merged commit b027b02 into snabbco:next Mar 6, 2016
dpino pushed a commit to dpino/snabb that referenced this pull request May 29, 2017
Update lwaftr-kristian with lwaftr branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants