From d92ad48775bf08658d872898e5e57e48410d5b3f Mon Sep 17 00:00:00 2001 From: Simran Brucherseifer Date: Mon, 7 Oct 2019 12:00:22 +0200 Subject: [PATCH] Fix some typos --- arangod/Aql/GraphNode.h | 2 +- arangod/Aql/IResearchViewNode.cpp | 2 +- arangod/Aql/RegisterPlan.cpp | 4 +-- arangod/Cluster/ClusterInfo.cpp | 4 +-- arangod/IResearch/Containers.h | 2 +- arangod/IResearch/IResearchFeature.cpp | 14 +++++----- arangod/IResearch/IResearchView.cpp | 2 +- arangod/RestServer/DatabaseFeature.cpp | 2 +- arangod/RocksDBEngine/RocksDBEngine.h | 2 +- arangod/VocBase/vocbase.h | 2 +- arangosh/Backup/BackupFeature.cpp | 34 +++++++++++------------ lib/Basics/RecursiveLocker.h | 4 +-- lib/Futures/SharedState.h | 2 +- tests/IResearch/IResearchFeature-test.cpp | 6 ++-- 14 files changed, 41 insertions(+), 41 deletions(-) diff --git a/arangod/Aql/GraphNode.h b/arangod/Aql/GraphNode.h index 67614dc5dbee..2e91a3db1b2b 100644 --- a/arangod/Aql/GraphNode.h +++ b/arangod/Aql/GraphNode.h @@ -195,7 +195,7 @@ class GraphNode : public ExecutionNode { /// @brief flag, if graph is smart (enterprise edition only!) bool _isSmart; - /// @brief list of shards involved, requried for one-shard-databases + /// @brief list of shards involved, required for one-shard-databases std::map _collectionToShard; }; diff --git a/arangod/Aql/IResearchViewNode.cpp b/arangod/Aql/IResearchViewNode.cpp index ba5b505fe3ba..ce2684589004 100644 --- a/arangod/Aql/IResearchViewNode.cpp +++ b/arangod/Aql/IResearchViewNode.cpp @@ -831,7 +831,7 @@ void IResearchViewNode::planNodeRegisters( unsigned int& totalNrRegs, unsigned int depth) const { nrRegsHere.emplace_back(1); // create a copy of the last value here - // this is requried because back returns a reference and emplace/push_back + // this is required because back returns a reference and emplace/push_back // may invalidate all references aql::RegisterId const registerId = 1 + nrRegs.back(); nrRegs.emplace_back(registerId); diff --git a/arangod/Aql/RegisterPlan.cpp b/arangod/Aql/RegisterPlan.cpp index b50fa74cd138..b6e319653132 100644 --- a/arangod/Aql/RegisterPlan.cpp +++ b/arangod/Aql/RegisterPlan.cpp @@ -261,7 +261,7 @@ void RegisterPlan::after(ExecutionNode* en) { auto vars = ep->getVariablesSetHere(); nrRegsHere.emplace_back(static_cast(vars.size())); // create a copy of the last value here - // this is requried because back returns a reference and emplace/push_back + // this is required because back returns a reference and emplace/push_back // may invalidate all references RegisterId registerId = static_cast(vars.size() + nrRegs.back()); nrRegs.emplace_back(registerId); @@ -280,7 +280,7 @@ void RegisterPlan::after(ExecutionNode* en) { auto vars = ep->getVariablesSetHere(); nrRegsHere.emplace_back(static_cast(vars.size())); // create a copy of the last value here - // this is requried because back returns a reference and emplace/push_back + // this is required because back returns a reference and emplace/push_back // may invalidate all references RegisterId registerId = static_cast(vars.size() + nrRegs.back()); nrRegs.emplace_back(registerId); diff --git a/arangod/Cluster/ClusterInfo.cpp b/arangod/Cluster/ClusterInfo.cpp index 6dc3dedbd23b..7fc6d30bef52 100644 --- a/arangod/Cluster/ClusterInfo.cpp +++ b/arangod/Cluster/ClusterInfo.cpp @@ -1959,7 +1959,7 @@ Result ClusterInfo::createCollectionsCoordinator( nrDone, isCleaned, shardServers, this](VPackSlice const& result) { // NOTE: This ordering here is important to cover against a race in cleanup. // a) The Guard get's the Mutex, sets isCleaned == true, then removes the callback - // b) If the callback is aquired it is saved in a shared_ptr, the Mutex will be aquired first, then it will check if it isCleaned + // b) If the callback is acquired it is saved in a shared_ptr, the Mutex will be acquired first, then it will check if it isCleaned RECURSIVE_MUTEX_LOCKER(*cacheMutex, *cacheMutexOwner); if (*isCleaned) { return true; @@ -1968,7 +1968,7 @@ Result ClusterInfo::createCollectionsCoordinator( if (info.state != ClusterCollectionCreationInfo::State::INIT) { // All leaders have reported either good or bad // We might be called by followers if they get in sync fast enough - // In this IF we are in the followers case, we can savely ignore + // In this IF we are in the followers case, we can safely ignore return true; } diff --git a/arangod/IResearch/Containers.h b/arangod/IResearch/Containers.h index a1baf8d58a57..e4411d40a5f4 100644 --- a/arangod/IResearch/Containers.h +++ b/arangod/IResearch/Containers.h @@ -59,7 +59,7 @@ class ResourceMutex { ReadMutex& mutex() const { return _readMutex; } // prevent '_resource' reset() - void reset(); // will block until a write lock can be aquired on the _mutex + void reset(); // will block until a write lock can be acquired on the _mutex protected: void* get() const { return _resource.load(); } diff --git a/arangod/IResearch/IResearchFeature.cpp b/arangod/IResearch/IResearchFeature.cpp index aa3de5c00540..4daf9f5b2704 100644 --- a/arangod/IResearch/IResearchFeature.cpp +++ b/arangod/IResearch/IResearchFeature.cpp @@ -653,7 +653,7 @@ class IResearchFeature::Async { arangodb::basics::ConditionVariable _join; // mutex to join on std::vector _pool; // thread pool (size fixed for the entire life of object) - std::atomic _terminate; // unconditionaly terminate async tasks + std::atomic _terminate; // unconditionally terminate async tasks void stop(Thread* redelegate = nullptr); }; @@ -668,7 +668,7 @@ void IResearchFeature::Async::Thread::run() { auto pendingStart = _tasks.size(); { - SCOPED_LOCK_NAMED(_mutex, lock); // aquire before '_terminate' check so + SCOPED_LOCK_NAMED(_mutex, lock); // acquire before '_terminate' check so // that don't miss notify() if (_terminate->load()) { @@ -677,7 +677,7 @@ void IResearchFeature::Async::Thread::run() { // transfer any new pending tasks into active tasks for (auto& pending : _pending) { - _tasks.emplace_back(std::move(pending)); // will aquire resource lock + _tasks.emplace_back(std::move(pending)); // will acquire resource lock auto& task = _tasks.back(); @@ -685,7 +685,7 @@ void IResearchFeature::Async::Thread::run() { task._lock = std::unique_lock(task._mutex->mutex(), std::try_to_lock); if (!task._lock.owns_lock()) { - // if can't lock 'task._mutex' then reasign the task to the next + // if can't lock 'task._mutex' then reassign the task to the next // worker pendingRedelegate.emplace_back(std::move(task)); } else if (*(task._mutex)) { @@ -727,7 +727,7 @@ void IResearchFeature::Async::Thread::run() { (_size.load() > _next->_size.load() * 2 && _tasks.size() > 1)) { SCOPED_LOCK(_next->_mutex); - // reasign to '_next' tasks that failed resourceMutex aquisition + // reassign to '_next' tasks that failed resourceMutex aquisition while (!pendingRedelegate.empty()) { _next->_pending.emplace_back(std::move(pendingRedelegate.back())); pendingRedelegate.pop_back(); @@ -748,7 +748,7 @@ void IResearchFeature::Async::Thread::run() { for (size_t i = onlyPending ? pendingStart : 0, count = _tasks.size(); // optimization to skip previously run - // tasks if a notificationw as not raised + // tasks if a notification was not raised i < count;) { auto& task = _tasks[i]; auto exec = std::chrono::system_clock::now() >= task._timeout; @@ -785,7 +785,7 @@ void IResearchFeature::Async::Thread::run() { } // ........................................................................... - // move all tasks back into _pending in case the may neeed to be reasigned + // move all tasks back into _pending in case the may need to be reassigned // ........................................................................... SCOPED_LOCK_NAMED(_mutex, lock); // '_pending' may be modified asynchronously diff --git a/arangod/IResearch/IResearchView.cpp b/arangod/IResearch/IResearchView.cpp index e596fae20a0f..d666cd204035 100644 --- a/arangod/IResearch/IResearchView.cpp +++ b/arangod/IResearch/IResearchView.cpp @@ -659,7 +659,7 @@ arangodb::Result IResearchView::link(AsyncLinkPtr const& link) { if (!link->get()) { return arangodb::Result( // result TRI_ERROR_BAD_PARAMETER, // code - std::string("failed to aquire link while emplacing collection into arangosearch View '") + name() + "'" + std::string("failed to acquire link while emplacing collection into arangosearch View '") + name() + "'" ); } diff --git a/arangod/RestServer/DatabaseFeature.cpp b/arangod/RestServer/DatabaseFeature.cpp index 4a2e789f20c7..7b269d4ea1fd 100644 --- a/arangod/RestServer/DatabaseFeature.cpp +++ b/arangod/RestServer/DatabaseFeature.cpp @@ -786,7 +786,7 @@ int DatabaseFeature::dropDatabase(std::string const& name, bool waitForDeletion, return true; // try next DataSource }; - vocbase->visitDataSources(visitor, true); // aquire a write lock to avoid potential deadlocks + vocbase->visitDataSources(visitor, true); // acquire a write lock to avoid potential deadlocks if (TRI_ERROR_NO_ERROR != res) { events::DropDatabase(name, res); diff --git a/arangod/RocksDBEngine/RocksDBEngine.h b/arangod/RocksDBEngine/RocksDBEngine.h index 81796cef3344..f5db2cc0416c 100644 --- a/arangod/RocksDBEngine/RocksDBEngine.h +++ b/arangod/RocksDBEngine/RocksDBEngine.h @@ -405,7 +405,7 @@ class RocksDBEngine final : public StorageEngine { rocksdb::TransactionDB* _db; /// default read options rocksdb::Options _options; - /// arangodb comparator - requried because of vpack in keys + /// arangodb comparator - required because of vpack in keys std::unique_ptr _vpackCmp; /// path used by rocksdb (inside _basePath) std::string _path; diff --git a/arangod/VocBase/vocbase.h b/arangod/VocBase/vocbase.h index 40815ce9b671..a0d326b1df7d 100644 --- a/arangod/VocBase/vocbase.h +++ b/arangod/VocBase/vocbase.h @@ -373,7 +373,7 @@ struct TRI_vocbase_t { /// @brief visit all DataSources registered with this vocbase /// @param visitor returns if visitation should continue - /// @param lockWrite aquire write lock (if 'visitor' will modify vocbase) + /// @param lockWrite acquire write lock (if 'visitor' will modify vocbase) /// @return visitation compleated successfully typedef std::function dataSourceVisitor; bool visitDataSources(dataSourceVisitor const& visitor, bool lockWrite = false); diff --git a/arangosh/Backup/BackupFeature.cpp b/arangosh/Backup/BackupFeature.cpp index d42bac099e41..f8ad0dc15c1e 100644 --- a/arangosh/Backup/BackupFeature.cpp +++ b/arangosh/Backup/BackupFeature.cpp @@ -462,7 +462,7 @@ arangodb::Result executeDelete(arangodb::httpclient::SimpleHttpClient& client, } #ifdef USE_ENTERPRISE -struct TransfereType { +struct TransferType { enum type { UPLOAD, DOWNLOAD @@ -506,14 +506,14 @@ struct TransfereType { }; arangodb::Result executeStatusQuery(arangodb::httpclient::SimpleHttpClient& client, - arangodb::BackupFeature::Options const& options, TransfereType::type type) { + arangodb::BackupFeature::Options const& options, TransferType::type type) { arangodb::Result result; - std::string const url = TransfereType::asAdminPath(type); + std::string const url = TransferType::asAdminPath(type); VPackBuilder bodyBuilder; { VPackObjectBuilder guard(&bodyBuilder); - bodyBuilder.add(TransfereType::asJsonId(type), VPackValue(options.statusId)); + bodyBuilder.add(TransferType::asJsonId(type), VPackValue(options.statusId)); if (options.abort) { bodyBuilder.add("abort", VPackValue(true)); } @@ -587,8 +587,8 @@ arangodb::Result executeStatusQuery(arangodb::httpclient::SimpleHttpClient& clie return result; } -arangodb::Result executeInitiateTransfere(arangodb::httpclient::SimpleHttpClient& client, - arangodb::BackupFeature::Options const& options, TransfereType::type type) { +arangodb::Result executeInitiateTransfer(arangodb::httpclient::SimpleHttpClient& client, + arangodb::BackupFeature::Options const& options, TransferType::type type) { arangodb::Result result; // Load configuration file @@ -604,8 +604,8 @@ arangodb::Result executeInitiateTransfere(arangodb::httpclient::SimpleHttpClient return result; } - // Initiate transfere - std::string const url = TransfereType::asAdminPath(type); + // Initiate transfer + std::string const url = TransferType::asAdminPath(type); VPackBuilder bodyBuilder; { VPackObjectBuilder guard(&bodyBuilder); @@ -638,23 +638,23 @@ arangodb::Result executeInitiateTransfere(arangodb::httpclient::SimpleHttpClient } TRI_ASSERT(resultObject.isObject()); - std::string transfereId = resultObject.get(TransfereType::asJsonId(type)).copyString(); + std::string transferId = resultObject.get(TransferType::asJsonId(type)).copyString(); LOG_TOPIC("a9597", INFO, arangodb::Logger::BACKUP) << "Backup initiated, use "; - LOG_TOPIC("4c459", INFO, arangodb::Logger::BACKUP) << " arangobackup " << TransfereType::asString(type) << " --status-id=" << transfereId; + LOG_TOPIC("4c459", INFO, arangodb::Logger::BACKUP) << " arangobackup " << TransferType::asString(type) << " --status-id=" << transferId; LOG_TOPIC("5cd70", INFO, arangodb::Logger::BACKUP) << " to query progress."; return result; } -arangodb::Result executeTransfere(arangodb::httpclient::SimpleHttpClient& client, - arangodb::BackupFeature::Options const& options, TransfereType::type type) { +arangodb::Result executeTransfer(arangodb::httpclient::SimpleHttpClient& client, + arangodb::BackupFeature::Options const& options, TransferType::type type) { if (!options.statusId.empty()) { // This is a status query return executeStatusQuery(client, options, type); } else { - // This is a transfere - return executeInitiateTransfere(client, options, type); + // This is a transfer + return executeInitiateTransfer(client, options, type); } } #endif @@ -716,7 +716,7 @@ void BackupFeature::collectOptions(std::shared_ptr opti new StringParameter(&_options.label)); options->addOption("--max-wait-for-lock", - "maximum time to wait in seconds to aquire a lock on " + "maximum time to wait in seconds to acquire a lock on " "all necessary resources (create operation)", new DoubleParameter(&_options.maxWaitForLock)); @@ -872,9 +872,9 @@ void BackupFeature::start() { result = ::executeDelete(*client, _options); #ifdef USE_ENTERPRISE } else if (_options.operation == OperationUpload) { - result = ::executeTransfere(*client, _options, TransfereType::type::UPLOAD); + result = ::executeTransfer(*client, _options, TransferType::type::UPLOAD); } else if (_options.operation == OperationDownload) { - result = ::executeTransfere(*client, _options, TransfereType::type::DOWNLOAD); + result = ::executeTransfer(*client, _options, TransferType::type::DOWNLOAD); #endif } diff --git a/lib/Basics/RecursiveLocker.h b/lib/Basics/RecursiveLocker.h index 33bb29bf5723..0383c1b4888d 100644 --- a/lib/Basics/RecursiveLocker.h +++ b/lib/Basics/RecursiveLocker.h @@ -40,7 +40,7 @@ class RecursiveMutexLocker { T& mutex, // mutex std::atomic& owner, // owner arangodb::basics::LockerType type, // locker type - bool acquire, // aquire flag + bool acquire, // acquire flag char const* file, // file int line // line ): _locker(&mutex, type, false, file, line), _owner(owner), _update(noop) { @@ -116,7 +116,7 @@ class RecursiveWriteLocker { T& mutex, // mutex std::atomic& owner, // owner arangodb::basics::LockerType type, // locker type - bool acquire, // aquire flag + bool acquire, // acquire flag char const* file, // file int line // line ): _locked(false), // locked diff --git a/lib/Futures/SharedState.h b/lib/Futures/SharedState.h index edf21a594e49..f82d50cdee02 100644 --- a/lib/Futures/SharedState.h +++ b/lib/Futures/SharedState.h @@ -56,7 +56,7 @@ class SharedState { Done = 1 << 3, }; - /// Allow us to savely pass a core pointer to the Scheduler + /// Allow us to safely pass a core pointer to the Scheduler struct SharedStateScope { explicit SharedStateScope(SharedState* state) noexcept : _state(state) {} SharedStateScope(SharedStateScope const&) = delete; diff --git a/tests/IResearch/IResearchFeature-test.cpp b/tests/IResearch/IResearchFeature-test.cpp index 4e16a6a96dc4..7a7feac34339 100644 --- a/tests/IResearch/IResearchFeature-test.cpp +++ b/tests/IResearch/IResearchFeature-test.cpp @@ -647,12 +647,12 @@ TEST_F(IResearchFeatureTest, test_async_multiple_tasks_with_same_resource_mutex) EXPECT_TRUE((std::cv_status::timeout != cond.wait_for(lock, std::chrono::milliseconds(1000)))); // wait for the first task to start - std::thread thread([resourceMutex]() -> void { resourceMutex->reset(); }); // try to aquire a write lock + std::thread thread([resourceMutex]() -> void { resourceMutex->reset(); }); // try to acquire a write lock std::this_thread::sleep_for(std::chrono::milliseconds(100)); // hopefully a write-lock aquisition attempt is in progress { TRY_SCOPED_LOCK_NAMED(resourceMutex->mutex(), resourceLock); - EXPECT_FALSE(resourceLock.owns_lock()); // write-lock aquired successfully (read-locks blocked) + EXPECT_FALSE(resourceLock.owns_lock()); // write-lock acquired successfully (read-locks blocked) } { @@ -660,7 +660,7 @@ TEST_F(IResearchFeatureTest, test_async_multiple_tasks_with_same_resource_mutex) [](bool* ptr) -> void { *ptr = true; }); feature.async(resourceMutex, [flag](size_t&, bool) -> bool { return false; }); // will never get invoked because resourceMutex is reset } - cond.notify_all(); // wake up first task after resourceMutex write-lock aquired (will process pending tasks) + cond.notify_all(); // wake up first task after resourceMutex write-lock acquired (will process pending tasks) lock.unlock(); // allow first task to run std::this_thread::sleep_for(std::chrono::milliseconds(100)); EXPECT_TRUE(deallocated0);