8000 Fix some typos by Simran-B · Pull Request #10173 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Fix some typos #10173

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 5 commits into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion arangod/Cluster/ClusterInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2004,7 +2004,7 @@ Result ClusterInfo::createCollectionsCoordinator(
if (info.state != ClusterCollectionCreationState::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;
}

Expand Down
2 changes: 1 addition & 1 deletion arangod/IResearch/Containers.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
Expand Down
14 changes: 7 additions & 7 deletions arangod/IResearch/IResearchFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ class IResearchFeature::Async {

arangodb::basics::ConditionVariable _join; // mutex to join on
std::vector<Thread> _pool; // thread pool (size fixed for the entire life of object)
std::atomic<bool> _terminate; // unconditionaly terminate async tasks
std::atomic<bool> _terminate; // unconditionally terminate async tasks

void stop(Thread* redelegate = nullptr);
};
Expand All @@ -671,7 +671,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()) {
Expand All @@ -680,15 +680,15 @@ 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();

if (task._mutex) {
task._lock = std::unique_lock<ReadMutex>(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)) {
Expand Down Expand Up @@ -730,7 +730,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();
Expand All @@ -751,7 +751,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;
Expand Down Expand Up @@ -788,7 +788,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

Expand Down
2 changes: 1 addition & 1 deletion arangod/IResearch/IResearchView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,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() + "'"
);
}

Expand Down
2 changes: 1 addition & 1 deletion arangod/RocksDBEngine/RocksDBEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,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<RocksDBVPackComparator> _vpackCmp;
/// path used by rocksdb (inside _basePath)
std::string _path;
Expand Down
32 changes: 16 additions & 16 deletions arangosh/Backup/BackupFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ arangodb::Result executeDelete(arangodb::httpclient::SimpleHttpClient& client,
}

#ifdef USE_ENTERPRISE
struct TransfereType {
struct TransferType {
enum type {
UPLOAD,
DOWNLOAD
Expand Down Expand Up @@ -488,14 +488,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));
}
Expand Down Expand Up @@ -569,8 +569,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
Expand All @@ -586,8 +586,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);
Expand Down Expand Up @@ -620,23 +620,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
Expand Down Expand Up @@ -864,9 +864,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
}

Expand Down
6 changes: 3 additions & 3 deletions tests/IResearch/IResearchFeature-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,20 +627,20 @@ 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)
}

{
std::shared_ptr<bool> flag(&deallocated1,
[](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);
Expand Down
0