8000 remove unused code from repository (#15089) · open-bigdata/arangodb@e795bff · GitHub
[go: up one dir, main page]

Skip to content

Commit e795bff

Browse files
authored
remove unused code from repository (arangodb#15089)
* remove unused code from repository * remove some agency methods * micro cleanup * don't include ssl-helper.h when not necessary * remove unused crc32 implementation
1 parent 3582c43 commit e795bff

27 files changed

+16
-936
lines changed

arangod/Agency/Agent.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,6 @@ bool Agent::start() {
189189
return true;
190190
}
191191

192-
/// Get all logs from state machine
193-
query_t Agent::allLogs() const { return _state.allLogs(); }
194-
195192
/// This agent's term
196193
term_t Agent::term() const { return _constituent.term(); }
197194

@@ -990,12 +987,6 @@ std::tuple<futures::Future<query_t>, bool, std::string> Agent::poll(
990987
}
991988
}
992989

993-
// Check if I am member of active agency
994-
bool Agent::active() const {
995-
std::vector<std::string> active = _config.active();
996-
return (find(active.begin(), active.end(), id()) != active.end());
997-
}
998-
999990
/// @brief Activate agency (Inception thread for multi-host, main thread else)
1000991
void Agent::activateAgency() {
1001992
_config.activate();
@@ -1980,13 +1971,16 @@ void Agent::executeLockedRead(std::function<void()> const& cb) {
19801971
cb();
19811972
}
19821973

1974+
#if 0
1975+
// currently not called from anywhere
19831976
void Agent::executeLockedWrite(std::function<void()> const& cb) {
19841977
_tiLock.assertNotLockedByCurrentThread();
19851978
MUTEX_LOCKER(ioLocker, _ioLock);
19861979
WRITE_LOCKER(oLocker, _outputLock);
19871980
CONDITION_LOCKER(guard, _waitForCV);
19881981
cb();
19891982
}
1983+
#endif
19901984

19911985
void Agent::executeTransientLocked(std::function<void()> const& cb) {
19921986
MUTEX_LOCKER(transientLocker, _transientLock);

arangod/Agency/Agent.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,10 @@ class Agent final : public arangodb::Thread, public AgentInterface {
248248

249249
/// @brief execute a callback while holding _ioLock
250250
/// and write lock for _readDB
251+
#if 0
252+
// currently not called from anywhere
251253
void executeLockedWrite(std::function<void()> const& cb);
254+
#endif
252255

253256
/// @brief execute a callback while holding _transientLock
254257
void executeTransientLocked(std::function<void()> const& cb);
@@ -281,18 +284,12 @@ class Agent final : public arangodb::Thread, public AgentInterface {
281284
/// @brief Get notification as inactive pool member
282285
void notify(query_t const&);
283286

284-
/// @brief All there is in the state machine
285-
query_t allLogs() const;
286-
287287
/// @brief Get copy of log entries starting with begin ending on end
288288
std::vector<log_t> logs(index_t begin = 0, index_t end = (std::numeric_limits<uint64_t>::max)()) const;
289289

290290
/// @brief Last contact with followers
291291
void lastAckedAgo(Builder&) const;
292292

293-
/// @brief Am I active agent
294-
bool active() const;
295-
296293
/// @brief Are we ready for RAFT?
297294
bool ready() const;
298295

arangod/Aql/AqlItemBlock.cpp

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -652,40 +652,6 @@ SharedAqlItemBlockPtr AqlItemBlock::slice(std::vector<size_t> const& chosen,
652652
return res;
653653
}
654654

655-
/// @brief steal for a subset, this does not copy the entries, rather,
656-
/// it remembers which it has taken. This is stored in the
657-
/// this by removing the value counts in _valueCount.
658-
/// It is highly recommended to delete this object right after this
659-
/// operation, because it is unclear, when the values to which our
660-
/// AqlValues point will vanish! In particular, do not use setValue
661-
/// any more.
662-
SharedAqlItemBlockPtr AqlItemBlock::steal(std::vector<size_t> const& chosen,
663-
size_t from, size_t to) {
664-
TRI_ASSERT(from < to && to <= chosen.size());
665-
666-
SharedAqlItemBlockPtr res{_manager.requestBlock(to - from, _numRegisters)};
667-
668-
to = std::min<size_t>(to, _maxModifiedRowIndex);
669-
670-
for (size_t row = from; row < to; row++) {
671-
for (RegisterId::value_t col = 0; col < _numRegisters; col++) {
672-
AqlValue& a(_data[getAddress(chosen[row], col)]);
673-
674-
if (!a.isEmpty()) {
675-
steal(a);
676-
try {
677-
res->setValue(row - from, col, a);
678-
} catch (...) {
679-
a.destroy();
680-
}
681-
eraseValue(chosen[row], col);
682-
}
683-
}
684-
}
685-
686-
return res;
687-
}
688-
689655
/// @brief toJson, transfer all rows of this AqlItemBlock to Json, the result
690656
/// can be used to recreate the AqlItemBlock via the Json constructor
691657
void AqlItemBlock::toVelocyPack(velocypack::Options const* const trxOptions,
@@ -1062,25 +1028,6 @@ void AqlItemBlock::destroyValue(size_t index, RegisterId::value_t column) {
10621028
element.erase();
10631029
}
10641030

1065-
void AqlItemBlock::eraseValue(size_t index, RegisterId varNr) {
1066-
TRI_ASSERT(varNr.isRegularRegister());
1067-
auto& element = _data[getAddress(index, varNr.value())];
1068-
1069-
if (element.requiresDestruction()) {
1070-
auto it = _valueCount.find(element.data());
1071-
1072-
if (it != _valueCount.end()) {
1073-
auto& valueInfo = (*it).second;
1074-
if (--valueInfo.refCount == 0) {
1075-
decreaseMemoryUsage(valueInfo.memoryUsage);
1076-
_valueCount.erase(it);
1077-
}
1078-
}
1079-
}
1080-
1081-
element.erase();
1082-
}
1083-
10841031
void AqlItemBlock::eraseAll() {
10851032
size_t const n = maxModifiedEntries();
10861033
for (size_t i = 0; i < n; i++) {

arangod/Aql/AqlItemBlock.h

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -178,18 +178,14 @@ class AqlItemBlock {
178178
_maxModifiedRowIndex = std::max<size_t>(_maxModifiedRowIndex, index + 1);
179179
}
180180

181-
/// @brief eraseValue, erase the current value of a register and freeing it
181+
/// @brief erase the current value of a register and free it
182182
/// if this was the last reference to the value
183183
/// use with caution only in special situations when it can be ensured that
184184
/// no one else will be pointing to the same value
185185
void destroyValue(size_t index, RegisterId varNr);
186186
void destroyValue(size_t index, RegisterId::value_t column);
187187

188-
/// @brief eraseValue, erase the current value of a register not freeing it
189-
/// this is used if the value is stolen and later released from elsewhere
190-
void eraseValue(size_t index, RegisterId varNr);
191-
192-
/// @brief eraseValue, erase the current value of all values, not freeing
188+
/// @brief erase the current value of all values, not freeing
193189
/// them. this is used if the value is stolen and later released from
194190
/// elsewhere
195191
void eraseAll();
@@ -266,13 +262,6 @@ class AqlItemBlock {
266262
/// of all entries
267263
SharedAqlItemBlockPtr slice(std::vector<size_t> const& chosen, size_t from, size_t to) const;
268264

269-
/// @brief steal for a subset, this does not copy the entries, rather,
270-
/// it remembers which it has taken. This is stored in the
271-
/// this AqlItemBlock. It is highly recommended to delete it right
272-
/// after this operation, because it is unclear, when the values
273-
/// to which our AqlValues point will vanish.
274-
SharedAqlItemBlockPtr steal(std::vector<size_t> const& chosen, size_t from, size_t to);
275-
276265
/// @brief toJson, transfer all rows of this AqlItemBlock to Json, the result
277266
/// can be used to recreate the AqlItemBlock via the Json constructor
278267
void toVelocyPack(velocypack::Options const*, arangodb::velocypack::Builder&) const;

0 commit comments

Comments
 (0)
0