Compare commits

...

9 Commits

Author SHA1 Message Date
Daniel Patterson
4acce593db
Rebased on 5.18 to avoid bugs introduced in #5060 2018-08-29 22:15:46 -07:00
Daniel Patterson
1756208f3f
Increase ringbuffer size further - allow for many more listeners on shared memory regions. 2018-08-29 22:14:57 -07:00
Daniel Patterson
99d78713a2
Fix formatting. 2018-08-29 22:14:57 -07:00
Daniel Patterson
38ba8b90fc
Set package.json to match tag for publishing. 2018-08-29 22:14:57 -07:00
Daniel Patterson
32402263f8
Set package.json to match tag for publishing. 2018-08-29 22:14:56 -07:00
Daniel Patterson
4fbe68f4d7
Increase allowed shared memory regions to 512 from 256. 2018-08-29 22:14:36 -07:00
Michael Krasnyk
991cdf7958 Don't collapse segregated intersections at roundabout exits, #5114 2018-06-21 13:25:34 +00:00
Patrick Niklaus
fdbcefe358 Final OSRM release 2018-05-10 12:37:26 +00:00
Patrick Niklaus
853691aee2 Bump version 2018-05-08 15:56:18 +00:00
9 changed files with 35 additions and 27 deletions

View File

@ -13,6 +13,7 @@ notifications:
branches: branches:
only: only:
- master - master
- "5.18"
# enable building tags # enable building tags
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/ - /^v\d+\.\d+(\.\d+)?(-\S*)?$/

View File

@ -1,4 +1,9 @@
# UNRELEASED # 5.18.1
- Changes from 5.18.0:
- Bugfixes:
- FIXED: collapsing of ExitRoundabout instructions [#5114](https://github.com/Project-OSRM/osrm-backend/issues/5114)
# 5.18.0
- Changes from 5.17.0: - Changes from 5.17.0:
- Features: - Features:
- ADDED: `table` plugin now optionally returns `distance` matrix as part of response [#4990](https://github.com/Project-OSRM/osrm-backend/pull/4990) - ADDED: `table` plugin now optionally returns `distance` matrix as part of response [#4990](https://github.com/Project-OSRM/osrm-backend/pull/4990)

View File

@ -26,7 +26,7 @@ namespace serialization
inline void read(io::BufferReader &reader, DataLayout &layout); inline void read(io::BufferReader &reader, DataLayout &layout);
inline void write(io::BufferWriter &writer, const DataLayout &layout); inline void write(io::BufferWriter &writer, const DataLayout &layout);
} } // namespace serialization
namespace detail namespace detail
{ {
@ -52,7 +52,7 @@ inline std::string trimName(const std::string &name_prefix, const std::string &n
return name; return name;
} }
} }
} } // namespace detail
class DataLayout class DataLayout
{ {
@ -165,7 +165,7 @@ struct SharedRegion
static constexpr const int MAX_NAME_LENGTH = 254; static constexpr const int MAX_NAME_LENGTH = 254;
SharedRegion() : name{0}, timestamp{0} {} SharedRegion() : name{0}, timestamp{0} {}
SharedRegion(const std::string &name_, std::uint64_t timestamp, std::uint8_t shm_key) SharedRegion(const std::string &name_, std::uint64_t timestamp, std::uint16_t shm_key)
: name{0}, timestamp{timestamp}, shm_key{shm_key} : name{0}, timestamp{timestamp}, shm_key{shm_key}
{ {
std::copy_n(name_.begin(), std::min<std::size_t>(MAX_NAME_LENGTH, name_.size()), name); std::copy_n(name_.begin(), std::min<std::size_t>(MAX_NAME_LENGTH, name_.size()), name);
@ -175,14 +175,14 @@ struct SharedRegion
char name[MAX_NAME_LENGTH + 1]; char name[MAX_NAME_LENGTH + 1];
std::uint64_t timestamp; std::uint64_t timestamp;
std::uint8_t shm_key; std::uint16_t shm_key;
}; };
// Keeps a list of all shared regions in a fixed-sized struct // Keeps a list of all shared regions in a fixed-sized struct
// for fast access and deserialization. // for fast access and deserialization.
struct SharedRegionRegister struct SharedRegionRegister
{ {
using RegionID = std::uint8_t; using RegionID = std::uint16_t;
static constexpr const RegionID INVALID_REGION_ID = std::numeric_limits<RegionID>::max(); static constexpr const RegionID INVALID_REGION_ID = std::numeric_limits<RegionID>::max();
using ShmKey = decltype(SharedRegion::shm_key); using ShmKey = decltype(SharedRegion::shm_key);
@ -250,12 +250,11 @@ struct SharedRegionRegister
void ReleaseKey(ShmKey key) { shm_key_in_use[key] = false; } void ReleaseKey(ShmKey key) { shm_key_in_use[key] = false; }
static constexpr const std::uint8_t MAX_SHARED_REGIONS = static constexpr const std::size_t MAX_SHARED_REGIONS = 512;
std::numeric_limits<RegionID>::max() - 1;
static_assert(MAX_SHARED_REGIONS < std::numeric_limits<RegionID>::max(), static_assert(MAX_SHARED_REGIONS < std::numeric_limits<RegionID>::max(),
"Number of shared memory regions needs to be less than the region id size."); "Number of shared memory regions needs to be less than the region id size.");
static constexpr const std::uint8_t MAX_SHM_KEYS = std::numeric_limits<std::uint8_t>::max() - 1; static constexpr const std::size_t MAX_SHM_KEYS = MAX_SHARED_REGIONS * 2;
static constexpr const char *name = "osrm-region"; static constexpr const char *name = "osrm-region";
@ -263,7 +262,7 @@ struct SharedRegionRegister
std::array<SharedRegion, MAX_SHARED_REGIONS> regions; std::array<SharedRegion, MAX_SHARED_REGIONS> regions;
std::array<bool, MAX_SHM_KEYS> shm_key_in_use; std::array<bool, MAX_SHM_KEYS> shm_key_in_use;
}; };
} } // namespace storage
} } // namespace osrm
#endif /* SHARED_DATA_TYPE_HPP */ #endif /* SHARED_DATA_TYPE_HPP */

