-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Allow multiple named shared memory regions #4982
Conversation
982c712
to
410f545
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just small comments about output
src/storage/storage.cpp
Outdated
util::UnbufferedLog() << "ok."; | ||
} | ||
|
||
util::Log() << "Loading data into " << regionToString(next_region); | ||
util::Log() << "Loading data into " << shm_key; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shm_key
has 8 bits type and will be printed as a character Loading data into �
. static_cast<int>
or (int)
?
src/storage/storage.cpp
Outdated
} | ||
|
||
util::Log() << "All data loaded. Notify all client about new data in " | ||
<< regionToString(next_region) << " with timestamp " << next_timestamp; | ||
util::Log() << "All data loaded. Notify all client about new data in " << shm_key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
src/storage/storage.cpp
Outdated
{ | ||
util::UnbufferedLog() << "Marking old shared memory region " | ||
<< regionToString(in_use_region) << " for removal... "; | ||
util::UnbufferedLog() << "Marking old shared memory region " << in_use_key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
src/tools/store.cpp
Outdated
{ | ||
auto id = shared_register.Find(name); | ||
auto region = shared_register.GetRegion(id); | ||
osrm::util::Log() << name << "\t" << (int)region.shm_key << "\t" << region.timestamp; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it make sense to add "\tsize" column?
auto shm = osrm::storage::makeSharedMemory(region.shm_key);
osrm::util::Log() << name << "\t" << (int)region.shm_key << "\t" << region.timestamp << "\t" << shm->Size();
otherwise an extra ipcs -m
call is needed
include/storage/shared_datatype.hpp
Outdated
} | ||
} | ||
|
||
void Deregister(const RegionID key) { regions[key] = SharedRegion{}; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method is not used and DataWatchdogImpl
assumes that the shared region pointer won't be changed during an engine process life-time. Is a follow-up issue about deleting named regions needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I wanted to use this for the spring-clean command, but instead we just overwrite the whole registry.
@@ -28,12 +28,6 @@ OSRM::OSRM(engine::EngineConfig &config) | |||
throw util::exception("Required files are missing, cannot continue. Have all the " | |||
"pre-processing steps been run?"); | |||
} | |||
else if (config.use_shared_memory) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
It is also possible to add
|
764f6e3
to
13e44fe
Compare
@oxidase thanks for the test case! Changed all locations and added the test. Should be good to merge after Travis passes. |
13e44fe
to
2a210f4
Compare
Issue
This PR adds support for having multiple named shared memory regions.
This is going to unlock #1221 and #4873 by making it easier to have multiple named regions.
Tasklist
Requirements / Relations
Based on #4975.