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

Feature/verify client version #67

Merged
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
6 changes: 3 additions & 3 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
build:
name: build
needs: lint
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -139,10 +139,10 @@ jobs:
ASAN_OPTIONS: fast_unwind_on_malloc=1
run: |
pushd build
ctest -j $(($(nproc)/2+1)) --timeout 400 --output-on-failure
ctest -j $(nproc) --timeout 10000 --output-on-failure
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change the number of cores?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Speed up.

Copy link

@Aiee Aiee Dec 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may cause other PRs' actions to fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never happen.

make install
popd
timeout-minutes: 4
timeout-minutes: 10
- name: Build example
run: |
case ${{ matrix.os }} in
Expand Down
21 changes: 14 additions & 7 deletions gen-interface.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@
set -e

NEBULA_THIRDPARYTY_HOME=/opt/vesoft/third-party/2.0
NEBULA_INTERFACE_HOME=src/interface
SYNC_REMOTE_INTERFACE=0

# Parsing options from arguments
while getopts "t:" opt; do
while getopts "t:u" opt; do
case $opt in
t)
NEBULA_THIRDPARYTY_HOME=${OPTARG}
;;
u)
SYNC_REMOTE_INTERFACE=1
;;
\?)
echo "Invalid option: -${OPTARG}" >&2
exit 1
Expand All @@ -25,18 +30,20 @@ while getopts "t:" opt; do
esac
done

for mod in common meta storage graph; do
wget https://raw.githubusercontent.com/vesoft-inc/nebula/master/src/interface/$mod.thrift
done
if [ $SYNC_REMOTE_INTERFACE -eq 1 ]; then
for mod in common meta storage graph; do
wget -P $NEBULA_INTERFACE_HOME https://raw.githubusercontent.com/vesoft-inc/nebula/master/src/interface/$mod.thrift
done
fi

# Strip nebula source
# for mod in common graph; do
# sed -i '/cpp_include/d' $mod.thrift
# sed -i 's/cpp.type = "[^"]\+"//g' $mod.thrift
# done

pushd $NEBULA_INTERFACE_HOME
for mod in common meta storage graph; do
$NEBULA_THIRDPARYTY_HOME/bin/thrift1 --strict --allow-neg-enum-vals --gen "mstch_cpp2:include_prefix=${include_prefix},stack_arguments" -o ./src/interface/ $mod.thrift
$NEBULA_THIRDPARYTY_HOME/bin/thrift1 --strict --allow-neg-enum-vals --gen "mstch_cpp2:include_prefix=${include_prefix},stack_arguments" -o . $mod.thrift
done

rm common.thrift graph.thrift meta.thrift storage.thrift
popd
4 changes: 4 additions & 0 deletions include/common/graph/GraphCpp2Ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ struct PlanDescription;
struct PlanNodeBranchInfo;
struct PlanNodeDescription;
struct ProfilingStats;
struct VerifyClientVersionReq;
struct VerifyClientVersionResp;
} // namespace nebula

namespace apache::thrift {
Expand All @@ -26,5 +28,7 @@ SPECIALIZE_CPP2OPS(nebula::PlanDescription);
SPECIALIZE_CPP2OPS(nebula::PlanNodeBranchInfo);
SPECIALIZE_CPP2OPS(nebula::PlanNodeDescription);
SPECIALIZE_CPP2OPS(nebula::ProfilingStats);
SPECIALIZE_CPP2OPS(nebula::VerifyClientVersionReq);
SPECIALIZE_CPP2OPS(nebula::VerifyClientVersionResp);

} // namespace apache::thrift
10 changes: 10 additions & 0 deletions include/common/graph/Response.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,4 +400,14 @@ struct ExecutionResponse {
std::unique_ptr<std::string> comment{nullptr};
};

struct VerifyClientVersionResp {
ErrorCode errorCode{ErrorCode::SUCCEEDED};
std::unique_ptr<std::string> errorMsg{nullptr};
};

struct VerifyClientVersionReq {
// TODO initialize when build
std::string version{"2.6.0"};
Aiee marked this conversation as resolved.
Show resolved Hide resolved
};

} // namespace nebula
138 changes: 138 additions & 0 deletions include/common/graph/VerifyClientVersionReqOps-inl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
/* Copyright (c) 2021 vesoft inc. All rights reserved.
*
* This source code is licensed under Apache 2.0 License.
*/

#pragma once

