8000 Reduce the amount of exception macros by goedderz · Pull Request #14504 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Reduce the amount of exception macros #14504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 581 commits into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
581 commits
Select commit Hold shift + click to select a range
4222682
Create agency methods and simplified RestLogHandler.cpp
Jun 11, 2021
a8592ef
Set waitForSync for replicated logs
goedderz Jun 11, 2021
5386a21
Fixed c&p error
goedderz Jun 11, 2021
1700471
More static strings.
Jun 11, 2021
32e2ef9
Set waitForSync for replicated logs
goedderz Jun 11, 2021
b3236a1
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
goedderz Jun 11, 2021
f9a9ae6
Added tailing to coordinator.
Jun 11, 2021
4d6c0f8
Reverted changes
goedderz Jun 11, 2021
7153327
Merge branch 'feature/replication-2.0' of github.com:arangodb/arangod…
Jun 11, 2021
f9c66bd
Resign on shutdown.
Jun 11, 2021
238a64a
When dropping a collection, drop replicated logs as well.
goedderz Jun 14, 2021
fdb5fc3
Added getFirstIndexOfTerm / getLastIndexOfTerm
goedderz Jun 14, 2021
b057c15
Fixed compile errors in new maintenance tests
goedderz Jun 14, 2021
1cf4052
Fixed duplicate logIds, and related log messages
goedderz Jun 14, 2021
9848080
Select random follower.
Jun 14, 2021
3117394
Merge branch 'feature/replication-2.0' of github.com:arangodb/arangod…
Jun 14, 2021
6fc3a1b
Hide the InMemoryLog::_log member
goedderz Jun 15, 2021
f811d54
Added some assertions to a test
goedderz Jun 15, 2021
bf3550b
Adapted test to new result structure
goedderz Jun 15, 2021
397e554
Fixed JS test
goedderz Jun 15, 2021
cd65d56
Fixed compile error in c++ tests 8000
goedderz Jun 15, 2021
89f85d3
Refactored Supervision code to make election testable.
Jun 15, 2021
4bedfb9
Added tests for checkReplicatedLog in agency.
Jun 15, 2021
6c927ad
Added test with wc = 2.
Jun 15, 2021
d8d2736
Fixing wc=2 test.
Jun 15, 2021
7975dd5
Fixed logIds
goedderz Jun 16, 2021
ddd7956
Make supervision report in Current why no leader can be elected.
Jun 16, 2021
5cd4314
Merge remote-tracking branch 'origin/devel' into feature/replication-2.0
Jun 16, 2021
f101230
Added AsyncMockLog for lonelyLeader test.
Jun 17, 2021
8604e52
A little cleanup
goedderz Jun 17, 2021
25faa0c
Added tests for database creation / deletion
goedderz Jun 17, 2021
9eb6967
Disabled FailedFollower and FailedLeader for new replication databases.
Jun 17, 2021
c537b71
Added AgencyCollectionSpecification.
Jun 17, 2021
1a57315
Stop async mock logs
goedderz Jun 21, 2021
7991960
Added detectConflict algorithm that is used on the follower to detect…
Jun 21, 2021
a7463c1
Enabled optimization for conflict detection.
Jun 22, 2021
d89c0cd
Added more logging.
Jun 22, 2021
1b6f63a
Moved log create/drop logic from vocbase to log manager, and added a …
goedderz Jun 17, 2021
d33c293
Added the collection name to the replicated log LogContext
goedderz Jun 17, 2021
38e332e
Minor changes
goedderz Jun 17, 2021
0dc517c
Fix compile errors with tsan
goedderz Jun 22, 2021
a2cffaf
Added UnshackledMutex
goedderz Jun 22, 2021
d5a1eaf
Use UnshackledMutex in LogCore for _operationMutex
goedderz Jun 22, 2021
15950e4
Make sure _stopping is initialized before the thread is started
goedderz Jun 22, 2021
932483a
Fixed problems in concurrent test
goedderz Jun 22, 2021
b096c09
Use a different immer memory policy, to work around a concurrency iss…
goedderz Jun 22, 2021
d43338d
Use transparent functor
goedderz Jun 22, 2021
359e1dc
Added missing dependency
goedderz Jun 22, 2021
9a24222
Fixed an assertion
goedderz Jun 23, 2021
c529f18
No longer call `insertAsync` for empty AppendEntriesRequests, and hol…
goedderz Jun 23, 2021
63f3d3a
Added another assertion in the AsyncMockLog
goedderz Jun 23, 2021
19ffb17
Cleanup rest handler.
Jun 24, 2021
790a115
Added CollectionGroups to ClusterInfo.
Jun 24, 2021
cf447d7
Avoid jslint error
goedderz Jun 28, 2021
a0311c4
Made collection name optional in ensureReplicatedLog.
Jun 28, 2021
21250d0
Merge remote-tracking branch 'origin/devel' into feature/replication-2.0
Jun 28, 2021
54023ce
Replace lastAckedIndex with lastAckedEntry having a meaningful term.
Jun 29, 2021
add04ec
Merge branch 'devel' of github.com:arangodb/arangodb into feature/gua…
goedderz Jun 29, 2021
c6668d3
Minor changes
goedderz Jun 29, 2021
3dc12ed
Merge branch 'devel' of github.com:arangodb/arangodb into feature/rep…
goedderz Jun 29, 2021
159a458
Merge branch 'feature/guarded-mutex' of github.com:arangodb/arangodb …
goedderz Jun 29, 2021
4dbb050
Cleaned up some TODOs.
Jun 29, 2021
15c0c93
More TODO cleanup. Jun 29, 2021
b63e404
noexcept in finally.
Jun 29, 2021
857acbb
Made finally exception safe.
Jun 29, 2021
9587f44
Require admin access to database for log api. Only enabled in maintai…
Jun 29, 2021
ea89666
Added missing tests
goedderz Jun 29, 2021
e2dfe36
Added a feature flag for Replication2
goedderz Jun 29, 2021
a06fbfc
Replaced leaderId by optional because leader is optional.
Jul 1, 2021
9490a3d
Added maintenance tests.
Jul 2, 2021
1150d86
More tests for maintenanceMore tests for maintenance..
Jul 2, 2021
7d0da23
Fixed maintenance code.
Jul 2, 2021
a3bbd09
Extracted action code into algorithms to make it unit testable.
Jul 2, 2021
8401ad2
More tests for maintenance action code.
Jul 5, 2021
33ce3fd
Replaced references for replicated logs by shared ptrs.
Jul 5, 2021
7a989c0
Disable functional tests when replication2 is disabled
goedderz Jul 6, 2021
3398cfd
Cleanup some code paths.
Jul 6, 2021
ce98e73
More code cleanup.
Jul 6, 2021
ec1e8a5
Moved FeatureFlag.cpp/.h
goedderz Jul 6, 2021
edc7cf9
Fixed a few compile errors
goedderz Jul 6, 2021
70d462c
Fixed compile errors in the tests
goedderz Jul 6, 2021
d4be0ec
More code cleanup in LogFollower.
Jul 6, 2021
56e831f
Fixed a warning
goedderz Jul 6, 2021
5f51904
More code clean up of follower.
Jul 6, 2021
6113d06
Fixed bug in messageId handling.
Jul 6, 2021
7c50d7d
Cleanup more code.
Jul 6, 2021
e391089
Renamed messages.h to NetworkMessages.h
Jul 6, 2021
16856c0
Fixing wrong assertion.
Jul 6, 2021
4175c15
Move MeasureTimeGuard to common header.
Jul 7, 2021
9e43467
Removed TermData and use LogConfig instead. Clean up code at places.
Jul 7, 2021
25b06f4
Build wrapper around LogStatus.
Jul 7, 2021
95585ca
Fixed tests and compilation.
Jul 7, 2021
a736dd3
Allow loading a replication 2 db, even if replication 2 is disabled
goedderz Jul 7, 2021
f473421
Add replication 2 tests to arangodbtests binary, and make building ar…
goedderz Jul 7, 2021
b86e5bb
Moved Status Objects into LogStatus.h
Jul 7, 2021
3f9314f
Added more forward declarations to include the api headers less.
Jul 7, 2021
a2cb01c
PR clean up.
Jul 7, 2021
5817591
Refactored some headers to optimize includes.
Jul 8, 2021
1c922e0
Fixing StorageEngineMock.
Jul 8, 2021
af4768c
Added some mis ing declarations
goedderz Jul 8, 2021
bbf6dfe
Started writing a test for UnshackledMutex
goedderz Jul 8, 2021
040a4b0
Optimized DBServerAgencySync.h
Jul 8, 2021
5a463c9
Added peek() on LogIterators
goedderz Jul 8, 2021
419780d
Revert "Added peek() on LogIterators"
goedderz Jul 8, 2021
d81df02
Merge remote-tracking branch 'origin/devel' into feature/replication-2.0
Jul 8, 2021
aa2245b
Minor changes
goedderz Jul 8, 2021
c610400
Got rid of unnecessarily passed weak_ptr parentLogs
goedderz Jul 8, 2021
91940ad
Removed unused includes.
Jul 8, 2021
731e8ad
Collected some changes from replication 2.0 PR.
Jul 8, 2021
b3ae831
Merge remote-tracking branch 'origin/feature/replicated-log-companion…
Jul 8, 2021
18b6567
Added exception header.
Jul 8, 2021
12a307c
Merge remote-tracking branch 'origin/feature/replicated-log-companion…
Jul 8, 2021
f0f925b
More code that is not related to replicated logs.
Jul 8, 2021
43313c4
Made LogIterator peek()able
goedderz Jul 8, 2021
96b89da
Added readEnd() to PersistedLog and RocksDBLog
goedderz Jul 8, 2021
5aa99be
Reverted accidental change
goedderz Jul 8, 2021
7cc75e5
Revert "Made LogIterator peek()able"
goedderz Jul 8, 2021
fa0af53
Revert "Added readEnd() to PersistedLog and RocksDBLog"
goedderz Jul 8, 2021
57c36d9
Merge remote-tracking branch 'origin/devel' into feature/replication-2.0
Jul 8, 2021
b4ff84c
Merge remote-tracking branch 'origin/devel' into feature/replicated-l…
Jul 8, 2021
16ae7f2
Merge remote-tracking branch 'origin/feature/replicated-log-companion…
Jul 8, 2021
56d8eaf
Clean up LogicalCollection changes.
Jul 8, 2021
14b438d
Made a comment out of a TODO note
goedderz Jul 8, 2021
6b847ae
Revert "Run gtest binary arangodbtests_replication2"
Jul 8, 2021
15f6f57
Added modifications on metrics feature api.
Jul 8, 2021
f310f05
Merge remote-tracking branch 'origin/feature/replicated-log-companion…
Jul 8, 2021
2348a56
Reverted Collection changes.
Jul 8, 2021
358dccd
Reverted collection code.
Jul 8, 2021
7ea920d
Added path components.
Jul 8, 2021
5dcc68f
Merge remote-tracking branch 'origin/feature/replicated-log-companion…
Jul 8, 2021
8fe6c1d
Merge remote-tracking branch 'origin/feature/replicated-log-companion…
Jul 8, 2021
9b42045
Fixing clusterinfo.
Jul 8, 2021
b0568ed
Reverted ClusterInfo changes.
Jul 8, 2021
3ee74a6
Merge remote-tracking branch 'origin/feature/replicated-log-companion…
Jul 8, 2021
db4c458
More reverts in logical collection.
Jul 8, 2021
f99e800
Merge remote-tracking branch 'origin/feature/replicated-log-companion…
Jul 8, 2021
3457738
Merge remote-tracking branch 'origin/feature/replication-2.0' into fe…
Jul 8, 2021
2e03ee9
Reverted more of ClusterInfo.
Jul 8, 2021
09f0db3
Fixing Maintenance Tests.
Jul 8, 2021
da00636
Merge remote-tracking branch 'origin/feature/replicated-log-companion…
Jul 8, 2021
4fe1fa7
Cleanup in Maintenance and ClusterInfo.
Jul 8, 2021
8f22481
Merge remote-tracking branch 'origin/feature/replicated-log-companion…
Jul 8, 2021
13bef2c
Merge remote-tracking branch 'origin/feature/replication-2.0' into fe…
Jul 8, 2021
4bfd458
Revert IRSearch Tests.
Jul 8, 2021
52b76b3
Minor changes from review
goedderz Jul 9, 2021
d0ebb4c
Remove code duplication as suggested in the review
goedderz Jul 9, 2021
8e17cc0
Made FATAL_ERROR_(EXIT|ABORT) exception safe and replaced the macros …
goedderz Jul 12, 2021
5d08a49
Fixed some compile errors
goedderz Jul 12, 2021
fcfffe7
Completed UnshackledMutexTest
goedderz Jul 12, 2021
1ed681f
Merge branch 'feature/replicated-log-companion-pr' into feature/repli…
goedderz Jul 12, 2021
7b75ac2
Merge branch 'feature/guarded-mutex' of https://github.com/arangodb/a…
goedderz Jul 12, 2021
45e466c
Merge branch 'feature/replicated-log-companion-pr' of https://github.…
goedderz Jul 12, 2021
d511074
Create the AppendEntriesRequest after the optional delay, so it can u…
goedderz Jul 8, 2021
bab222f
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
goedderz Jul 12, 2021
2213793
Merge branch 'feature/replicated-log-companion-pr' of https://github.…
goedderz Jul 12, 2021
cec1f26
Fixed compile and linker errors
goedderz Jul 12, 2021
49cf5a0
Resolve ambiguous call
goedderz Jul 12, 2021
335880d
Resolve ambiguous call
goedderz Jul 12, 2021
24a7b55
Replace unlikely
goedderz Jul 12, 2021
2711672
🤦
goedderz Jul 13, 2021
0afdf78
Added assertions to clarify a constructor's mode of operation
goedderz Jul 13, 2021
8d27093
Added assertions to clarify a constructor's mode of operation
goedderz Jul 13, 2021
f6e7453
Added retry to SchedulerExecutor for RocksDBLogPersistor. Implemented…
Jul 13, 2021
968854c
Changed and added an assertion to clarify the most important property
goedderz Jul 13, 2021
99e2b2f
Added some comments
goedderz Jul 13, 2021
179cc0c
Merge branch 'feature/replicated-log-companion-pr' of github.com:aran…
goedderz Jul 13, 2021
c63e834
Fix test compilation.
Jul 13, 2021
658603b
Renamed metrics as suggested by promtool
goedderz Jul 13, 2021
0bb98db
Fixed compile error in tests
goedderz Jul 13, 2021
0ea5fc4
Merge branch 'feature/replication-2.0-pr' of github.com:arangodb/aran…
goedderz Jul 13, 2021
13eb2c7
Made queue code exception safe.
Jul 13, 2021
9c04337
Added exponential backoff.
Jul 13, 2021
638bf83
Fixed copyright header
goedderz Jul 13, 2021
95901b4
Merge branch 'feature/replicated-log-companion-pr' of github.com:aran…
goedderz Jul 13, 2021
339b747
Fixed copyright headers
goedderz Jul 13, 2021
28ac084
Merge branch 'feature/replication-2.0-pr' of github.com:arangodb/aran…
goedderz Jul 13, 2021
d38819c
Renamed RocksDBLog to RocksDBPersistedLog.
Jul 13, 2021
72dd8ba
Replaced prevLogIndex/prevLogTerm by prevLogEntry :: TermIndexPair. R…
Jul 13, 2021
c879bcb
Resolved a TODO
goedderz Jul 13, 2021
5f23f0b
Merge branch 'feature/replication-2.0-pr' of github.com:arangodb/aran…
goedderz Jul 13, 2021
35b0043
Fixing failover.
Jul 14, 2021
4f7cad3
A little cleanup around RocksDBLogPersistor
goedderz Jul 14, 2021
28520ee
Merge branch 'feature/replication-2.0-pr' of https://github.com/arang…
goedderz Jul 14, 2021
f4580aa
Merge branch 'devel' of https://github.com/arangodb/arangodb into fea…
goedderz Jul 14, 2021
11b0abe
Make updateReplicatedLog noexcept.
Jul 14, 2021
723ce02
Removed a superfluous try-catch block, and resolved a TODO
goedderz Jul 14, 2021
1ed2419
Reduce the amount of exception macros
goedderz Jul 14, 2021
460e132
Removed some code
goedderz Jul 15, 2021
d3bd17d
Replaced a macro mi 8000 ssed before
goedderz Jul 15, 2021
0880468
Fixes
goedderz Jul 15, 2021
a7e456f
Update lib/Basics/ResultError.cpp
goedderz Jul 16, 2021
a90d45e
Addressed review comments
goedderz Jul 19, 2021
98783e3
Merge remote-tracking branch 'origin/devel' into feature/replication-…
Jul 19, 2021
13c4811
Fixed non-maintainer-mode
goedderz Jul 19, 2021
ed74d4e
Reverted changes in ShardingInfo that are not yet necessary
goedderz Jul 19, 2021
ff8127a
Removed DelayedLogLeader
goedderz Jul 19, 2021
fe69d8f
Some minor changes
goedderz Jul 19, 2021
eb17e17
Rename runAsyncStep to triggerAsyncReplication
goedderz Jul 19, 2021
6291151
LogLeader::insert now calls triggerAsyncReplication by default
goedderz Jul 19, 2021
3cca504
Added test that checks for correct commit behavior for entries from p…
Jul 20, 2021
f2a6e14
Fixing tests. Added ChangeStream test.
Jul 20, 2021
fa36999
Fixing off-by-one error in InMemoryLog. Fixing waitForIterator return…
Jul 20, 2021
6c752ba
Move PrevTermCommitTest to the correct sources in cmake
goedderz Jul 20, 2021
76a022f
Do not commit log entries from previous terms
goedderz Jul 20, 2021
2d72668
Increase Replication2's default log level to INFO
goedderz Jul 20, 2021
c537b3f
Change the test so it fails with the usual gtest assertions, instead …
goedderz Jul 20, 2021
2f05f8b
Wrapped LogEntry into InMemoryLogEntry
goedderz Jul 21, 2021
9bd22e6
Insert an empty LogEntry in LogLeader::construct
goedderz Jul 22, 2021
2a3456d
[WIP] Separated internal and user-facing log entries and iterators
goedderz Jul 26, 2021
9229c63
Apply suggestions from code review
Jul 27, 2021
dd07391
More changes from code review.
Jul 27, 2021
6396c12
Added code for loading PersistingLogEntries from disk.
Jul 27, 2021
1ec2db9
Added limit to rest api. Skip private log entries and wait for first …
Jul 27, 2021
68fa272
Fixed issues from code review.
Jul 28, 2021
7569596
Apply suggestions from code review
Jul 28, 2021
d54d36b
Added and fixed tests. Applied suggestions from code review.
Jul 28, 2021
1a3b80a
Apply suggestions from code review
Jul 28, 2021
4998603
Moved extractors to header files and use them exclusively.
Jul 28, 2021
a23cc59
Merge remote-tracking branch 'origin/devel' into feature/replication-…
Jul 28, 2021
25ef544
Fixing compile issue introduced by github suggestion.
Jul 28, 2021
f59d3a4
Remove useless test.
Jul 28, 2021
e4488c3
Fixing checkLogIds.py by ignoring the correct file.
Jul 28, 2021
8d89b0f
Renamed LogParticipantI to ILogParticipant.
Jul 28, 2021
ad0efd0
Apply suggestions from code review
Jul 30, 2021
3339c31
Merge remote-tracking branch 'origin/devel' into feature/replication-…
Jul 30, 2021
5ddb06d
Implemented suggestions from code review.
Jul 30, 2021
b59503a
Fix typo.
Aug 2, 2021
5e0efb8
Added comment on implement_compare. Added logging to checkReplicatedLog.
Aug 2, 2021
2a3027a
Merge remote-tracking branch 'origin/devel' into feature/replication-…
Aug 3, 2021
672afd5
Added commit index as static string.
Aug 3, 2021
3719217
Renamed splice to slice. Fixed saturatedDecrement.
Aug 3, 2021
7df53d6
Simplify log thread allocation.
Aug 3, 2021
c47404a
Review: Wrote out microseconds in metric documentation
goedderz Aug 3, 2021
3bfa5d4
Review: Removed useless return values
goedderz Aug 3, 2021
b35e708
Merge branch 'devel' of github.com:arangodb/arangodb into feature/rep…
goedderz Aug 3, 2021
88b4d1e
Fixing bugs found during code review. Use UnshackledMutex in more pla…
Aug 4, 2021
6a2f111
Fixing RestLogHandler. Returned only quorum data that contains the wr…
Aug 5, 2021
b4c9a85
Small changes from code review.
Aug 5, 2021
0f33c96
Applied suggestions from code review.
Aug 6, 2021
ddd19ce
Apply suggestions from code review
Aug 6, 2021
2714e12
Applied more suggestions. Code clean up. LogTerm/LogIndex always by-v…
Aug 9, 2021
48e1cc9
Apply suggestions from code review
Aug 9, 2021
2a92412
Added forward declaration of friend operators.
Aug 9, 2021
1a2d1c4
Removed dependency on application server.
Aug 9, 2021
72d3dba
Remove wrong static assertion.
Aug 10, 2021
b141ab1
Merge commit '72d3dba13f07a96894de2d59a50e2fe79478f06c' into feature/…
goedderz Aug 17, 2021
3b20a4e
Merge commit 'c3c390b8b0db30ba5917ba655fddee96807526da^' into feature…
goedderz Aug 17, 2021
bd07a6e
Merge commit 'c3c390b8b0db30ba5917ba655fddee96807526da' into tmp
goedderz Aug 17, 2021
83bb465
Merge branch 'tmp' into feature/reduce-macros
goedderz Aug 17, 2021
3ea28f6
Merge remote-tracking branch 'origin/devel' into feature/reduce-macros
goedderz Aug 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion arangod/Aql/DistributeExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ auto DistributeExecutor::getClient(SharedAqlItemBlockPtr const& block, size_t ro
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "DistributeExecutor requires an object as input");
}
auto res = _infos.getResponsibleClient(input);
THROW_ARANGO_EXCEPTION_IF_FAIL(res.result());
if (res.fail()) {
THROW_ARANGO_EXCEPTION(std::move(res).result());
}
return res.get();
}