View File

@ -34,10 +34,10 @@ namespace storage
struct OSRMLockFile struct OSRMLockFile
{ {
boost::filesystem::path operator()() template <typename IdentifierT> boost::filesystem::path operator()(const IdentifierT &id)
{ {
boost::filesystem::path temp_dir = boost::filesystem::temp_directory_path(); boost::filesystem::path temp_dir = boost::filesystem::temp_directory_path();
boost::filesystem::path lock_file = temp_dir / "osrm.lock"; boost::filesystem::path lock_file = temp_dir / ("osrm-" + std::to_string(id) + ".lock");
return lock_file; return lock_file;
} }
}; };
@ -93,7 +93,7 @@ class SharedMemory
try try
{ {
OSRMLockFile lock_file; OSRMLockFile lock_file;
boost::interprocess::xsi_key key(lock_file().string().c_str(), id); boost::interprocess::xsi_key key(lock_file(id).string().c_str(), id);
result = RegionExists(key); result = RegionExists(key);
} }
catch (...) catch (...)
@ -106,7 +106,7 @@ class SharedMemory
template <typename IdentifierT> static bool Remove(const IdentifierT id) template <typename IdentifierT> static bool Remove(const IdentifierT id)
{ {
OSRMLockFile lock_file; OSRMLockFile lock_file;
boost::interprocess::xsi_key key(lock_file().string().c_str(), id); boost::interprocess::xsi_key key(lock_file(id).string().c_str(), id);
return Remove(key); return Remove(key);
} }
@ -287,10 +287,11 @@ class SharedMemory
template <typename IdentifierT, typename LockFileT = OSRMLockFile> template <typename IdentifierT, typename LockFileT = OSRMLockFile>
std::unique_ptr<SharedMemory> makeSharedMemory(const IdentifierT &id, const uint64_t size = 0) std::unique_ptr<SharedMemory> makeSharedMemory(const IdentifierT &id, const uint64_t size = 0)
{ {
static_assert(sizeof(id) == sizeof(std::uint16_t), "Key type is not 16 bits");
try try
{ {
LockFileT lock_file; LockFileT lock_file;
if (!boost::filesystem::exists(lock_file())) if (!boost::filesystem::exists(lock_file(id)))
{ {
if (0 == size) if (0 == size)
{ {
@ -298,10 +299,10 @@ std::unique_ptr<SharedMemory> makeSharedMemory(const IdentifierT &id, const uint
} }
else else
{ {
boost::filesystem::ofstream ofs(lock_file()); boost::filesystem::ofstream ofs(lock_file(id));
} }
} }
return std::make_unique<SharedMemory>(lock_file(), id, size); return std::make_unique<SharedMemory>(lock_file(id), id, size);
} }
catch (const boost::interprocess::interprocess_exception &e) catch (const boost::interprocess::interprocess_exception &e)
{ {
@ -310,7 +311,7 @@ std::unique_ptr<SharedMemory> makeSharedMemory(const IdentifierT &id, const uint
throw util::exception(e.what() + SOURCE_REF); throw util::exception(e.what() + SOURCE_REF);
} }
} }
} } // namespace storage
} } // namespace osrm
#endif // SHARED_MEMORY_HPP #endif // SHARED_MEMORY_HPP

