Skip to content

Commit 77d5762

Browse files
authored
Revert "Revert NamedMutex removal (#1174)" (#1179)
This reverts commit d9198f3. All changes related to CallApi has to be reworked Relates-To: OLPEDGE-2417 Signed-off-by: Iuliia Moroz <[email protected]>
1 parent 4d9ca2c commit 77d5762

File tree

2 files changed

+0
-47
lines changed

2 files changed

+0
-47
lines changed

olp-cpp-sdk-dataservice-read/src/repositories/DataRepository.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include <olp/core/logging/Log.h>
2929
#include "CatalogRepository.h"
3030
#include "DataCacheRepository.h"
31-
#include "NamedMutex.h"
3231
#include "PartitionsCacheRepository.h"
3332
#include "PartitionsRepository.h"
3433
#include "generated/api/BlobApi.h"
@@ -135,14 +134,6 @@ BlobApi::DataResponse DataRepository::GetBlobData(
135134
repository::DataCacheRepository repository(
136135
catalog_, settings_.cache, settings_.default_cache_expiration);
137136

138-
NamedMutex mutex(catalog_.ToString() + layer + *data_handle);
139-
std::unique_lock<NamedMutex> lock(mutex, std::defer_lock);
140-
141-
// If we are not planning to go online or access the cache, do not lock.
142-
if (fetch_option != CacheOnly && fetch_option != OnlineOnly) {
143-
lock.lock();
144-
}
145-
146137
if (fetch_option != OnlineOnly && fetch_option != CacheWithUpdate) {
147138
auto cached_data = repository.Get(layer, data_handle.value());
148139
if (cached_data) {

olp-cpp-sdk-dataservice-read/src/repositories/PartitionsRepository.cpp

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include <olp/core/client/Condition.h>
2828
#include <olp/core/logging/Log.h>
2929
#include "CatalogRepository.h"
30-
#include "NamedMutex.h"
3130
#include "generated/api/MetadataApi.h"
3231
#include "generated/api/QueryApi.h"
3332
#include "olp/dataservice/read/CatalogRequest.h"
@@ -93,15 +92,6 @@ repository::PartitionResponse FindPartition(
9392

9493
return std::move(aggregated_partition);
9594
}
96-
97-
std::string HashPartitions(
98-
const read::PartitionsRequest::PartitionIds& partitions) {
99-
size_t seed = 0;
100-
for (const auto& partition : partitions) {
101-
boost::hash_combine(seed, partition);
102-
}
103-
return std::to_string(seed);
104-
}
10595
} // namespace
10696

10797
namespace olp {
@@ -167,18 +157,6 @@ PartitionsRepository::GetPartitionsExtendedResponse(
167157

168158
const auto& partition_ids = request.GetPartitionIds();
169159

170-
// Temporary workaround for merging the same requests. Should be removed after
171-
// OlpClient could handle that.
172-
const auto detail =
173-
partition_ids.empty() ? "" : HashPartitions(partition_ids);
174-
NamedMutex mutex(catalog_str + layer_id_ + detail);
175-
std::unique_lock<NamedMutex> lock(mutex, std::defer_lock);
176-
177-
// If we are not planning to go online or access the cache, do not lock.
178-
if (fetch_option != CacheOnly && fetch_option != OnlineOnly) {
179-
lock.lock();
180-
}
181-
182160
if (fetch_option != OnlineOnly && fetch_option != CacheWithUpdate) {
183161
auto cached_partitions = cache_.Get(request, version);
184162
if (cached_partitions) {
@@ -265,14 +243,6 @@ PartitionsResponse PartitionsRepository::GetPartitionById(
265243
const auto request_key =
266244
catalog_.ToString() + request.CreateKey(layer_id_, version);
267245

268-
NamedMutex mutex(request_key);
269-
std::unique_lock<repository::NamedMutex> lock(mutex, std::defer_lock);
270-
271-
// If we are not planning to go online or access the cache, do not lock.
272-
if (fetch_option != CacheOnly && fetch_option != OnlineOnly) {
273-
lock.lock();
274-
}
275-
276246
std::chrono::seconds timeout{settings_.retry_settings.timeout};
277247
const auto key = request.CreateKey(layer_id_, version);
278248

@@ -348,14 +318,6 @@ QuadTreeIndexResponse PartitionsRepository::GetQuadTreeIndexForTile(
348318
const auto& root_tile_key = tile_key.ChangedLevelBy(-kAggregateQuadTreeDepth);
349319
const auto root_tile_here = root_tile_key.ToHereTile();
350320

351-
NamedMutex mutex(catalog_.ToString() + layer_id_ + root_tile_here + "Index");
352-
std::unique_lock<NamedMutex> lock(mutex, std::defer_lock);
353-
354-
// If we are not planning to go online or access the cache, do not lock.
355-
if (fetch_option != CacheOnly && fetch_option != OnlineOnly) {
356-
lock.lock();
357-
}
358-
359321
// Look for QuadTree covering the tile in the cache
360322
if (fetch_option != OnlineOnly && fetch_option != CacheWithUpdate) {
361323
read::QuadTreeIndex cached_tree;

0 commit comments

Comments
 (0)