Skip to content
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

Cherry pick v3.0.1 #4027

Merged
merged 3 commits into from
Mar 14, 2022
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
5 changes: 2 additions & 3 deletions src/clients/meta/MetaClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,8 @@ void MetaClient::getResponse(Request req,
// succeeded
pro.setValue(respGen(std::move(resp)));
return;
} else if (code == nebula::cpp2::ErrorCode::E_LEADER_CHANGED) {
} else if (code == nebula::cpp2::ErrorCode::E_LEADER_CHANGED ||
code == nebula::cpp2::ErrorCode::E_MACHINE_NOT_FOUND) {
updateLeader(resp.get_leader());
if (retry < retryLimit) {
evb->runAfterDelay(
Expand All @@ -772,8 +773,6 @@ void MetaClient::getResponse(Request req,
} else if (code == nebula::cpp2::ErrorCode::E_CLIENT_SERVER_INCOMPATIBLE) {
pro.setValue(respGen(std::move(resp)));
return;
} else if (resp.get_code() == nebula::cpp2::ErrorCode::E_MACHINE_NOT_FOUND) {
updateLeader();
}
pro.setValue(this->handleResponse(resp));
}); // then
Expand Down
1 change: 0 additions & 1 deletion src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ nebula_add_subdirectory(http)
nebula_add_subdirectory(stats)
nebula_add_subdirectory(charset)
nebula_add_subdirectory(algorithm)
nebula_add_subdirectory(encryption)
nebula_add_subdirectory(datatypes)
nebula_add_subdirectory(conf)
nebula_add_subdirectory(meta)
Expand Down
133 changes: 0 additions & 133 deletions src/common/base/StringUnorderedMap.h

This file was deleted.

17 changes: 0 additions & 17 deletions src/common/encryption/Base64.cpp

This file was deleted.

23 changes: 0 additions & 23 deletions src/common/encryption/Base64.h

This file was deleted.

9 changes: 0 additions & 9 deletions src/common/encryption/CMakeLists.txt

This file was deleted.

16 changes: 0 additions & 16 deletions src/common/encryption/MD5Utils.cpp

This file was deleted.

20 changes: 0 additions & 20 deletions src/common/encryption/MD5Utils.h

This file was deleted.

1 change: 0 additions & 1 deletion src/common/expression/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
set(expression_test_common_libs
$<TARGET_OBJECTS:parser_obj>
$<TARGET_OBJECTS:expression_obj>
$<TARGET_OBJECTS:encryption_obj>
$<TARGET_OBJECTS:network_obj>
$<TARGET_OBJECTS:fs_obj>
$<TARGET_OBJECTS:stats_obj>
Expand Down
12 changes: 6 additions & 6 deletions src/common/plugin/fulltext/FTUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
#ifndef COMMON_PLUGIN_FULLTEXT_UTILS_H_
#define COMMON_PLUGIN_FULLTEXT_UTILS_H_

#include <proxygen/lib/utils/CryptUtil.h>

#include <boost/algorithm/string/replace.hpp>
#include <iomanip>

#include "common/base/Base.h"
#include "common/base/CommonMacro.h"
#include "common/datatypes/HostAddr.h"
#include "common/encryption/Base64.h"
#include "common/encryption/MD5Utils.h"

#define CURL "/usr/bin/curl"
#define XPUT " -XPUT"
Expand Down Expand Up @@ -141,7 +141,7 @@ struct DocIDTraits {

static std::string column(const std::string& col) {
// normalized column name is 32 bytes
return encryption::MD5Utils::md5Encode(col);
return proxygen::md5Encode(folly::StringPiece(col));
}

static std::string val(const std::string& v) {
Expand All @@ -158,9 +158,9 @@ struct DocIDTraits {
// docId structure : partId(10bytes) + schemaId(10Bytes) +
// columnName(32bytes) + encoded_val(max 344bytes)
// the max length of docId is 512 bytes, still have about 100 bytes reserved
auto encoded = encryption::Base64::encode((item.val.size() > MAX_INDEX_TYPE_LENGTH)
? item.val.substr(0, MAX_INDEX_TYPE_LENGTH)
: item.val);
auto encoded = proxygen::base64Encode(folly::StringPiece(
(item.val.size() > MAX_INDEX_TYPE_LENGTH) ? item.val.substr(0, MAX_INDEX_TYPE_LENGTH)
: item.val));
std::replace(encoded.begin(), encoded.end(), '/', '_');
std::stringstream ss;
ss << id(item.part) << column(item.column) << encoded;
Expand Down
1 change: 0 additions & 1 deletion src/common/plugin/fulltext/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ nebula_add_test(
$<TARGET_OBJECTS:base_obj>
$<TARGET_OBJECTS:network_obj>
$<TARGET_OBJECTS:fs_obj>
$<TARGET_OBJECTS:encryption_obj>
$<TARGET_OBJECTS:process_obj>
$<TARGET_OBJECTS:ft_es_storage_adapter_obj>
$<TARGET_OBJECTS:ft_es_graph_adapter_obj>
Expand Down
1 change: 0 additions & 1 deletion src/common/plugin/fulltext/test/FulltextPluginTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <gtest/gtest.h>

#include "common/base/Base.h"
#include "common/encryption/MD5Utils.h"
#include "common/network/NetworkUtils.h"
#include "common/plugin/fulltext/FTUtils.h"
#include "common/plugin/fulltext/elasticsearch/ESGraphAdapter.h"
Expand Down
1 change: 0 additions & 1 deletion src/common/utils/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ nebula_add_test(
$<TARGET_OBJECTS:datatypes_obj>
$<TARGET_OBJECTS:wkt_wkb_io_obj>
$<TARGET_OBJECTS:process_obj>
$<TARGET_OBJECTS:encryption_obj>
$<TARGET_OBJECTS:ft_es_storage_adapter_obj>
LIBRARIES
${THRIFT_LIBRARIES}
Expand Down
1 change: 0 additions & 1 deletion src/daemons/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ set(common_deps
$<TARGET_OBJECTS:ws_common_obj>
$<TARGET_OBJECTS:process_obj>
$<TARGET_OBJECTS:stats_obj>
$<TARGET_OBJECTS:encryption_obj>
$<TARGET_OBJECTS:fs_obj>
$<TARGET_OBJECTS:time_obj>
$<TARGET_OBJECTS:network_obj>
Expand Down
1 change: 0 additions & 1 deletion src/graph/context/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
SET(CONTEXT_TEST_LIBS
$<TARGET_OBJECTS:charset_obj>
$<TARGET_OBJECTS:datatypes_obj>
$<TARGET_OBJECTS:encryption_obj>
$<TARGET_OBJECTS:expression_obj>
$<TARGET_OBJECTS:function_manager_obj>
$<TARGET_OBJECTS:wkt_wkb_io_obj>
Expand Down
7 changes: 4 additions & 3 deletions src/graph/executor/admin/ChangePasswordExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

#include "graph/executor/admin/ChangePasswordExecutor.h"

#include "common/encryption/MD5Utils.h"
#include <proxygen/lib/utils/CryptUtil.h>

#include "graph/context/QueryContext.h"
#include "graph/planner/plan/Admin.h"

Expand All @@ -22,8 +23,8 @@ folly::Future<Status> ChangePasswordExecutor::changePassword() {
return qctx()
->getMetaClient()
->changePassword(*cpNode->username(),
encryption::MD5Utils::md5Encode(*cpNode->newPassword()),
encryption::MD5Utils::md5Encode(*cpNode->password()))
proxygen::md5Encode(folly::StringPiece(*cpNode->newPassword())),
proxygen::md5Encode(folly::StringPiece(*cpNode->password())))
.via(runner())
.thenValue([this](StatusOr<bool> &&resp) {
SCOPED_TIMER(&execTime_);
Expand Down
5 changes: 3 additions & 2 deletions src/graph/executor/admin/CreateUserExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

#include "graph/executor/admin/CreateUserExecutor.h"

#include "common/encryption/MD5Utils.h"
#include <proxygen/lib/utils/CryptUtil.h>

#include "graph/context/QueryContext.h"
#include "graph/planner/plan/Admin.h"

Expand All @@ -22,7 +23,7 @@ folly::Future<Status> CreateUserExecutor::createUser() {
return qctx()
->getMetaClient()
->createUser(*cuNode->username(),
encryption::MD5Utils::md5Encode(*cuNode->password()),
proxygen::md5Encode(folly::StringPiece(*cuNode->password())),
cuNode->ifNotExist())
.via(runner())
.thenValue([this](StatusOr<bool> resp) {
Expand Down
6 changes: 3 additions & 3 deletions src/graph/executor/admin/UpdateUserExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
*
* This source code is licensed under Apache 2.0 License.
*/

#include "graph/executor/admin/UpdateUserExecutor.h"

#include "common/encryption/MD5Utils.h"
#include <proxygen/lib/utils/CryptUtil.h>

#include "graph/context/QueryContext.h"
#include "graph/planner/plan/Admin.h"

Expand All @@ -21,7 +21,7 @@ folly::Future<Status> UpdateUserExecutor::updateUser() {
auto *uuNode = asNode<UpdateUser>(node());
return qctx()
->getMetaClient()
->alterUser(*uuNode->username(), encryption::MD5Utils::md5Encode(*uuNode->password()))
->alterUser(*uuNode->username(), proxygen::md5Encode(folly::StringPiece(*uuNode->password())))
.via(runner())
.thenValue([this](StatusOr<bool> resp) {
SCOPED_TIMER(&execTime_);
Expand Down
Loading