Expand Down
5 changes: 4 additions & 1 deletion arangod/Graph/Graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,10 @@ void Graph::insertOrphanCollections(VPackSlice const arr) {
"'orphanCollections' are not an array in the graph definition");
}
for (auto const& c : VPackArrayIterator(arr)) {
THROW_ARANGO_EXCEPTION_IF_FAIL(validateOrphanCollection(c));
auto res = validateOrphanCollection(c);
if (res.fail()) {
THROW_ARANGO_EXCEPTION(std::move(res));
}
addOrphanCollection(c.copyString());
}
}
Expand Down
5 changes: 3 additions & 2 deletions arangod/Replication2/ReplicatedLog/Algorithms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,12 @@ auto algorithms::checkReplicatedLog(DatabaseID const& database,
auto const numParticipants = newLeaderSet.size();
if (ADB_UNLIKELY(numParticipants == 0 ||
numParticipants > std::numeric_limits<uint16_t>::max())) {
ASSERT_OR_THROW_ARANGO_EXCEPTION_MESSAGE(
abortOrThrow(
TRI_ERROR_NUMERIC_OVERFLOW,
basics::StringUtils::concatT(
"Number of participants out of range, should be between ", 1,
" and ", std::numeric_limits<uint16_t>::max(), ", but is ", numParticipants));
" and ", std::numeric_limits<uint16_t>::max(), ", but is ", numParticipants),
ADB_HERE);
}
auto const maxIdx = static_cast<uint16_t>(numParticipants - 1);
// Randomly select one of the best participants
Expand Down
2 changes: 1 addition & 1 deletion arangod/Replication2/ReplicatedLog/InMemoryLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ void replicated_log::InMemoryLog::appendInPlace(LoggerContext const& logContext,
"mismatching log index. Last log index is ",
getLastIndex(), ", but the new entry has ", entry.entry().logIndex());
LOG_CTX("e2775", ERR, logContext) << message;
ASSERT_OR_THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, std::move(message));
basics::abortOrThrow(TRI_ERROR_INTERNAL, std::move(message), ADB_HERE);
}
_log = _log.push_back(std::move(entry));
}
Expand Down
2 changes: 1 addition & 1 deletion arangod/Replication2/ReplicatedLog/LogFollower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ auto replicated_log::LogFollower::resign() && -> std::tuple<std::unique_ptr<LogC
if (followerData._logCore == nullptr) {
LOG_CTX("55a1d", WARN, _loggerContext)
<< "follower log core is already gone. Resign was called twice!";
ASSERT_OR_THROW_ARANGO_EXCEPTION(TRI_ERROR_REPLICATION_REPLICATED_LOG_FOLLOWER_RESIGNED);
basics::abortOrThrow(TRI_ERROR_REPLICATION_REPLICATED_LOG_FOLLOWER_RESIGNED, ADB_HERE);
}

