Skip to content

Commit 4ac72f1

Browse files
Sophie-XieyixingluHarrisChuAiee
authored
cherry pick: 3.0.2 (#4082)
* Support the ARM platform of docker image (#3939) * fix version in docker image and Revert 4068 (#4080) * Revert "enhance docker build, using cache" This reverts commit 9e2bec3. * fix docker version Co-authored-by: Sophie <84560950+Sophie-Xie@users.noreply.github.com> * Revert pr 3942 (#4075) Co-authored-by: Sophie <84560950+Sophie-Xie@users.noreply.github.com> Co-authored-by: Yee <2520865+yixinglu@users.noreply.github.com> Co-authored-by: Harris.Chu <1726587+HarrisChu@users.noreply.github.com> Co-authored-by: Yichen Wang <18348405+Aiee@users.noreply.github.com>
1 parent 2e938c7 commit 4ac72f1

11 files changed

+27
-82
lines changed

.github/workflows/nightly.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ jobs:
8282
with:
8383
context: .
8484
file: ./docker/Dockerfile.${{ matrix.service }}
85-
# platforms: linux/amd64,linux/arm64
86-
platforms: linux/amd64
85+
platforms: linux/amd64,linux/arm64
8786
tags: |
8887
vesoft/nebula-${{ matrix.service }}:nightly
8988
push: true

.github/workflows/rc.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ jobs:
9999
with:
100100
context: .
101101
file: ./docker/Dockerfile.${{ matrix.service }}
102-
# platforms: linux/amd64,linux/arm64
103-
platforms: linux/amd64
102+
platforms: linux/amd64,linux/arm64
104103
tags: |
105104
${{ secrets.HARBOR_REGISTRY }}/vesoft/nebula-${{ matrix.service }}:${{ steps.tagname.outputs.tag }}
106105
${{ secrets.HARBOR_REGISTRY }}/vesoft/nebula-${{ matrix.service }}:${{ steps.tagname.outputs.majorver }}
107106
${{ steps.docker.outputs.tag }}
108107
push: true
109108
build-args: |
110109
BRANCH=${{ steps.tagname.outputs.tag }}
110+
VERSON=${{ steps.tagname.outputs.tagnum }}
111111
112112
test:
113113
name: test

docker/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
FROM vesoft/nebula-dev:centos7 as builder
22

33
ARG BRANCH=master
4+
ARG VERSION=
45

56
COPY . /home/nebula/BUILD
67

docker/Dockerfile.graphd

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
FROM vesoft/nebula-dev:centos7 as builder
22

3-
COPY . /home/nebula/BUILD
4-
53
ARG BRANCH=master
4+
ARG VERSION=
5+
6+
COPY . /home/nebula/BUILD
67

78
RUN cd /home/nebula/BUILD/package \
8-
&& ./package.sh -n OFF -b ${BRANCH} -t RelWithDebInfo -s TRUE
9+
&& [[ -z "${VERSION}" ]] \
10+
&& ./package.sh -n OFF -b ${BRANCH} -t RelWithDebInfo -s TRUE -c OFF -k ON \
11+
|| ./package.sh -n OFF -v ${VERSION} -b ${BRANCH} -t RelWithDebInfo -s TRUE -c OFF -k ON
912

1013
FROM centos:7
1114

docker/Dockerfile.metad

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
FROM vesoft/nebula-dev:centos7 as builder
22

33
ARG BRANCH=master
4+
ARG VERSION=
45

56
COPY . /home/nebula/BUILD
67

78
RUN cd /home/nebula/BUILD/package \
8-
&& ./package.sh -n OFF -b ${BRANCH} -t RelWithDebInfo -s TRUE
9+
&& [[ -z "${VERSION}" ]] \
10+
&& ./package.sh -n OFF -b ${BRANCH} -t RelWithDebInfo -s TRUE -c OFF -k ON \
11+
|| ./package.sh -n OFF -v ${VERSION} -b ${BRANCH} -t RelWithDebInfo -s TRUE -c OFF -k ON
912

1013
FROM centos:7
1114

docker/Dockerfile.storaged

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
FROM vesoft/nebula-dev:centos7 as builder
22

33
ARG BRANCH=master
4+
ARG VERSION=
45

56
COPY . /home/nebula/BUILD
67

78
RUN cd /home/nebula/BUILD/package \
8-
&& ./package.sh -n OFF -b ${BRANCH} -t RelWithDebInfo -s TRUE
9+
&& [[ -z "${VERSION}" ]] \
10+
&& ./package.sh -n OFF -b ${BRANCH} -t RelWithDebInfo -s TRUE -c OFF -k ON \
11+
|| ./package.sh -n OFF -v ${VERSION} -b ${BRANCH} -t RelWithDebInfo -s TRUE -c OFF -k ON
912

1013
FROM centos:7
1114

docker/Dockerfile.tools

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
FROM vesoft/nebula-dev:centos7 as builder
22

33
ARG BRANCH=master
4+
ARG VERSION=
45

56
COPY . /home/nebula/BUILD
67

78
RUN cd /home/nebula/BUILD/package \
8-
&& ./package.sh -n OFF -b ${BRANCH} -t RelWithDebInfo -s TRUE
9+
&& [[ -z "${VERSION}" ]] \
10+
&& ./package.sh -n OFF -b ${BRANCH} -t RelWithDebInfo -s TRUE -c OFF -k ON \
11+
|| ./package.sh -n OFF -v ${VERSION} -b ${BRANCH} -t RelWithDebInfo -s TRUE -c OFF -k ON
912

1013
FROM centos:7
1114

src/clients/meta/MetaClient.cpp

-20
Original file line numberDiff line numberDiff line change
@@ -2601,11 +2601,6 @@ folly::Future<StatusOr<bool>> MetaClient::heartbeat() {
26012601
}
26022602
}
26032603

2604-
// TTL for clientAddrMap
2605-
// If multiple connections are created but do not authenticate, the clientAddrMap_ will keep
2606-
// growing. This is to clear the clientAddrMap_ regularly.
2607-
clearClientAddrMap();
2608-
26092604
// info used in the agent, only set once
26102605
// TOOD(spw): if we could add data path(disk) dynamicly in the future, it should be
26112606
// reported every time it changes
@@ -3802,20 +3797,5 @@ Status MetaClient::verifyVersion() {
38023797
return Status::OK();
38033798
}
38043799

3805-
void MetaClient::clearClientAddrMap() {
3806-
if (clientAddrMap_.size() == 0) {
3807-
return;
3808-
}
3809-
3810-
auto curTimestamp = time::WallClock::fastNowInSec();
3811-
for (auto it = clientAddrMap_.cbegin(); it != clientAddrMap_.cend();) {
3812-
// The clientAddr is expired
3813-
if (it->second < curTimestamp) {
3814-
it = clientAddrMap_.erase(it);
3815-
} else {
3816-
++it;
3817-
}
3818-
}
3819-
}
38203800
} // namespace meta
38213801
} // namespace nebula