View File

@ -33,7 +33,7 @@ template <class Lock> class InvertedLock
InvertedLock(Lock &lock) : lock(lock) { lock.unlock(); } InvertedLock(Lock &lock) : lock(lock) { lock.unlock(); }
~InvertedLock() { lock.lock(); } ~InvertedLock() { lock.lock(); }
}; };
} } // namespace
// The shared monitor implementation based on a semaphore and mutex // The shared monitor implementation based on a semaphore and mutex
template <typename Data> struct SharedMonitor template <typename Data> struct SharedMonitor
@ -146,7 +146,7 @@ template <typename Data> struct SharedMonitor
// like two-turnstile reusable barrier or boost/interprocess/sync/spin/condition.hpp // like two-turnstile reusable barrier or boost/interprocess/sync/spin/condition.hpp
// fail if a waiter is killed. // fail if a waiter is killed.
static constexpr int buffer_size = 256; static constexpr int buffer_size = 4096 * 4;
struct InternalData struct InternalData
{ {
@ -232,8 +232,8 @@ template <typename Data> struct SharedMonitor
bi::shared_memory_object shmem; bi::shared_memory_object shmem;
bi::mapped_region region; bi::mapped_region region;
}; };
} } // namespace storage
} } // namespace osrm
#undef USE_BOOST_INTERPROCESS_CONDITION #undef USE_BOOST_INTERPROCESS_CONDITION

View File

@ -1,6 +1,6 @@
{ {
"name": "osrm", "name": "osrm",
"version": "5.18.0-latest.1", "version": "5.18.0-moarshm.4",
"private": false, "private": false,
"description": "The Open Source Routing Machine is a high performance routing engine written in C++14 designed to run on OpenStreetMap data.", "description": "The Open Source Routing Machine is a high performance routing engine written in C++14 designed to run on OpenStreetMap data.",
"dependencies": { "dependencies": {

View File

@ -621,6 +621,7 @@ RouteSteps collapseSegregatedTurnInstructions(RouteSteps steps)
// else if the current step is segregated and the next step is not segregated // else if the current step is segregated and the next step is not segregated
// and the next step is not a roundabout then combine with turn adjustment // and the next step is not a roundabout then combine with turn adjustment
else if (curr_step->is_segregated && !next_step->is_segregated && else if (curr_step->is_segregated && !next_step->is_segregated &&
!hasRoundaboutType(curr_step->maneuver.instruction) &&
!hasRoundaboutType(next_step->maneuver.instruction)) !hasRoundaboutType(next_step->maneuver.instruction))
{ {
// Determine if u-turn // Determine if u-turn

View File

@ -66,7 +66,7 @@ struct RegionHandle
{ {
std::unique_ptr<SharedMemory> memory; std::unique_ptr<SharedMemory> memory;
char *data_ptr; char *data_ptr;
std::uint8_t shm_key; std::uint16_t shm_key;
}; };
auto setupRegion(SharedRegionRegister &shared_register, const DataLayout &layout) auto setupRegion(SharedRegionRegister &shared_register, const DataLayout &layout)

View File

@ -82,7 +82,8 @@ void springClean()
} }
else else
{ {
for (auto key : util::irange<std::uint8_t>(0, storage::SharedRegionRegister::MAX_SHM_KEYS)) for (auto key : util::irange<storage::SharedRegionRegister::RegionID>(
0, storage::SharedRegionRegister::MAX_SHM_KEYS))
{ {
deleteRegion(key); deleteRegion(key);
} }