Skip to content

Commit

Permalink
dead code removal and cleanup (#14803)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsteemann committed Sep 22, 2021
1 parent e6589a6 commit 817defd
Show file tree
Hide file tree
Showing 24 changed files with 113 additions and 258 deletions.
6 changes: 0 additions & 6 deletions arangod/GeneralServer/AuthenticationFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,6 @@ bool AuthenticationFeature::hasUserdefinedJwt() const {
return !_jwtSecretProgramOption.empty();
}

/// secret used for signing & verification of secrets
std::string AuthenticationFeature::jwtActiveSecret() const {
std::lock_guard<std::mutex> guard(_jwtSecretsLock);
return _jwtSecretProgramOption;
}

#ifdef USE_ENTERPRISE
/// verification only secrets
std::pair<std::string, std::vector<std::string>> AuthenticationFeature::jwtSecrets() const {
Expand Down
2 changes: 0 additions & 2 deletions arangod/GeneralServer/AuthenticationFeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ class AuthenticationFeature final : public application_features::ApplicationFeat
}

bool hasUserdefinedJwt() const;
/// secret used for signing & verification secrets
std::string jwtActiveSecret() const;
#ifdef USE_ENTERPRISE
/// verification only secrets
std::pair<std::string, std::vector<std::string>> jwtSecrets() const;
Expand Down
15 changes: 3 additions & 12 deletions arangod/Graph/BreadthFirstEnumerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "BreadthFirstEnumerator.h"

#include "Aql/PruneExpressionEvaluator.h"
#include "Containers/Helpers.h"
#include "Graph/EdgeCursor.h"
#include "Graph/EdgeDocumentToken.h"
#include "Graph/Traverser.h"
Expand Down Expand Up @@ -344,18 +345,8 @@ bool BreadthFirstEnumerator::shouldPrune() {
}

void BreadthFirstEnumerator::growStorage() {
size_t capacity;
if (_schreier.empty()) {
// minimal reserve size
capacity = 8;
} else {
capacity = _schreier.size() + 1;
if (capacity > _schreier.capacity()) {
capacity *= 2;
}
}

TRI_ASSERT(capacity > _schreier.size());
size_t capacity = arangodb::containers::Helpers::nextCapacity(_schreier, 8);

if (capacity > _schreier.capacity()) {
arangodb::ResourceUsageScope guard(_opts->resourceMonitor(),
(capacity - _schreier.capacity()) * pathStepSize());
Expand Down
16 changes: 2 additions & 14 deletions arangod/Graph/PathEnumerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "Aql/AqlValue.h"
#include "Aql/PruneExpressionEvaluator.h"
#include "Basics/ResourceUsage.h"
#include "Containers/Helpers.h"
#include "Graph/EdgeCursor.h"
#include "Graph/Traverser.h"
#include "Graph/TraverserCache.h"
Expand Down Expand Up @@ -53,20 +54,7 @@ EnumeratedPath::~EnumeratedPath() {

template <typename T>
void EnumeratedPath::growStorage(std::vector<T>& data) {
size_t capacity;

if (data.empty()) {
// reserve some initial space
capacity = 8;
} else {
capacity = data.size() + 1;
// allocate with power of 2 growth
if (capacity > data.capacity()) {
capacity *= 2;
}
}

TRI_ASSERT(capacity > data.size());
size_t capacity = arangodb::containers::Helpers::nextCapacity(data, 8);

if (capacity > data.capacity()) {
// reserve space
Expand Down
2 changes: 1 addition & 1 deletion arangod/RestServer/DatabaseFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ ErrorCode DatabaseFeature::dropDatabase(std::string const& name, bool removeApps
return true; // try next DataSource
};

vocbase->visitDataSources(visitor, true); // acquire a write lock to avoid potential deadlocks
vocbase->visitDataSources(visitor); // acquires a write lock to avoid potential deadlocks

if (TRI_ERROR_NO_ERROR != res) {
return res;
Expand Down
18 changes: 0 additions & 18 deletions arangod/RocksDBEngine/RocksDBKeyBounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ RocksDBKeyBounds RocksDBKeyBounds::CollectionDocuments(uint64_t collectionObject
return RocksDBKeyBounds(RocksDBEntryType::Document, collectionObjectId);
}

RocksDBKeyBounds RocksDBKeyBounds::CollectionDocumentRange(uint64_t collectionObjectId,
std::size_t min,
std::size_t max) {
return RocksDBKeyBounds(RocksDBEntryType::Document, collectionObjectId, min, max);
}

RocksDBKeyBounds RocksDBKeyBounds::PrimaryIndex(uint64_t indexId) {
return RocksDBKeyBounds(RocksDBEntryType::PrimaryIndexValue, indexId);
}
Expand Down Expand Up @@ -125,18 +119,6 @@ RocksDBKeyBounds RocksDBKeyBounds::DatabaseViews(TRI_voc_tick_t databaseId) {
return RocksDBKeyBounds(RocksDBEntryType::View, databaseId);
}

RocksDBKeyBounds RocksDBKeyBounds::CounterValues() {
return RocksDBKeyBounds(RocksDBEntryType::CounterValue);
}

RocksDBKeyBounds RocksDBKeyBounds::IndexEstimateValues() {
return RocksDBKeyBounds(RocksDBEntryType::IndexEstimateValue);
}

RocksDBKeyBounds RocksDBKeyBounds::KeyGenerators() {
return RocksDBKeyBounds(RocksDBEntryType::KeyGeneratorValue);
}

RocksDBKeyBounds RocksDBKeyBounds::FulltextIndexPrefix(uint64_t objectId,
arangodb::velocypack::StringRef const& word) {
// I did not want to pass a bool to the constructor for this
Expand Down
22 changes: 0 additions & 22 deletions arangod/RocksDBEngine/RocksDBKeyBounds.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,6 @@ class RocksDBKeyBounds {
//////////////////////////////////////////////////////////////////////////////
static RocksDBKeyBounds CollectionDocuments(uint64_t objectId);

//////////////////////////////////////////////////////////////////////////////
/// @brief Bounds for all documents belonging to a specified collection within
/// a certain range
//////////////////////////////////////////////////////////////////////////////
static RocksDBKeyBounds CollectionDocumentRange(uint64_t objectId,
std::size_t min, std::size_t max);

//////////////////////////////////////////////////////////////////////////////
/// @brief Bounds for all index-entries- belonging to a specified primary
/// index
Expand Down Expand Up @@ -147,26 +140,11 @@ class RocksDBKeyBounds {
//////////////////////////////////////////////////////////////////////////////
static RocksDBKeyBounds DatabaseViews(TRI_voc_tick_t databaseId);

//////////////////////////////////////////////////////////////////////////////
/// @brief Bounds for all counter values
//////////////////////////////////////////////////////////////////////////////
static RocksDBKeyBounds CounterValues();

//////////////////////////////////////////////////////////////////////////////
/// @brief Bounds for all entries in a log
//////////////////////////////////////////////////////////////////////////////
static RocksDBKeyBounds LogRange(uint64_t objectId);

//////////////////////////////////////////////////////////////////////////////
/// @brief Bounds for all index estimate values
//////////////////////////////////////////////////////////////////////////////
static RocksDBKeyBounds IndexEstimateValues();

//////////////////////////////////////////////////////////////////////////////
/// @brief Bounds for all key generators
//////////////////////////////////////////////////////////////////////////////
static RocksDBKeyBounds KeyGenerators();

//////////////////////////////////////////////////////////////////////////////
/// @brief Bounds for all entries of a fulltext index, matching prefixes
//////////////////////////////////////////////////////////////////////////////
Expand Down
17 changes: 0 additions & 17 deletions arangod/RocksDBEngine/RocksDBMetaCollection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,6 @@ RocksDBMetaCollection::RocksDBMetaCollection(LogicalCollection& collection,
_logicalCollection.id());
}

RocksDBMetaCollection::RocksDBMetaCollection(LogicalCollection& collection,
PhysicalCollection const* physical)
: PhysicalCollection(collection, VPackSlice::emptyObjectSlice()),
_objectId(static_cast<RocksDBMetaCollection const*>(physical)->_objectId.load()),
_revisionTreeApplied(0),
_revisionTreeCreationSeq(0),
_revisionTreeSerializedSeq(0),
_revisionTreeSerializedTime(std::chrono::steady_clock::now()) {
TRI_ASSERT(!ServerState::instance()->isCoordinator());
collection.vocbase()
.server()
.getFeature<EngineSelectorFeature>()
.engine<RocksDBEngine>()
.addCollectionMapping(_objectId.load(), _logicalCollection.vocbase().id(),
_logicalCollection.id());
}

std::string const& RocksDBMetaCollection::path() const {
return StaticStrings::Empty; // we do not have any path
}
Expand Down
2 changes: 0 additions & 2 deletions arangod/RocksDBEngine/RocksDBMetaCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ class RocksDBMetaCollection : public PhysicalCollection {
public:
explicit RocksDBMetaCollection(LogicalCollection& collection,
arangodb::velocypack::Slice const& info);
RocksDBMetaCollection(LogicalCollection& collection,
PhysicalCollection const*); // use in cluster only!!!!!
virtual ~RocksDBMetaCollection() = default;

std::string const& path() const override final;
Expand Down
19 changes: 0 additions & 19 deletions arangod/RocksDBEngine/RocksDBValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,6 @@ VPackSlice RocksDBValue::data(std::string const& s) {
return data(s.data(), s.size());
}

uint64_t RocksDBValue::keyValue(rocksdb::Slice const& slice) {
return keyValue(slice.data(), slice.size());
}

S2Point RocksDBValue::centroid(rocksdb::Slice const& s) {
TRI_ASSERT(s.size() == sizeof(double) * 3);
return S2Point(intToDouble(uint64FromPersistent(s.data())),
Expand Down Expand Up @@ -267,18 +263,3 @@ VPackSlice RocksDBValue::data(char const* data, size_t size) {
TRI_ASSERT(size >= sizeof(char));
return VPackSlice(reinterpret_cast<uint8_t const*>(data));
}

uint64_t RocksDBValue::keyValue(char const* data, size_t size) {
TRI_ASSERT(data != nullptr);
TRI_ASSERT(size >= sizeof(char));
VPackSlice key = transaction::helpers::extractKeyFromDocument(VPackSlice(reinterpret_cast<uint8_t const*>(data)));
if (key.isString()) {
VPackValueLength l;
char const* p = key.getStringUnchecked(l);
if (l > 0 && *p >= '0' && *p <= '9') {
return NumberUtils::atoi_zero<uint64_t>(p, p + l);
}
}

return 0;
}
6 changes: 0 additions & 6 deletions arangod/RocksDBEngine/RocksDBValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,6 @@ class RocksDBValue {
static VPackSlice data(rocksdb::Slice const&);
static VPackSlice data(std::string const&);

//////////////////////////////////////////////////////////////////////////////
/// @brief Extracts the numeric value from the key field of a VPackSlice
//////////////////////////////////////////////////////////////////////////////
static uint64_t keyValue(rocksdb::Slice const&);

//////////////////////////////////////////////////////////////////////////////
/// @brief Centroid of shape or point on the sphere surface in degrees
//////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -175,7 +170,6 @@ class RocksDBValue {
static LocalDocumentId documentId(char const* data, uint64_t size);
static arangodb::velocypack::StringRef vertexId(char const* data, size_t size);
static VPackSlice data(char const* data, size_t size);
static uint64_t keyValue(char const* data, size_t size);

private:
RocksDBEntryType _type;
Expand Down
35 changes: 4 additions & 31 deletions arangod/VocBase/LogicalCollection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,12 +496,6 @@ bool LogicalCollection::usesRevisionsAsDocumentIds() const {
return _usesRevisionsAsDocumentIds.load();
}

void LogicalCollection::setUsesRevisionsAsDocumentIds(bool usesRevisions) {
if (!_usesRevisionsAsDocumentIds.load() && usesRevisions && _version >= Version::v37) {
_usesRevisionsAsDocumentIds.store(true);
}
}

std::unique_ptr<FollowerInfo> const& LogicalCollection::followers() const {
return _followers;
}
Expand All @@ -510,12 +504,6 @@ bool LogicalCollection::syncByRevision() const {
return _syncByRevision.load();
}

void LogicalCollection::setSyncByRevision(bool usesRevisions) {
if (!_syncByRevision.load() && _usesRevisionsAsDocumentIds.load() && usesRevisions) {
_syncByRevision.store(true);
}
}

bool LogicalCollection::useSyncByRevision() const {
return !_isAStub && _syncByRevision.load();
}
Expand Down Expand Up @@ -580,17 +568,12 @@ Result LogicalCollection::rename(std::string&& newName) {
auto& databaseFeature = vocbase().server().getFeature<DatabaseFeature>();

// Check for illegal states.
switch (_status) {
case TRI_VOC_COL_STATUS_CORRUPTED:
if (_status != TRI_VOC_COL_STATUS_LOADED) {
if (_status == TRI_VOC_COL_STATUS_CORRUPTED) {
return TRI_ERROR_ARANGO_CORRUPTED_COLLECTION;
case TRI_VOC_COL_STATUS_DELETED:
} else if (_status == TRI_VOC_COL_STATUS_DELETED) {
return TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND;
default:
// Fall through intentional
break;
}

if (_status != TRI_VOC_COL_STATUS_LOADED) {
}
// Unknown status
return TRI_ERROR_INTERNAL;
}
Expand Down Expand Up @@ -1177,14 +1160,6 @@ bool LogicalCollection::skipForAqlWrite(arangodb::velocypack::Slice document,
}
#endif

// SECTION: Key Options
VPackSlice LogicalCollection::keyOptions() const {
if (_keyOptions == nullptr) {
return arangodb::velocypack::Slice::nullSlice();
}
return VPackSlice(_keyOptions->data());
}

void LogicalCollection::schemaToVelocyPack(VPackBuilder& b) const {
auto schema = std::atomic_load_explicit(&_schema, std::memory_order_relaxed);
if (schema != nullptr) {
Expand Down Expand Up @@ -1252,8 +1227,6 @@ void LogicalCollection::decorateWithInternalValidators() {
decorateWithInternalEEValidators();
}

bool LogicalCollection::isShard() const noexcept { return planId() != id(); }

bool LogicalCollection::isLocalSmartEdgeCollection() const noexcept {
return (_internalValidatorTypes & InternalValidatorType::LocalSmartEdge) != 0;
}
Expand Down
7 changes: 0 additions & 7 deletions arangod/VocBase/LogicalCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ class LogicalCollection : public LogicalDataSource {
bool isSmartChild() const { return false; }
#endif
bool usesRevisionsAsDocumentIds() const;
void setUsesRevisionsAsDocumentIds(bool);
/// @brief is this a cluster-wide Plan (ClusterInfo) collection
bool isAStub() const { return _isAStub; }

Expand Down Expand Up @@ -317,8 +316,6 @@ class LogicalCollection : public LogicalDataSource {
/// it at that moment.
void deferDropCollection(std::function<bool(LogicalCollection&)> const& callback);

// SECTION: Key Options
velocypack::Slice keyOptions() const;
void schemaToVelocyPack(VPackBuilder&) const;
Result validate(VPackSlice newDoc, VPackOptions const*) const; // insert
Result validate(VPackSlice modifiedDoc, VPackSlice oldDoc, VPackOptions const*) const; // update / replace
Expand All @@ -333,8 +330,6 @@ class LogicalCollection : public LogicalDataSource {

/// @brief returns the value of _syncByRevision
bool syncByRevision() const;
/// @brief sets the value of _syncByRevision
void setSyncByRevision(bool);

/// @brief returns the value of _syncByRevision, but only for "real" collections with data backing.
/// returns false for all collections with no data backing.
Expand All @@ -348,8 +343,6 @@ class LogicalCollection : public LogicalDataSource {

uint64_t getInternalValidatorTypes() const;

bool isShard() const noexcept;

bool isLocalSmartEdgeCollection() const noexcept;

bool isRemoteSmartEdgeCollection() const noexcept;
Expand Down
6 changes: 0 additions & 6 deletions arangod/VocBase/ManagedDocumentResult.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
////////////////////////////////////////////////////////////////////////////////

#include "ManagedDocumentResult.h"
#include "Aql/AqlValue.h"
#include "Transaction/Helpers.h"

#include <velocypack/Builder.h>
Expand All @@ -37,11 +36,6 @@ void ManagedDocumentResult::setManaged(uint8_t const* vpack) {
_revisionId = transaction::helpers::extractRevFromDocument(slice);
}

void ManagedDocumentResult::setRevisionId() noexcept {
TRI_ASSERT(!this->empty());
_revisionId = transaction::helpers::extractRevFromDocument(VPackSlice(this->vpack()));
}

void ManagedDocumentResult::addToBuilder(velocypack::Builder& builder) const {
TRI_ASSERT(!empty());
TRI_ASSERT(!_string.empty());
Expand Down
1 change: 0 additions & 1 deletion arangod/VocBase/ManagedDocumentResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class ManagedDocumentResult {

inline RevisionId revisionId() const noexcept { return _revisionId; }
void setRevisionId(RevisionId rid) noexcept { _revisionId = rid; }
void setRevisionId() noexcept;

void clearData() noexcept {
_string.clear();
Expand Down
Loading

0 comments on commit 817defd

Please sign in to comment.