Skip to content

Commit

Permalink
maint: Remove dependency on some elements of folly (#1370)
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Jerphanion <[email protected]>
Co-authored-by: Georgi Petrov <[email protected]>
  • Loading branch information
jjerphan and G-D-Petrov authored Mar 11, 2024
1 parent 82788b8 commit 4184a46
Show file tree
Hide file tree
Showing 13 changed files with 10 additions and 29 deletions.
3 changes: 1 addition & 2 deletions cpp/arcticdb/entity/performance_tracing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <arcticdb/entity/performance_tracing.hpp>
#include <arcticdb/log/log.hpp>
#include <folly/system/ThreadName.h>
#include <folly/container/F14Map.h>
#include <arcticdb/util/preprocess.hpp>
#include <arcticdb/util/pb_util.hpp>

Expand Down Expand Up @@ -61,7 +60,7 @@ RemoteryInstance::~RemoteryInstance() {

namespace arcticdb::detail {
struct ThreadNameCache {
folly::F14FastMap<const char *, std::string> fqn_by_task_name_;
std::unordered_map<const char *, std::string> fqn_by_task_name_;
std::string thread_name_;

ThreadNameCache():fqn_by_task_name_(),thread_name_(folly::getCurrentThreadName().value_or("Thread")){}
Expand Down
6 changes: 0 additions & 6 deletions cpp/arcticdb/pipeline/index_segment_reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <arcticdb/entity/protobufs.hpp>
#include <arcticdb/pipeline/frame_slice.hpp>
#include <arcticdb/pipeline/index_fields.hpp>
#include <folly/container/F14Map.h>

#include <boost/noncopyable.hpp>

Expand Down Expand Up @@ -82,12 +81,7 @@ struct IndexSegmentReader {
}

private:
#ifndef _WIN32
mutable folly::F14FastMap<ColRange, std::shared_ptr<StreamDescriptor>, AxisRange::Hasher> descriptor_by_col_group_;
#else
//TODO: Fix this for windows - folly complains regarding private inheritance
mutable std::unordered_map<ColRange, std::shared_ptr<StreamDescriptor>, AxisRange::Hasher> descriptor_by_col_group_;
#endif
SegmentInMemory seg_;
TimeseriesDescriptor tsd_;
};
Expand Down
11 changes: 5 additions & 6 deletions cpp/arcticdb/pipeline/read_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <arcticdb/codec/variant_encoded_field_collection.hpp>
#include <arcticdb/util/magic_num.hpp>
#include <google/protobuf/util/message_differencer.h>
#include <folly/SpinLock.h>
#include <folly/gen/Base.h>
#include <folly/concurrency/ConcurrentHashMap.h>

Expand Down Expand Up @@ -642,7 +641,7 @@ class StringReducer {
virtual void reduce(PipelineContextRow& context_row, size_t column_index) = 0;
};

using LockType = folly::SpinLock;
using LockType = std::mutex;

class EmptyDynamicStringReducer {
protected:
Expand Down Expand Up @@ -884,7 +883,7 @@ class DynamicStringReducer : public StringReducer {
auto none = std::make_unique<py::none>(py::none{});
LockPolicy::unlock(*lock_);
size_t none_count = 0u;
ankerl::unordered_dense::map<entity::position_t, std::pair<PyObject*, folly::SpinLock>> local_map;
ankerl::unordered_dense::map<entity::position_t, std::pair<PyObject*, std::unique_ptr<std::mutex>>> local_map;
local_map.reserve(end - row_);
// TODO this is no good for non-contigous blocks, but we currently expect
// output data to be contiguous
Expand All @@ -901,16 +900,16 @@ class DynamicStringReducer : public StringReducer {
if(it != local_map.end()) {
auto& object_and_lock = it->second;
*ptr_dest_ = object_and_lock.first;
LockPolicy::lock(object_and_lock.second);
LockPolicy::lock(*object_and_lock.second);
Py_INCREF(*ptr_dest_);
LockPolicy::unlock(object_and_lock.second);
LockPolicy::unlock(*object_and_lock.second);
} else {
const auto sv = get_string_from_pool(offset, string_pool);
LockPolicy::lock(*lock_);
*ptr_dest_ = StringCreator::create(sv, has_type_conversion);
LockPolicy::unlock(*lock_);
PyObject* dest = *ptr_dest_;
local_map.insert(std::make_pair(std::move(offset), std::make_pair(std::move(dest), folly::SpinLock{})));
local_map.insert(std::make_pair(std::move(offset), std::make_pair(std::move(dest), std::make_unique<std::mutex>())));
}
}
}
Expand Down
1 change: 0 additions & 1 deletion cpp/arcticdb/pipeline/read_pipeline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <variant>

#include <folly/futures/Future.h>
#include <folly/container/F14Set.h>
#include <boost/noncopyable.hpp>

#include <arcticdb/entity/types.hpp>
Expand Down
3 changes: 1 addition & 2 deletions cpp/arcticdb/pipeline/value_set.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <variant>
#include <vector>

#include <folly/container/F14Map.h>
#include <pybind11/numpy.h>

#include <arcticdb/entity/types.hpp>
Expand Down Expand Up @@ -98,7 +97,7 @@ class ValueSet {
};

std::shared_ptr<std::unordered_set<std::string>> typed_set_string_;
folly::F14FastMap<size_t, std::shared_ptr<std::unordered_set<std::string>>> typed_set_fixed_width_strings_;
std::unordered_map<size_t, std::shared_ptr<std::unordered_set<std::string>>> typed_set_fixed_width_strings_;

typed_set<uint8_t> typed_set_uint8_t_;
typed_set<uint16_t> typed_set_uint16_t_;
Expand Down
1 change: 0 additions & 1 deletion cpp/arcticdb/processing/test/test_component_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* As of the Change Date specified in that file, in accordance with the Business Source License, use of this software will be governed by the Apache License, version 2.0.
*/

#include <folly/executors/ThreadedExecutor.h>
#include <gtest/gtest.h>

#include <arcticdb/processing/component_manager.hpp>
Expand Down
6 changes: 2 additions & 4 deletions cpp/arcticdb/storage/library_path.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <arcticdb/util/hash.hpp>
#include <arcticdb/util/name_validation.hpp>

#include <folly/small_vector.h>
#include <boost/container/small_vector.hpp>
#include <folly/Range.h>
#include <fmt/format.h>
#include <memory>
Expand Down Expand Up @@ -44,8 +44,6 @@ class DefaultStringViewable : public std::shared_ptr<std::string> {
return hash_;
}

DefaultStringViewable operator=(const DefaultStringViewable&) = delete;

private:
HashedValue hash_;
};
Expand Down Expand Up @@ -152,7 +150,7 @@ class LibraryPathImpl {
return accum.digest();
}

folly::small_vector<StringViewable, NUM_LIBRARY_PARTS> parts_;
boost::container::small_vector<StringViewable, NUM_LIBRARY_PARTS> parts_;
HashedValue hash_;
};

Expand Down
2 changes: 0 additions & 2 deletions cpp/arcticdb/stream/aggregator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
#include <arcticdb/column_store/memory_segment.hpp>
#include <arcticdb/util/constants.hpp>

#include <folly/ScopeGuard.h>

#include <memory>

namespace arcticdb::stream {
Expand Down
1 change: 0 additions & 1 deletion cpp/arcticdb/stream/row_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

#include <folly/Range.h>
#include <folly/Function.h>
#include <folly/ScopeGuard.h>

#include <typeinfo>

Expand Down
1 change: 0 additions & 1 deletion cpp/arcticdb/stream/stream_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <folly/Function.h>
#include <folly/Range.h>
#include <folly/futures/Future.h>
#include <folly/Likely.h>
#include <boost/circular_buffer.hpp>

#include <optional>
Expand Down
1 change: 0 additions & 1 deletion cpp/arcticdb/stream/test/test_aggregator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <arcticdb/stream/row_builder.hpp>
#include <arcticdb/stream/aggregator.hpp>

#include <folly/ScopeGuard.h>
#include <gtest/gtest.h>

#include <memory>
Expand Down
1 change: 0 additions & 1 deletion cpp/arcticdb/stream/test/test_row_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

#include <gtest/gtest.h>
#include <folly/ScopeGuard.h>

#include <arcticdb/stream/row_builder.hpp>
#include <arcticdb/stream/aggregator.hpp>
Expand Down
2 changes: 1 addition & 1 deletion cpp/arcticdb/version/version_map_batch_methods.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ inline std::shared_ptr<std::unordered_map<std::pair<StreamId, VersionId>, AtomKe
struct StreamVersionData {
size_t count_ = 0;
LoadParameter load_param_ = LoadParameter{LoadType::NOT_LOADED};
folly::small_vector<SnapshotId, 1> snapshots_;
boost::container::small_vector<SnapshotId, 1> snapshots_;

explicit StreamVersionData(const pipelines::VersionQuery& version_query);
StreamVersionData() = default;
Expand Down

0 comments on commit 4184a46

Please sign in to comment.