// use a unique ptr because move constructor for multimaps is not noexcept
Expand Down
8 changes: 4 additions & 4 deletions arangod/Replication2/Version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ auto replication::versionToString(replication::Version version) -> std::string_v
case Version::TWO:
return "2";
}
ASSERT_OR_THROW_ARANGO_EXCEPTION_MESSAGE(
TRI_ERROR_INTERNAL,
StringUtils::concatT("Unhandled replication version: ",
static_cast<std::underlying_type_t<Version>>(version)));
abortOrThrow(TRI_ERROR_INTERNAL,
StringUtils::concatT("Unhandled replication version: ",
static_cast<std::underlying_type_t<Version>>(version)),
ADB_HERE);
}
5 changes: 4 additions & 1 deletion arangosh/Export/ExportFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,10 @@ void ExportFeature::writeBatch(ManagedDirectory::File & fd, VPackArrayIterator i

void ExportFeature::writeToFile(ManagedDirectory::File & fd, std::string const& line) {
fd.write(line.c_str(), line.size());
THROW_ARANGO_EXCEPTION_IF_FAIL(fd.status());
auto res = fd.status();
if (res.fail()) {
THROW_ARANGO_EXCEPTION(std::move(res));
}
}

std::shared_ptr<VPackBuilder> ExportFeature::httpCall(SimpleHttpClient* httpClient,
Expand Down
78 changes: 34 additions & 44 deletions lib/Basics/Exceptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,71 +40,55 @@
using namespace arangodb;
using namespace arangodb::basics;

/// @brief constructor, without format string
Exception::Exception(ErrorCode code, char const* file, int line)
: _errorMessage(TRI_errno_string(code)), _file(file), _line(line), _code(code) {
// All other constructors delegate to this one.
Exception::Exception(ErrorCode code, std::string&& errorMessage, SourceLocation location) noexcept
: _errorMessage(std::move(errorMessage)),
_location(location),
_code(code) {
appendLocation();
}
Exception::Exception(ErrorCode code, SourceLocation location)
: Exception(code, TRI_errno_string(code), location) {}
Exception::Exception(Result const& result, SourceLocation location)
: Exception(result.errorNumber(), result.errorMessage(), location) {}
Exception::Exception(Result&& result, SourceLocation location) noexcept
: Exception(result.errorNumber(), std::move(result).errorMessage(), location) {}
Exception::Exception(ErrorCode code, std::string_view errorMessage, SourceLocation location)
: Exception(code, std::string{errorMessage}, location) {}
Exception::Exception(ErrorCode code, const char* errorMessage, SourceLocation location)
: Exception(code, std::string{errorMessage}, location) {}

Exception::Exception(ErrorCode code, char const* file, int line)
: Exception(code, SourceLocation(file, line)) {}
Exception::Exception(arangodb::Result const& result, char const* file, int line)
: _errorMessage(result.errorMessage()),
_file(file),
_line(line),
_code(result.errorNumber()) {
appendLocation();
}

Exception::Exception(arangodb::Result&& result, char const* file, int line)
: _errorMessage(std::move(result).errorMessage()), // cast to rvalueref so the error
// string gets moved out
_file(file),
_line(line),
_code(result.errorNumber()) {
appendLocation();
}

/// @brief constructor, for creating an exception with an already created
/// error message (normally based on error templates containing %s, %d etc.)
: Exception(result, SourceLocation(file, line)) {}
Exception::Exception(arangodb::Result&& result, char const* file, int line) noexcept
: Exception(std::move(result), SourceLocation(file, line)) {}
Exception::Exception(ErrorCode code, std::string_view errorMessage, char const* file, int line)
: _errorMessage(errorMessage), _file(file), _line(line), _code(code) {
appendLocation();
}

/// @brief constructor, for creating an exception with an already created
/// error message (normally based on error templates containing %s, %d etc.)
Exception::Exception(ErrorCode code, std::string&& errorMessage, char const* file, int line)
: _errorMessage(std::move(errorMessage)), _file(file), _line(line), _code(code) {
appendLocation();
}

/// @brief constructor, for creating an exception with an already created
/// error message (normally based on error templates containing %s, %d etc.)
: Exception(code, errorMessage, SourceLocation(file, line)) {}
Exception::Exception(ErrorCode code, std::string&& errorMessage, char const* file, int line) noexcept
: Exception(code, std::move(errorMessage), SourceLocation(file, line)) {}
Exception::Exception(ErrorCode code, char const* errorMessage, char const* file, int line)
: _errorMessage(errorMessage), _file(file), _line(line), _code(code) {
appendLocation();
}
: Exception(code, errorMessage, SourceLocation(file, line)) {}

/// @brief returns the error message
std::string const& Exception::message() const noexcept { return _errorMessage; }

/// @brief returns the error code
ErrorCode Exception::code() const noexcept { return _code; }

/// @brief adds to the message
void Exception::addToMessage(std::string const& more) { _errorMessage += more; }

/// @brief return exception message
char const* Exception::what() const noexcept { return _errorMessage.c_str(); }

/// @brief append original error location to message
void Exception::appendLocation() noexcept try {
if (_code == TRI_ERROR_INTERNAL) {
_errorMessage += std::string(" (exception location: ") + _file + ":" +
std::to_string(_line) +
_errorMessage += std::string(" (exception location: ") + _location.file_name() +
":" + std::to_string(_location.line()) +
"). Please report this error to arangodb.com";
} else if (_code == TRI_ERROR_OUT_OF_MEMORY || _code == TRI_ERROR_NOT_IMPLEMENTED) {
_errorMessage += std::string(" (exception location: ") + _file + ":" +
std::to_string(_line) + ")";
_errorMessage += std::string(" (exception location: ") + _location.file_name() +
":" + std::to_string(_location.line()) + ")";
}
} catch (...) {
// this function is called from the exception constructor, so it should
Expand Down Expand Up @@ -170,3 +154,9 @@ std::string Exception::FillFormatExceptionString(char const* format, ...) {
<< "Failed to create an error message, giving up. " << errorMessage;
FATAL_ERROR_EXIT();
}

[[noreturn]] void ::arangodb::basics::helper::logAndAbort(const char* what) {
LOG_TOPIC("fa7a1", FATAL, ::arangodb::Logger::CRASH) << what;
TRI_ASSERT(false);
FATAL_ERROR_ABORT();
}
Loading
0