src/clients/meta/MetaClient.h

-20
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ using FTIndexMap = std::unordered_map<std::string, cpp2::FTIndex>;
156156

157157
using SessionMap = std::unordered_map<SessionID, cpp2::Session>;
158158

159-
using clientAddrMap = folly::ConcurrentHashMap<HostAddr, int64_t>;
160159
class MetaChangedListener {
161160
public:
162161
virtual ~MetaChangedListener() = default;
@@ -671,10 +670,6 @@ class MetaClient {
671670
return options_.localHost_.toString();
672671
}
673672

674-
clientAddrMap& getClientAddrMap() {
675-
return clientAddrMap_;
676-
}
677-
678673
protected:
679674
// Return true if load succeeded.
680675
bool loadData();
@@ -761,9 +756,6 @@ class MetaClient {
761756

762757
Status verifyVersion();
763758

764-
// Removes expired keys in the clientAddrMap_
765-
void clearClientAddrMap();
766-
767759
private:
768760
std::shared_ptr<folly::IOThreadPoolExecutor> ioThreadPool_;
769761
std::shared_ptr<thrift::ThriftClientManager<cpp2::MetaServiceAsyncClient>> clientsMan_;
@@ -844,18 +836,6 @@ class MetaClient {
844836
NameIndexMap tagNameIndexMap_;
845837
NameIndexMap edgeNameIndexMap_;
846838

847-
// TODO(Aiee) This is a walkaround to address the problem that using a lower version(< v2.6.0)
848-
// client to connect with higher version(>= v3.0.0) Nebula service will cause a crash.
849-
//
850-
// The key here is the host of the client that sends the request, and the value indicates the
851-
// expiration of the key because we don't want to keep the key forever.
852-
//
853-
// The assumption here is that there is ONLY ONE VERSION of the client in the host.
854-
//
855-
// This map will be updated when verifyVersion() is called. Only the clients since v2.6.0 will
856-
// call verifyVersion(), thus we could determine whether the client version is lower than v2.6.0
857-
clientAddrMap clientAddrMap_;
858-
859839
// Global service client
860840
ServiceClientsList serviceClientList_;
861841
FTIndexMap fulltextIndexMap_;

src/graph/service/GraphService.cpp

+4-31
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@
2424
namespace nebula {
2525
namespace graph {
2626

27-
// The default value is 28800 seconds
28-
const int64_t clientAddrTimeout = FLAGS_client_idle_timeout_secs;
29-
3027
Status GraphService::init(std::shared_ptr<folly::IOThreadPoolExecutor> ioExecutor,
3128
const HostAddr& hostAddr) {
3229
auto addrs = network::NetworkUtils::toHosts(FLAGS_meta_server_addrs);
@@ -72,10 +69,9 @@ folly::Future<AuthResponse> GraphService::future_authenticate(const std::string&
7269

7370
auto ctx = std::make_unique<RequestContext<AuthResponse>>();
7471
auto future = ctx->future();
75-
// Check username and password failed
76-
// Check whether the client has called verifyClientVersion()
77-
auto clientAddr = HostAddr(peer->getAddressStr(), peer->getPort());
78-
auto authResult = auth(username, password, clientAddr);
72+
73+
// check username and password failed
74+
auto authResult = auth(username, password);
7975
if (!authResult.ok()) {
8076
ctx->resp().errorCode = ErrorCode::E_BAD_USERNAME_PASSWORD;
8177
ctx->resp().errorMsg.reset(new std::string(authResult.toString()));
@@ -207,24 +203,8 @@ folly::Future<std::string> GraphService::future_executeJsonWithParameter(
207203
});
208204
}
209205

210-
Status GraphService::auth(const std::string& username,
211-
const std::string& password,
212-
const HostAddr& clientIp) {
206+
Status GraphService::auth(const std::string& username, const std::string& password) {
213207
auto metaClient = queryEngine_->metaClient();
214-
215-
// TODO(Aiee) This is a walkaround to address the problem that using a lower version(< v2.6.0)
216-
// client to connect with higher version(>= v3.0.0) Nebula service will cause a crash.
217-
//
218-
// Only the clients since v2.6.0 will call verifyVersion(), thus we could determine whether the
219-
// client version is lower than v2.6.0
220-
auto clientAddrIt = metaClient->getClientAddrMap().find(clientIp);
221-
if (clientAddrIt == metaClient->getClientAddrMap().end()) {
222-
return Status::Error(
223-
folly::sformat("The version of the client sending request from {} is lower than v2.6.0, "
224-
"please update the client.",
225-
clientIp.toString()));
226-
}
227-
228208
// Skip authentication if FLAGS_enable_authorize is false
229209
if (!FLAGS_enable_authorize) {
230210
return Status::OK();
@@ -266,13 +246,6 @@ folly::Future<cpp2::VerifyClientVersionResp> GraphService::future_verifyClientVe
266246
resp.error_code_ref() = nebula::cpp2::ErrorCode::SUCCEEDED;
267247
}
268248

269-
// The client sent request has a version >= v2.6.0, mark the address as valid
270-
auto* peer = getRequestContext()->getPeerAddress();
271-
auto clientAddr = HostAddr(peer->getAddressStr(), peer->getPort());
272-
273-
auto ttlTimestamp = time::WallClock::fastNowInSec() + clientAddrTimeout;
274-
auto clientAddrMap = &metaClient_->getClientAddrMap();
275-
clientAddrMap->insert_or_assign(clientAddr, ttlTimestamp);
276249
return folly::makeFuture<cpp2::VerifyClientVersionResp>(std::move(resp));
277250
}
278251
} // namespace graph

src/graph/service/GraphService.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class GraphService final : public cpp2::GraphServiceSvIf {
5454
std::unique_ptr<meta::MetaClient> metaClient_;
5555

5656
private:
57-
Status auth(const std::string& username, const std::string& password, const HostAddr& clientIp);
57+
Status auth(const std::string& username, const std::string& password);
5858

5959
std::unique_ptr<GraphSessionManager> sessionManager_;
6060
std::unique_ptr<QueryEngine> queryEngine_;

0 commit comments

Comments
 (0)