#include <thrift/lib/cpp2/GeneratedCodeHelper.h>
#include <thrift/lib/cpp2/gen/module_types_tcc.h>
#include <thrift/lib/cpp2/protocol/ProtocolReaderStructReadState.h>

#include <memory>

#include "common/graph/GraphCpp2Ops.h"
#include "common/graph/Response.h"
#include "common/utils/utils.h"

namespace apache {
namespace thrift {

/**************************************
*
* Ops for class VerifyClientVersionReq
*
*************************************/
namespace detail {

template <>
struct TccStructTraits<nebula::VerifyClientVersionReq> {
static void translateFieldName(MAYBE_UNUSED folly::StringPiece _fname,
MAYBE_UNUSED int16_t& fid,
MAYBE_UNUSED apache::thrift::protocol::TType& _ftype) {
if (false) {
} else if (_fname == "version") {
fid = 1;
_ftype = apache::thrift::protocol::T_STRING;
}
}
};

} // namespace detail

inline constexpr apache::thrift::protocol::TType
Cpp2Ops<::nebula::VerifyClientVersionReq>::thriftType() {
return apache::thrift::protocol::T_STRUCT;
}

template <class Protocol>
uint32_t Cpp2Ops<::nebula::VerifyClientVersionReq>::write(
Protocol* proto, ::nebula::VerifyClientVersionReq const* obj) {
uint32_t xfer = 0;
xfer += proto->writeStructBegin("nebula::VerifyClientVersionReq");
xfer += proto->writeFieldBegin("version", apache::thrift::protocol::T_STRING, 1);
xfer += proto->writeBinary(obj->version);
xfer += proto->writeFieldEnd();
xfer += proto->writeFieldStop();
xfer += proto->writeStructEnd();
return xfer;
}

template <class Protocol>
void Cpp2Ops<::nebula::VerifyClientVersionReq>::read(Protocol* proto,
::nebula::VerifyClientVersionReq* obj) {
apache::thrift::detail::ProtocolReaderStructReadState<Protocol> _readState;

_readState.readStructBegin(proto);

using apache::thrift::TProtocolException;

bool isset_version = false;

if (UNLIKELY(!_readState.advanceToNextField(proto, 0, 1, apache::thrift::protocol::T_STRING))) {
goto _loop;
}
_readField_version : {
proto->readBinary(obj->version);
isset_version = true;
}

_end:
_readState.readStructEnd(proto);

if (!isset_version) {
TProtocolException::throwMissingRequiredField("version", "nebula::VerifyClientVersionReq");
}
return;

_loop:
if (_readState.fieldType == apache::thrift::protocol::T_STOP) {
goto _end;
}
if (proto->kUsesFieldNames()) {
apache::thrift::detail::TccStructTraits<nebula::VerifyClientVersionReq>::translateFieldName(
_readState.fieldName(), _readState.fieldId, _readState.fieldType);
}

switch (_readState.fieldId) {
case 1: {
if (LIKELY(_readState.fieldType == apache::thrift::protocol::T_STRING)) {
goto _readField_version;
} else {
goto _skip;
}
}
default: {
_skip:
proto->skip(_readState.fieldType);
_readState.readFieldEnd(proto);
_readState.readFieldBeginNoInline(proto);
goto _loop;
}
}
}

template <class Protocol>
uint32_t Cpp2Ops<::nebula::VerifyClientVersionReq>::serializedSize(
Protocol const* proto, ::nebula::VerifyClientVersionReq const* obj) {
uint32_t xfer = 0;
xfer += proto->serializedStructSize("nebula::VerifyClientVersionReq");
xfer += proto->serializedFieldSize("version", apache::thrift::protocol::T_STRING, 1);
xfer += proto->serializedSizeBinary(obj->version);
xfer += proto->serializedSizeStop();
return xfer;
}

template <class Protocol>
uint32_t Cpp2Ops<::nebula::VerifyClientVersionReq>::serializedSizeZC(
Protocol const* proto, ::nebula::VerifyClientVersionReq const* obj) {
uint32_t xfer = 0;
xfer += proto->serializedStructSize("nebula::VerifyClientVersionReq");
xfer += proto->serializedFieldSize("version", apache::thrift::protocol::T_STRING, 1);
xfer += proto->serializedSizeZCBinary(obj->version);
xfer += proto->serializedSizeStop();
return xfer;
}

} // namespace thrift
} // namespace apache
Loading