diff --git a/conf/nebula-graphd.conf.default b/conf/nebula-graphd.conf.default index 871ddd667c3..c1be4f72580 100644 --- a/conf/nebula-graphd.conf.default +++ b/conf/nebula-graphd.conf.default @@ -105,7 +105,7 @@ --memory_tracker_untracked_reserved_memory_mb=50 # enable log memory tracker stats periodically ---memory_tracker_detail_log=true +--memory_tracker_detail_log=false # log memory tacker stats interval in milliseconds --memory_tracker_detail_log_interval_ms=60000 diff --git a/conf/nebula-graphd.conf.production b/conf/nebula-graphd.conf.production index ad28a43cf39..3f1d828d533 100644 --- a/conf/nebula-graphd.conf.production +++ b/conf/nebula-graphd.conf.production @@ -104,7 +104,7 @@ --memory_tracker_untracked_reserved_memory_mb=50 # enable log memory tracker stats periodically ---memory_tracker_detail_log=true +--memory_tracker_detail_log=false # log memory tacker stats interval in milliseconds --memory_tracker_detail_log_interval_ms=60000 diff --git a/conf/nebula-storaged.conf.default b/conf/nebula-storaged.conf.default index 4d102e616a8..7746aef5057 100644 --- a/conf/nebula-storaged.conf.default +++ b/conf/nebula-storaged.conf.default @@ -130,7 +130,7 @@ --memory_tracker_untracked_reserved_memory_mb=50 # enable log memory tracker stats periodically ---memory_tracker_detail_log=true +--memory_tracker_detail_log=false # log memory tacker stats interval in milliseconds --memory_tracker_detail_log_interval_ms=60000 diff --git a/conf/nebula-storaged.conf.production b/conf/nebula-storaged.conf.production index db71776e61f..a5f3f64b92a 100644 --- a/conf/nebula-storaged.conf.production +++ b/conf/nebula-storaged.conf.production @@ -131,7 +131,7 @@ --memory_tracker_untracked_reserved_memory_mb=50 # enable log memory tracker stats periodically ---memory_tracker_detail_log=true +--memory_tracker_detail_log=false # log memory tacker stats interval in milliseconds --memory_tracker_detail_log_interval_ms=60000 diff --git a/src/clients/storage/StorageClientBase-inl.h b/src/clients/storage/StorageClientBase-inl.h index beb8d25d958..86d04934d5f 100644 --- a/src/clients/storage/StorageClientBase-inl.h +++ b/src/clients/storage/StorageClientBase-inl.h @@ -76,6 +76,8 @@ StorageClientBase::collectResponse( folly::EventBase* evb, std::unordered_map requests, RemoteFunc&& remoteFunc) { + memory::MemoryCheckOffGuard offGuard; + std::vector>> respFutures; respFutures.reserve(requests.size()); @@ -155,6 +157,9 @@ template template folly::Future> StorageClientBase::getResponse( folly::EventBase* evb, const HostAddr& host, const Request& request, RemoteFunc&& remoteFunc) { +// memory::MemoryCheckOffGuard offGuard; +// DCHECK(!memory::MemoryTracker::isOn()) << "is on"; + static_assert( folly::isFuture>::value); diff --git a/src/codec/RowReader.cpp b/src/codec/RowReader.cpp index fa5c190dcbf..ff365f0970d 100644 --- a/src/codec/RowReader.cpp +++ b/src/codec/RowReader.cpp @@ -15,7 +15,7 @@ namespace nebula { * class RowReader::Cell * ********************************************/ -Value RowReader::Cell::value() const noexcept { +Value RowReader::Cell::value() const { return iter_->reader_->getValueByIndex(iter_->index_); } @@ -50,7 +50,7 @@ RowReader::Iterator& RowReader::Iterator::operator++() { * ********************************************/ -bool RowReader::resetImpl(meta::SchemaProviderIf const* schema, folly::StringPiece row) noexcept { +bool RowReader::resetImpl(meta::SchemaProviderIf const* schema, folly::StringPiece row) { schema_ = schema; data_ = row; diff --git a/src/codec/RowReader.h b/src/codec/RowReader.h index 91f09896a39..65dfc4a1557 100644 --- a/src/codec/RowReader.h +++ b/src/codec/RowReader.h @@ -25,7 +25,7 @@ class RowReader { friend class Iterator; public: - Value value() const noexcept; + Value value() const; private: const Iterator* iter_; @@ -74,7 +74,7 @@ class RowReader { * @param prop Property name * @return Value Property value */ - virtual Value getValueByName(const std::string& prop) const noexcept = 0; + virtual Value getValueByName(const std::string& prop) const = 0; /** * @brief Get the property value by index in schema @@ -82,33 +82,33 @@ class RowReader { * @param index Index in Schema * @return Value Property value */ - virtual Value getValueByIndex(const int64_t index) const noexcept = 0; + virtual Value getValueByIndex(const int64_t index) const = 0; /** * @brief Get the timestamp in value * * @return int64_t UTC */ - virtual int64_t getTimestamp() const noexcept = 0; + virtual int64_t getTimestamp() const = 0; /** * @brief The row reader version, only 1 or 2 is legal * * @return int32_t Reader version */ - virtual int32_t readerVer() const noexcept = 0; + virtual int32_t readerVer() const = 0; /** * @brief Return the number of bytes used for the header info */ - virtual size_t headerLen() const noexcept = 0; + virtual size_t headerLen() const = 0; /** * @brief Iterator points to the first field * * @return Iterator */ - virtual Iterator begin() const noexcept { + virtual Iterator begin() const { return Iterator(this, 0); } @@ -117,7 +117,7 @@ class RowReader { * * @return const Iterator& */ - virtual const Iterator& end() const noexcept { + virtual const Iterator& end() const { return endIter_; } @@ -126,7 +126,7 @@ class RowReader { * * @return SchemaVer Schema version */ - virtual SchemaVer schemaVer() const noexcept { + virtual SchemaVer schemaVer() const { return schema_->getVersion(); } @@ -135,7 +135,7 @@ class RowReader { * * @return size_t */ - virtual size_t numFields() const noexcept { + virtual size_t numFields() const { return schema_->getNumFields(); } @@ -170,7 +170,7 @@ class RowReader { * @param row * @return Whether reset succeed */ - virtual bool resetImpl(meta::SchemaProviderIf const* schema, folly::StringPiece row) noexcept; + virtual bool resetImpl(meta::SchemaProviderIf const* schema, folly::StringPiece row); private: Iterator endIter_; diff --git a/src/codec/RowReaderV1.cpp b/src/codec/RowReaderV1.cpp index a8f9023c258..91973a28d90 100644 --- a/src/codec/RowReaderV1.cpp +++ b/src/codec/RowReaderV1.cpp @@ -27,7 +27,7 @@ using nebula::cpp2::PropertyType; * class RowReaderV1 * ********************************************/ -bool RowReaderV1::resetImpl(meta::SchemaProviderIf const* schema, folly::StringPiece row) noexcept { +bool RowReaderV1::resetImpl(meta::SchemaProviderIf const* schema, folly::StringPiece row) { RowReader::resetImpl(schema, row); DCHECK(schema_ != nullptr) << "A schema must be provided"; @@ -95,7 +95,7 @@ bool RowReaderV1::processHeader(folly::StringPiece row) { return true; } -int64_t RowReaderV1::skipToNext(int64_t index, int64_t offset) const noexcept { +int64_t RowReaderV1::skipToNext(int64_t index, int64_t offset) const { const PropertyType& vType = getSchema()->getFieldType(index); if (offsets_[index + 1] >= 0) { return offsets_[index + 1]; @@ -160,7 +160,7 @@ int64_t RowReaderV1::skipToNext(int64_t index, int64_t offset) const noexcept { return offset; } -int64_t RowReaderV1::skipToField(int64_t index) const noexcept { +int64_t RowReaderV1::skipToField(int64_t index) const { DCHECK_GE(index, 0); if (index >= static_cast(schema_->getNumFields())) { // Index is out of range @@ -191,12 +191,12 @@ int64_t RowReaderV1::skipToField(int64_t index) const noexcept { * Get the property value * ***********************************************************/ -Value RowReaderV1::getValueByName(const std::string& prop) const noexcept { +Value RowReaderV1::getValueByName(const std::string& prop) const { int64_t index = getSchema()->getFieldIndex(prop); return getValueByIndex(index); } -Value RowReaderV1::getValueByIndex(const int64_t index) const noexcept { +Value RowReaderV1::getValueByIndex(const int64_t index) const { if (index < 0 || static_cast(index) >= schema_->getNumFields()) { return Value(NullType::UNKNOWN_PROP); } @@ -224,7 +224,7 @@ Value RowReaderV1::getValueByIndex(const int64_t index) const noexcept { } } -int64_t RowReaderV1::getTimestamp() const noexcept { +int64_t RowReaderV1::getTimestamp() const { return std::numeric_limits::max(); } @@ -233,7 +233,7 @@ int64_t RowReaderV1::getTimestamp() const noexcept { * Get the property value from the serialized binary string * ***********************************************************/ -Value RowReaderV1::getBool(int64_t index) const noexcept { +Value RowReaderV1::getBool(int64_t index) const { RR_GET_OFFSET() Value v; switch (getSchema()->getFieldType(index)) { @@ -272,7 +272,7 @@ Value RowReaderV1::getBool(int64_t index) const noexcept { return v; } -Value RowReaderV1::getInt(int64_t index) const noexcept { +Value RowReaderV1::getInt(int64_t index) const { RR_GET_OFFSET() Value v; switch (getSchema()->getFieldType(index)) { @@ -296,7 +296,7 @@ Value RowReaderV1::getInt(int64_t index) const noexcept { return v; } -Value RowReaderV1::getFloat(int64_t index) const noexcept { +Value RowReaderV1::getFloat(int64_t index) const { RR_GET_OFFSET() Value v; switch (getSchema()->getFieldType(index)) { @@ -334,7 +334,7 @@ Value RowReaderV1::getFloat(int64_t index) const noexcept { return v; } -Value RowReaderV1::getDouble(int64_t index) const noexcept { +Value RowReaderV1::getDouble(int64_t index) const { RR_GET_OFFSET() Value v; switch (getSchema()->getFieldType(index)) { @@ -368,7 +368,7 @@ Value RowReaderV1::getDouble(int64_t index) const noexcept { return v; } -Value RowReaderV1::getString(int64_t index) const noexcept { +Value RowReaderV1::getString(int64_t index) const { RR_GET_OFFSET() Value v; switch (getSchema()->getFieldType(index)) { @@ -391,7 +391,7 @@ Value RowReaderV1::getString(int64_t index) const noexcept { return v; } -Value RowReaderV1::getInt64(int64_t index) const noexcept { +Value RowReaderV1::getInt64(int64_t index) const { RR_GET_OFFSET() Value v; int64_t val; @@ -425,7 +425,7 @@ Value RowReaderV1::getInt64(int64_t index) const noexcept { return v; } -Value RowReaderV1::getVid(int64_t index) const noexcept { +Value RowReaderV1::getVid(int64_t index) const { auto fieldType = getSchema()->getFieldType(index); if (fieldType == PropertyType::INT64 || fieldType == PropertyType::VID) { // Since 2.0, vid has been defined as a binary array. So we need to convert @@ -445,7 +445,7 @@ Value RowReaderV1::getVid(int64_t index) const noexcept { * Low-level functions to read from the bytes * ***********************************************************/ -int32_t RowReaderV1::readInteger(int64_t offset, int64_t& v) const noexcept { +int32_t RowReaderV1::readInteger(int64_t offset, int64_t& v) const { const uint8_t* start = reinterpret_cast(&(buffer_[offset])); folly::ByteRange range(start, buffer_.size() - offset); @@ -457,7 +457,7 @@ int32_t RowReaderV1::readInteger(int64_t offset, int64_t& v) const noexcept { return range.begin() - start; } -int32_t RowReaderV1::readFloat(int64_t offset, float& v) const noexcept { +int32_t RowReaderV1::readFloat(int64_t offset, float& v) const { if (offset + sizeof(float) > buffer_.size()) { return -1; } @@ -467,7 +467,7 @@ int32_t RowReaderV1::readFloat(int64_t offset, float& v) const noexcept { return sizeof(float); } -int32_t RowReaderV1::readDouble(int64_t offset, double& v) const noexcept { +int32_t RowReaderV1::readDouble(int64_t offset, double& v) const { if (offset + sizeof(double) > buffer_.size()) { return -1; } @@ -477,7 +477,7 @@ int32_t RowReaderV1::readDouble(int64_t offset, double& v) const noexcept { return sizeof(double); } -int32_t RowReaderV1::readString(int64_t offset, folly::StringPiece& v) const noexcept { +int32_t RowReaderV1::readString(int64_t offset, folly::StringPiece& v) const { int64_t strLen = 0; int32_t intLen = readInteger(offset, strLen); CHECK_GT(intLen, 0) << "Invalid string length"; @@ -489,7 +489,7 @@ int32_t RowReaderV1::readString(int64_t offset, folly::StringPiece& v) const noe return intLen + strLen; } -int32_t RowReaderV1::readInt64(int64_t offset, int64_t& v) const noexcept { +int32_t RowReaderV1::readInt64(int64_t offset, int64_t& v) const { if (offset + sizeof(int64_t) > buffer_.size()) { return -1; } @@ -500,7 +500,7 @@ int32_t RowReaderV1::readInt64(int64_t offset, int64_t& v) const noexcept { return sizeof(int64_t); } -int32_t RowReaderV1::readVid(int64_t offset, int64_t& v) const noexcept { +int32_t RowReaderV1::readVid(int64_t offset, int64_t& v) const { return readInt64(offset, v); } diff --git a/src/codec/RowReaderV1.h b/src/codec/RowReaderV1.h index 473e338fdbe..86f42d13e20 100644 --- a/src/codec/RowReaderV1.h +++ b/src/codec/RowReaderV1.h @@ -27,20 +27,20 @@ class RowReaderV1 : public RowReader { public: ~RowReaderV1() = default; - Value getValueByName(const std::string& prop) const noexcept override; - Value getValueByIndex(const int64_t index) const noexcept override; - int64_t getTimestamp() const noexcept override; + Value getValueByName(const std::string& prop) const override; + Value getValueByIndex(const int64_t index) const override; + int64_t getTimestamp() const override; - int32_t readerVer() const noexcept override { + int32_t readerVer() const override { return 1; } - size_t headerLen() const noexcept override { + size_t headerLen() const override { return headerLen_; } protected: - bool resetImpl(meta::SchemaProviderIf const* schema, folly::StringPiece row) noexcept override; + bool resetImpl(meta::SchemaProviderIf const* schema, folly::StringPiece row) override; private: int32_t headerLen_ = 0; @@ -72,31 +72,31 @@ class RowReaderV1 : public RowReader { // When succeeded, the method returns the offset pointing to the // next field // When failed, the method returns a negative number - int64_t skipToNext(int64_t index, int64_t offset) const noexcept; + int64_t skipToNext(int64_t index, int64_t offset) const; // Skip to the {index}Th field // The method returns the offset of the field // It returns a negative number when the data corrupts - int64_t skipToField(int64_t index) const noexcept; + int64_t skipToField(int64_t index) const; // Following methods assume the parameters index are valid // When succeeded, offset will advance - Value getBool(int64_t index) const noexcept; - Value getInt(int64_t index) const noexcept; - Value getFloat(int64_t index) const noexcept; - Value getDouble(int64_t index) const noexcept; - Value getString(int64_t index) const noexcept; - Value getInt64(int64_t index) const noexcept; - Value getVid(int64_t index) const noexcept; + Value getBool(int64_t index) const; + Value getInt(int64_t index) const; + Value getFloat(int64_t index) const; + Value getDouble(int64_t index) const; + Value getString(int64_t index) const; + Value getInt64(int64_t index) const; + Value getVid(int64_t index) const; // The following methods all return the number of bytes read // A negative number will be returned if an error occurs - int32_t readInteger(int64_t offset, int64_t& v) const noexcept; - int32_t readFloat(int64_t offset, float& v) const noexcept; - int32_t readDouble(int64_t offset, double& v) const noexcept; - int32_t readString(int64_t offset, folly::StringPiece& v) const noexcept; - int32_t readInt64(int64_t offset, int64_t& v) const noexcept; - int32_t readVid(int64_t offset, int64_t& v) const noexcept; + int32_t readInteger(int64_t offset, int64_t& v) const; + int32_t readFloat(int64_t offset, float& v) const; + int32_t readDouble(int64_t offset, double& v) const; + int32_t readString(int64_t offset, folly::StringPiece& v) const; + int32_t readInt64(int64_t offset, int64_t& v) const; + int32_t readVid(int64_t offset, int64_t& v) const; }; } // namespace nebula diff --git a/src/codec/RowReaderV2.cpp b/src/codec/RowReaderV2.cpp index 384a171494f..811f7360586 100644 --- a/src/codec/RowReaderV2.cpp +++ b/src/codec/RowReaderV2.cpp @@ -9,7 +9,7 @@ namespace nebula { using nebula::cpp2::PropertyType; -bool RowReaderV2::resetImpl(meta::SchemaProviderIf const* schema, folly::StringPiece row) noexcept { +bool RowReaderV2::resetImpl(meta::SchemaProviderIf const* schema, folly::StringPiece row) { RowReader::resetImpl(schema, row); DCHECK(!!schema_); @@ -45,12 +45,12 @@ bool RowReaderV2::isNull(size_t pos) const { return flag != 0; } -Value RowReaderV2::getValueByName(const std::string& prop) const noexcept { +Value RowReaderV2::getValueByName(const std::string& prop) const { int64_t index = schema_->getFieldIndex(prop); return getValueByIndex(index); } -Value RowReaderV2::getValueByIndex(const int64_t index) const noexcept { +Value RowReaderV2::getValueByIndex(const int64_t index) const { if (index < 0 || static_cast(index) >= schema_->getNumFields()) { return Value(NullType::UNKNOWN_PROP); } @@ -212,7 +212,7 @@ Value RowReaderV2::getValueByIndex(const int64_t index) const noexcept { return Value::kNullBadType; } -int64_t RowReaderV2::getTimestamp() const noexcept { +int64_t RowReaderV2::getTimestamp() const { return *reinterpret_cast(data_.begin() + (data_.size() - sizeof(int64_t))); } diff --git a/src/codec/RowReaderV2.h b/src/codec/RowReaderV2.h index 9bad0bf7f05..18dca90dee1 100644 --- a/src/codec/RowReaderV2.h +++ b/src/codec/RowReaderV2.h @@ -28,20 +28,20 @@ class RowReaderV2 : public RowReader { public: ~RowReaderV2() override = default; - Value getValueByName(const std::string& prop) const noexcept override; - Value getValueByIndex(const int64_t index) const noexcept override; - int64_t getTimestamp() const noexcept override; + Value getValueByName(const std::string& prop) const override; + Value getValueByIndex(const int64_t index) const override; + int64_t getTimestamp() const override; - int32_t readerVer() const noexcept override { + int32_t readerVer() const override { return 2; } - size_t headerLen() const noexcept override { + size_t headerLen() const override { return headerLen_; } protected: - bool resetImpl(meta::SchemaProviderIf const* schema, folly::StringPiece row) noexcept override; + bool resetImpl(meta::SchemaProviderIf const* schema, folly::StringPiece row) override; private: size_t headerLen_; diff --git a/src/codec/RowReaderWrapper.cpp b/src/codec/RowReaderWrapper.cpp index 5a100fabcfb..0a1b818c066 100644 --- a/src/codec/RowReaderWrapper.cpp +++ b/src/codec/RowReaderWrapper.cpp @@ -97,7 +97,7 @@ RowReaderWrapper::RowReaderWrapper(const meta::SchemaProviderIf* schema, bool RowReaderWrapper::reset(meta::SchemaProviderIf const* schema, folly::StringPiece row, - int32_t readerVer) noexcept { + int32_t readerVer) { CHECK_NOTNULL(schema); readerVer_ = readerVer; if (readerVer_ == 1) { @@ -115,8 +115,7 @@ bool RowReaderWrapper::reset(meta::SchemaProviderIf const* schema, } } -bool RowReaderWrapper::reset(meta::SchemaProviderIf const* schema, - folly::StringPiece row) noexcept { +bool RowReaderWrapper::reset(meta::SchemaProviderIf const* schema, folly::StringPiece row) { currReader_ = nullptr; if (schema == nullptr) { return false; @@ -132,7 +131,7 @@ bool RowReaderWrapper::reset(meta::SchemaProviderIf const* schema, bool RowReaderWrapper::reset( const std::vector>& schemas, - folly::StringPiece row) noexcept { + folly::StringPiece row) { currReader_ = nullptr; SchemaVer schemaVer; int32_t readerVer; diff --git a/src/codec/RowReaderWrapper.h b/src/codec/RowReaderWrapper.h index a619d6d3490..46a9750c171 100644 --- a/src/codec/RowReaderWrapper.h +++ b/src/codec/RowReaderWrapper.h @@ -137,9 +137,7 @@ class RowReaderWrapper : public RowReader { * @param readVer * @return Whether reset succeed */ - bool reset(meta::SchemaProviderIf const* schema, - folly::StringPiece row, - int32_t readVer) noexcept; + bool reset(meta::SchemaProviderIf const* schema, folly::StringPiece row, int32_t readVer); /** * @brief Reset current row reader wrapper to of given schema and data @@ -148,7 +146,7 @@ class RowReaderWrapper : public RowReader { * @param row * @return Whether reset succeed */ - bool reset(meta::SchemaProviderIf const* schema, folly::StringPiece row) noexcept; + bool reset(meta::SchemaProviderIf const* schema, folly::StringPiece row); /** * @brief Reset current row reader wrapper of given schemas and data, the schemas are stored in @@ -159,50 +157,50 @@ class RowReaderWrapper : public RowReader { * @return Whether reset succeed */ bool reset(const std::vector>& schemas, - folly::StringPiece row) noexcept; + folly::StringPiece row); - Value getValueByName(const std::string& prop) const noexcept override { + Value getValueByName(const std::string& prop) const override { DCHECK(!!currReader_); return currReader_->getValueByName(prop); } - Value getValueByIndex(const int64_t index) const noexcept override { + Value getValueByIndex(const int64_t index) const override { DCHECK(!!currReader_); return currReader_->getValueByIndex(index); } - int64_t getTimestamp() const noexcept override { + int64_t getTimestamp() const override { DCHECK(!!currReader_); return currReader_->getTimestamp(); } - int32_t readerVer() const noexcept override { + int32_t readerVer() const override { DCHECK(!!currReader_); return currReader_->readerVer(); } // Return the number of bytes used for the header info - size_t headerLen() const noexcept override { + size_t headerLen() const override { DCHECK(!!currReader_); return currReader_->headerLen(); } - Iterator begin() const noexcept override { + Iterator begin() const override { DCHECK(!!currReader_); return currReader_->begin(); } - const Iterator& end() const noexcept override { + const Iterator& end() const override { DCHECK(!!currReader_); return currReader_->end(); } - SchemaVer schemaVer() const noexcept override { + SchemaVer schemaVer() const override { DCHECK(!!currReader_); return currReader_->schemaVer(); } - size_t numFields() const noexcept override { + size_t numFields() const override { DCHECK(!!currReader_); return currReader_->numFields(); } @@ -229,56 +227,56 @@ class RowReaderWrapper : public RowReader { /** * @brief Return whether wrapper points to a valid data */ - operator bool() const noexcept { + operator bool() const { return operator!=(nullptr); } /** * @brief Return whether wrapper points to a valid data */ - bool operator==(std::nullptr_t) const noexcept { + bool operator==(std::nullptr_t) const { return !operator!=(nullptr); } /** * @brief Return whether wrapper points to a valid data */ - bool operator!=(std::nullptr_t) const noexcept { + bool operator!=(std::nullptr_t) const { return currReader_ != nullptr; } /** * @brief Return this row reader wrapper */ - RowReaderWrapper* operator->() const noexcept { + RowReaderWrapper* operator->() const { return get(); } /** * @brief Return this row reader wrapper */ - RowReaderWrapper* get() const noexcept { + RowReaderWrapper* get() const { return const_cast(this); } /** * @brief Return this row reader wrapper */ - RowReaderWrapper* get() noexcept { + RowReaderWrapper* get() { return this; } /** * @brief Return this row reader wrapper */ - RowReaderWrapper& operator*() const noexcept { + RowReaderWrapper& operator*() const { return *get(); } /** * @brief Reset to an empty row reader */ - void reset() noexcept { + void reset() { currReader_ = nullptr; } diff --git a/src/codec/RowWriterV2.cpp b/src/codec/RowWriterV2.cpp index 17bc7c3a6d4..5fcd457f30a 100644 --- a/src/codec/RowWriterV2.cpp +++ b/src/codec/RowWriterV2.cpp @@ -147,7 +147,7 @@ RowWriterV2::RowWriterV2(RowReader& reader) : RowWriterV2(reader.getSchema()) { } } -void RowWriterV2::processV2EncodedStr() noexcept { +void RowWriterV2::processV2EncodedStr() { CHECK_EQ(0x08, buf_[0] & 0x18); int32_t verBytes = buf_[0] & 0x07; SchemaVer ver = 0; @@ -172,21 +172,21 @@ void RowWriterV2::processV2EncodedStr() noexcept { isSet_.resize(schema_->getNumFields(), true); } -void RowWriterV2::setNullBit(ssize_t pos) noexcept { +void RowWriterV2::setNullBit(ssize_t pos) { static const uint8_t orBits[] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01}; size_t offset = headerLen_ + (pos >> 3); buf_[offset] = buf_[offset] | orBits[pos & 0x0000000000000007L]; } -void RowWriterV2::clearNullBit(ssize_t pos) noexcept { +void RowWriterV2::clearNullBit(ssize_t pos) { static const uint8_t andBits[] = {0x7F, 0xBF, 0xDF, 0xEF, 0xF7, 0xFB, 0xFD, 0xFE}; size_t offset = headerLen_ + (pos >> 3); buf_[offset] = buf_[offset] & andBits[pos & 0x0000000000000007L]; } -bool RowWriterV2::checkNullBit(ssize_t pos) const noexcept { +bool RowWriterV2::checkNullBit(ssize_t pos) const { static const uint8_t bits[] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01}; size_t offset = headerLen_ + (pos >> 3); @@ -194,7 +194,7 @@ bool RowWriterV2::checkNullBit(ssize_t pos) const noexcept { return flag != 0; } -WriteResult RowWriterV2::setValue(ssize_t index, const Value& val) noexcept { +WriteResult RowWriterV2::setValue(ssize_t index, const Value& val) { CHECK(!finished_) << "You have called finish()"; if (index < 0 || static_cast(index) >= schema_->getNumFields()) { return WriteResult::UNKNOWN_FIELD; @@ -226,13 +226,13 @@ WriteResult RowWriterV2::setValue(ssize_t index, const Value& val) noexcept { } } -WriteResult RowWriterV2::setValue(const std::string& name, const Value& val) noexcept { +WriteResult RowWriterV2::setValue(const std::string& name, const Value& val) { CHECK(!finished_) << "You have called finish()"; int64_t index = schema_->getFieldIndex(name); return setValue(index, val); } -WriteResult RowWriterV2::setNull(ssize_t index) noexcept { +WriteResult RowWriterV2::setNull(ssize_t index) { CHECK(!finished_) << "You have called finish()"; if (index < 0 || static_cast(index) >= schema_->getNumFields()) { return WriteResult::UNKNOWN_FIELD; @@ -249,13 +249,13 @@ WriteResult RowWriterV2::setNull(ssize_t index) noexcept { return WriteResult::SUCCEEDED; } -WriteResult RowWriterV2::setNull(const std::string& name) noexcept { +WriteResult RowWriterV2::setNull(const std::string& name) { CHECK(!finished_) << "You have called finish()"; int64_t index = schema_->getFieldIndex(name); return setNull(index); } -WriteResult RowWriterV2::write(ssize_t index, bool v) noexcept { +WriteResult RowWriterV2::write(ssize_t index, bool v) { auto field = schema_->field(index); auto offset = headerLen_ + numNullBytes_ + field->offset(); switch (field->type()) { @@ -285,7 +285,7 @@ WriteResult RowWriterV2::write(ssize_t index, bool v) noexcept { return WriteResult::SUCCEEDED; } -WriteResult RowWriterV2::write(ssize_t index, float v) noexcept { +WriteResult RowWriterV2::write(ssize_t index, float v) { auto field = schema_->field(index); auto offset = headerLen_ + numNullBytes_ + field->offset(); switch (field->type()) { @@ -342,7 +342,7 @@ WriteResult RowWriterV2::write(ssize_t index, float v) noexcept { return WriteResult::SUCCEEDED; } -WriteResult RowWriterV2::write(ssize_t index, double v) noexcept { +WriteResult RowWriterV2::write(ssize_t index, double v) { auto field = schema_->field(index); auto offset = headerLen_ + numNullBytes_ + field->offset(); switch (field->type()) { @@ -401,11 +401,11 @@ WriteResult RowWriterV2::write(ssize_t index, double v) noexcept { return WriteResult::SUCCEEDED; } -WriteResult RowWriterV2::write(ssize_t index, uint8_t v) noexcept { +WriteResult RowWriterV2::write(ssize_t index, uint8_t v) { return write(index, static_cast(v)); } -WriteResult RowWriterV2::write(ssize_t index, int8_t v) noexcept { +WriteResult RowWriterV2::write(ssize_t index, int8_t v) { auto field = schema_->field(index); auto offset = headerLen_ + numNullBytes_ + field->offset(); switch (field->type()) { @@ -452,11 +452,11 @@ WriteResult RowWriterV2::write(ssize_t index, int8_t v) noexcept { return WriteResult::SUCCEEDED; } -WriteResult RowWriterV2::write(ssize_t index, uint16_t v) noexcept { +WriteResult RowWriterV2::write(ssize_t index, uint16_t v) { return write(index, static_cast(v)); } -WriteResult RowWriterV2::write(ssize_t index, int16_t v) noexcept { +WriteResult RowWriterV2::write(ssize_t index, int16_t v) { auto field = schema_->field(index); auto offset = headerLen_ + numNullBytes_ + field->offset(); switch (field->type()) { @@ -506,11 +506,11 @@ WriteResult RowWriterV2::write(ssize_t index, int16_t v) noexcept { return WriteResult::SUCCEEDED; } -WriteResult RowWriterV2::write(ssize_t index, uint32_t v) noexcept { +WriteResult RowWriterV2::write(ssize_t index, uint32_t v) { return write(index, static_cast(v)); } -WriteResult RowWriterV2::write(ssize_t index, int32_t v) noexcept { +WriteResult RowWriterV2::write(ssize_t index, int32_t v) { auto field = schema_->field(index); auto offset = headerLen_ + numNullBytes_ + field->offset(); switch (field->type()) { @@ -573,11 +573,11 @@ WriteResult RowWriterV2::write(ssize_t index, int32_t v) noexcept { return WriteResult::SUCCEEDED; } -WriteResult RowWriterV2::write(ssize_t index, uint64_t v) noexcept { +WriteResult RowWriterV2::write(ssize_t index, uint64_t v) { return write(index, static_cast(v)); } -WriteResult RowWriterV2::write(ssize_t index, int64_t v) noexcept { +WriteResult RowWriterV2::write(ssize_t index, int64_t v) { auto field = schema_->field(index); auto offset = headerLen_ + numNullBytes_ + field->offset(); switch (field->type()) { @@ -643,15 +643,15 @@ WriteResult RowWriterV2::write(ssize_t index, int64_t v) noexcept { return WriteResult::SUCCEEDED; } -WriteResult RowWriterV2::write(ssize_t index, const std::string& v) noexcept { +WriteResult RowWriterV2::write(ssize_t index, const std::string& v) { return write(index, folly::StringPiece(v)); } -WriteResult RowWriterV2::write(ssize_t index, const char* v) noexcept { +WriteResult RowWriterV2::write(ssize_t index, const char* v) { return write(index, folly::StringPiece(v)); } -WriteResult RowWriterV2::write(ssize_t index, folly::StringPiece v) noexcept { +WriteResult RowWriterV2::write(ssize_t index, folly::StringPiece v) { auto field = schema_->field(index); auto offset = headerLen_ + numNullBytes_ + field->offset(); switch (field->type()) { @@ -701,7 +701,7 @@ WriteResult RowWriterV2::write(ssize_t index, folly::StringPiece v) noexcept { return WriteResult::SUCCEEDED; } -WriteResult RowWriterV2::write(ssize_t index, const Date& v) noexcept { +WriteResult RowWriterV2::write(ssize_t index, const Date& v) { auto field = schema_->field(index); auto offset = headerLen_ + numNullBytes_ + field->offset(); switch (field->type()) { @@ -720,7 +720,7 @@ WriteResult RowWriterV2::write(ssize_t index, const Date& v) noexcept { return WriteResult::SUCCEEDED; } -WriteResult RowWriterV2::write(ssize_t index, const Time& v) noexcept { +WriteResult RowWriterV2::write(ssize_t index, const Time& v) { auto field = schema_->field(index); auto offset = headerLen_ + numNullBytes_ + field->offset(); switch (field->type()) { @@ -742,7 +742,7 @@ WriteResult RowWriterV2::write(ssize_t index, const Time& v) noexcept { return WriteResult::SUCCEEDED; } -WriteResult RowWriterV2::write(ssize_t index, const DateTime& v) noexcept { +WriteResult RowWriterV2::write(ssize_t index, const DateTime& v) { auto field = schema_->field(index); auto offset = headerLen_ + numNullBytes_ + field->offset(); int16_t year = v.year; @@ -774,7 +774,7 @@ WriteResult RowWriterV2::write(ssize_t index, const DateTime& v) noexcept { return WriteResult::SUCCEEDED; } -WriteResult RowWriterV2::write(ssize_t index, const Duration& v) noexcept { +WriteResult RowWriterV2::write(ssize_t index, const Duration& v) { auto field = schema_->field(index); auto offset = headerLen_ + numNullBytes_ + field->offset(); switch (field->type()) { @@ -797,7 +797,7 @@ WriteResult RowWriterV2::write(ssize_t index, const Duration& v) noexcept { return WriteResult::SUCCEEDED; } -WriteResult RowWriterV2::write(ssize_t index, const Geography& v) noexcept { +WriteResult RowWriterV2::write(ssize_t index, const Geography& v) { auto field = schema_->field(index); auto geoShape = field->geoShape(); if (geoShape != meta::cpp2::GeoShape::ANY && @@ -808,7 +808,7 @@ WriteResult RowWriterV2::write(ssize_t index, const Geography& v) noexcept { return write(index, folly::StringPiece(wkb)); } -WriteResult RowWriterV2::checkUnsetFields() noexcept { +WriteResult RowWriterV2::checkUnsetFields() { DefaultValueContext expCtx; for (size_t i = 0; i < schema_->getNumFields(); i++) { if (!isSet_[i]) { @@ -875,7 +875,7 @@ WriteResult RowWriterV2::checkUnsetFields() noexcept { return WriteResult::SUCCEEDED; } -std::string RowWriterV2::processOutOfSpace() noexcept { +std::string RowWriterV2::processOutOfSpace() { std::string temp; // Reserve enough space to avoid memory re-allocation temp.reserve(headerLen_ + numNullBytes_ + schema_->size() + approxStrLen_ + sizeof(int64_t)); @@ -919,7 +919,7 @@ std::string RowWriterV2::processOutOfSpace() noexcept { return temp; } -WriteResult RowWriterV2::finish() noexcept { +WriteResult RowWriterV2::finish() { CHECK(!finished_) << "You have called finish()"; // First to check whether all fields are set. If not, to check whether diff --git a/src/codec/RowWriterV2.h b/src/codec/RowWriterV2.h index 6b79c00a0ca..6dca13bbafa 100644 --- a/src/codec/RowWriterV2.h +++ b/src/codec/RowWriterV2.h @@ -118,7 +118,7 @@ class RowWriterV2 { * * @return const std::string& */ - const std::string& getEncodedStr() const noexcept { + const std::string& getEncodedStr() const { CHECK(finished_) << "You need to call finish() first"; return buf_; } @@ -128,7 +128,7 @@ class RowWriterV2 { * * @return std::string */ - std::string moveEncodedStr() noexcept { + std::string moveEncodedStr() { CHECK(finished_) << "You need to call finish() first"; return std::move(buf_); } @@ -138,7 +138,7 @@ class RowWriterV2 { * * @return WriteResult Whether encode succeed */ - WriteResult finish() noexcept; + WriteResult finish(); // Data write /** @@ -150,7 +150,7 @@ class RowWriterV2 { * @return WriteResult */ template - WriteResult set(size_t index, T&& v) noexcept { + WriteResult set(size_t index, T&& v) { CHECK(!finished_) << "You have called finish()"; if (index >= schema_->getNumFields()) { return WriteResult::UNKNOWN_FIELD; @@ -168,7 +168,7 @@ class RowWriterV2 { * @return WriteResult */ template - WriteResult set(const std::string& name, T&& v) noexcept { + WriteResult set(const std::string& name, T&& v) { CHECK(!finished_) << "You have called finish()"; int64_t index = schema_->getFieldIndex(name); if (index >= 0) { @@ -185,7 +185,7 @@ class RowWriterV2 { * @param val * @return WriteResult */ - WriteResult setValue(ssize_t index, const Value& val) noexcept; + WriteResult setValue(ssize_t index, const Value& val); /** * @brief Set the value by index @@ -194,7 +194,7 @@ class RowWriterV2 { * @param val * @return WriteResult */ - WriteResult setValue(const std::string& name, const Value& val) noexcept; + WriteResult setValue(const std::string& name, const Value& val); /** * @brief Set null by index @@ -202,7 +202,7 @@ class RowWriterV2 { * @param index * @return WriteResult */ - WriteResult setNull(ssize_t index) noexcept; + WriteResult setNull(ssize_t index); /** * @brief Set null by property name @@ -210,7 +210,7 @@ class RowWriterV2 { * @param name * @return WriteResult */ - WriteResult setNull(const std::string& name) noexcept; + WriteResult setNull(const std::string& name); private: const meta::SchemaProviderIf* schema_; @@ -229,40 +229,40 @@ class RowWriterV2 { bool outOfSpaceStr_; std::vector strList_; - WriteResult checkUnsetFields() noexcept; - std::string processOutOfSpace() noexcept; + WriteResult checkUnsetFields(); + std::string processOutOfSpace(); - void processV2EncodedStr() noexcept; + void processV2EncodedStr(); - void setNullBit(ssize_t pos) noexcept; - void clearNullBit(ssize_t pos) noexcept; + void setNullBit(ssize_t pos); + void clearNullBit(ssize_t pos); // Return true if the flag at the given position is NULL; // otherwise, return false - bool checkNullBit(ssize_t pos) const noexcept; - - WriteResult write(ssize_t index, bool v) noexcept; - WriteResult write(ssize_t index, float v) noexcept; - WriteResult write(ssize_t index, double v) noexcept; - - WriteResult write(ssize_t index, int8_t v) noexcept; - WriteResult write(ssize_t index, int16_t v) noexcept; - WriteResult write(ssize_t index, int32_t v) noexcept; - WriteResult write(ssize_t index, int64_t v) noexcept; - WriteResult write(ssize_t index, uint8_t v) noexcept; - WriteResult write(ssize_t index, uint16_t v) noexcept; - WriteResult write(ssize_t index, uint32_t v) noexcept; - WriteResult write(ssize_t index, uint64_t v) noexcept; - - WriteResult write(ssize_t index, const std::string& v) noexcept; - WriteResult write(ssize_t index, folly::StringPiece v) noexcept; - WriteResult write(ssize_t index, const char* v) noexcept; - - WriteResult write(ssize_t index, const Date& v) noexcept; - WriteResult write(ssize_t index, const Time& v) noexcept; - WriteResult write(ssize_t index, const DateTime& v) noexcept; - WriteResult write(ssize_t index, const Duration& v) noexcept; - - WriteResult write(ssize_t index, const Geography& v) noexcept; + bool checkNullBit(ssize_t pos) const; + + WriteResult write(ssize_t index, bool v); + WriteResult write(ssize_t index, float v); + WriteResult write(ssize_t index, double v); + + WriteResult write(ssize_t index, int8_t v); + WriteResult write(ssize_t index, int16_t v); + WriteResult write(ssize_t index, int32_t v); + WriteResult write(ssize_t index, int64_t v); + WriteResult write(ssize_t index, uint8_t v); + WriteResult write(ssize_t index, uint16_t v); + WriteResult write(ssize_t index, uint32_t v); + WriteResult write(ssize_t index, uint64_t v); + + WriteResult write(ssize_t index, const std::string& v); + WriteResult write(ssize_t index, folly::StringPiece v); + WriteResult write(ssize_t index, const char* v); + + WriteResult write(ssize_t index, const Date& v); + WriteResult write(ssize_t index, const Time& v); + WriteResult write(ssize_t index, const DateTime& v); + WriteResult write(ssize_t index, const Duration& v); + + WriteResult write(ssize_t index, const Geography& v); }; } // namespace nebula diff --git a/src/common/base/EitherOr.h b/src/common/base/EitherOr.h index d832196b31a..45479de8c27 100644 --- a/src/common/base/EitherOr.h +++ b/src/common/base/EitherOr.h @@ -125,9 +125,9 @@ class EitherOr { * Constructors * **********************************************/ - EitherOr() noexcept {}; + EitherOr() {} - EitherOr(const EitherOr& rhs) noexcept { + EitherOr(const EitherOr& rhs) { switch (rhs.state_) { case State::VOID: break; @@ -142,7 +142,7 @@ class EitherOr { } } - EitherOr(EitherOr&& rhs) noexcept { + EitherOr(EitherOr&& rhs) { switch (rhs.state_) { case State::VOID: break; @@ -161,7 +161,7 @@ class EitherOr { typename V, typename = std::enable_if_t::value && std::is_constructible::value>> - EitherOr(const EitherOr& rhs) noexcept { + EitherOr(const EitherOr& rhs) { switch (rhs.state_) { case State::VOID: break; @@ -180,7 +180,7 @@ class EitherOr { typename V, typename = std::enable_if_t::value && std::is_constructible::value>> - EitherOr(EitherOr&& rhs) noexcept { + EitherOr(EitherOr&& rhs) { switch (rhs.state_) { case State::VOID: break; @@ -195,22 +195,22 @@ class EitherOr { } } - EitherOr(const LEFT& v) noexcept { // NOLINT + EitherOr(const LEFT& v) { // NOLINT new (&val_) Variant(kConstructLeft, v); state_ = State::LEFT_TYPE; } - EitherOr(LEFT&& v) noexcept { // NOLINT + EitherOr(LEFT&& v) { // NOLINT new (&val_) Variant(kConstructLeft, std::move(v)); state_ = State::LEFT_TYPE; } - EitherOr(const RIGHT& v) noexcept { // NOLINT + EitherOr(const RIGHT& v) { // NOLINT new (&val_) Variant(kConstructRight, v); state_ = State::RIGHT_TYPE; } - EitherOr(RIGHT&& v) noexcept { // NOLINT + EitherOr(RIGHT&& v) { // NOLINT new (&val_) Variant(kConstructRight, std::move(v)); state_ = State::RIGHT_TYPE; } @@ -220,7 +220,7 @@ class EitherOr { template ::value || std::is_constructible::value>> - EitherOr(Args&&... v) noexcept { // NOLINT + EitherOr(Args&&... v) { // NOLINT new (&val_) Variant(convert_to_t, std::forward(v)...); state_ = convert_to_s; } @@ -230,7 +230,7 @@ class EitherOr { template ::value && std::is_constructible::value>> - EitherOr(const LeftType*, U&& v) noexcept { + EitherOr(const LeftType*, U&& v) { new (&val_) Variant(kConstructLeft, std::forward(v)); state_ = State::LEFT_TYPE; } @@ -240,7 +240,7 @@ class EitherOr { template ::value && std::is_constructible::value>> - EitherOr(const RightType*, U&& v) noexcept { + EitherOr(const RightType*, U&& v) { new (&val_) Variant(kConstructRight, std::forward(v)); state_ = State::RIGHT_TYPE; } @@ -250,28 +250,28 @@ class EitherOr { * Assignments * **********************************************/ - EitherOr& operator=(const LEFT& v) noexcept { + EitherOr& operator=(const LEFT& v) { reset(); new (&val_) Variant(kConstructLeft, v); state_ = State::LEFT_TYPE; return *this; } - EitherOr& operator=(LEFT&& v) noexcept { + EitherOr& operator=(LEFT&& v) { reset(); new (&val_) Variant(kConstructLeft, std::move(v)); state_ = State::LEFT_TYPE; return *this; } - EitherOr& operator=(const RIGHT& v) noexcept { + EitherOr& operator=(const RIGHT& v) { reset(); new (&val_) Variant(kConstructRight, v); state_ = State::RIGHT_TYPE; return *this; } - EitherOr& operator=(RIGHT&& v) noexcept { + EitherOr& operator=(RIGHT&& v) { reset(); new (&val_) Variant(kConstructRight, std::move(v)); state_ = State::RIGHT_TYPE; @@ -284,14 +284,14 @@ class EitherOr { typename std::enable_if_t::value || std::is_constructible::value, EitherOr>& - operator=(U&& v) noexcept { + operator=(U&& v) { reset(); new (&val_) Variant(convert_to_t, std::forward(v)); state_ = convert_to_s; return *this; } - EitherOr& operator=(const EitherOr& rhs) noexcept { + EitherOr& operator=(const EitherOr& rhs) { // Avoid self-assignment if (&rhs == this) { return *this; @@ -313,7 +313,7 @@ class EitherOr { return *this; } - EitherOr& operator=(EitherOr&& rhs) noexcept { + EitherOr& operator=(EitherOr&& rhs) { // Avoid self-assignment if (&rhs == this) { return *this; @@ -339,7 +339,7 @@ class EitherOr { typename std::enable_if_t::value && std::is_constructible::value, EitherOr>& - operator=(const EitherOr& rhs) noexcept { + operator=(const EitherOr& rhs) { reset(); switch (rhs.state_) { case State::VOID: @@ -360,7 +360,7 @@ class EitherOr { typename std::enable_if_t::value && std::is_constructible::value, EitherOr>& - operator=(EitherOr&& rhs) noexcept { + operator=(EitherOr&& rhs) { reset(); switch (rhs.state_) { case State::VOID: diff --git a/src/common/base/StatusOr.h b/src/common/base/StatusOr.h index 605f94b567d..f536e5acd01 100644 --- a/src/common/base/StatusOr.h +++ b/src/common/base/StatusOr.h @@ -136,7 +136,7 @@ class StatusOr final { } // Move constructor - StatusOr(StatusOr &&rhs) noexcept : state_(rhs.state_) { + StatusOr(StatusOr &&rhs) : state_(rhs.state_) { if (hasValue()) { new (&variant_) Variant(std::move(rhs.variant_.value_)); rhs.resetValue(); @@ -148,7 +148,7 @@ class StatusOr final { // Move construct from a rvalue of StatusOr template >> - StatusOr(StatusOr &&rhs) noexcept : state_(rhs.state_) { + StatusOr(StatusOr &&rhs) : state_(rhs.state_) { if (hasValue()) { new (&variant_) Variant(std::move(rhs.variant_.value_)); rhs.resetValue(); @@ -161,7 +161,7 @@ class StatusOr final { } // Move assignment operator - StatusOr &operator=(StatusOr &&rhs) noexcept { + StatusOr &operator=(StatusOr &&rhs) { if (&rhs == this) { return *this; } @@ -182,7 +182,7 @@ class StatusOr final { // Move assignment operator from a rvalue of `StatusOr' template >> - StatusOr &operator=(StatusOr &&rhs) noexcept { + StatusOr &operator=(StatusOr &&rhs) { reset(); if (rhs.hasValue()) { new (&variant_) Variant(std::move(rhs.variant_.value_)); @@ -200,7 +200,7 @@ class StatusOr final { // Move assignment operator from a rvalue of any compatible type with `T' template >> - StatusOr &operator=(U &&value) noexcept { + StatusOr &operator=(U &&value) { destruct(); new (&variant_) Variant(std::forward(value)); state_ = kValue; @@ -216,7 +216,7 @@ class StatusOr final { } // Move assign from a rvalue of `Status' - StatusOr &operator=(Status &&status) noexcept { + StatusOr &operator=(Status &&status) { destruct(); new (&variant_) Variant(std::move(status)); state_ = kStatus; diff --git a/src/common/datatypes/DataSet.h b/src/common/datatypes/DataSet.h index b1230001ce8..600ef231ec8 100644 --- a/src/common/datatypes/DataSet.h +++ b/src/common/datatypes/DataSet.h @@ -26,7 +26,7 @@ struct DataSet { DataSet() = default; explicit DataSet(std::vector columns) : colNames(std::move(columns)) {} - DataSet(const DataSet& ds) noexcept { + DataSet(const DataSet& ds) { colNames = ds.colNames; rows = ds.rows; } @@ -34,7 +34,7 @@ struct DataSet { colNames = std::move(ds.colNames); rows = std::move(ds.rows); } - DataSet& operator=(const DataSet& ds) noexcept { + DataSet& operator=(const DataSet& ds) { if (&ds != this) { colNames = ds.colNames; rows = ds.rows; diff --git a/src/common/datatypes/Edge.cpp b/src/common/datatypes/Edge.cpp index c5d2f3464b4..c734db5aa4d 100644 --- a/src/common/datatypes/Edge.cpp +++ b/src/common/datatypes/Edge.cpp @@ -167,7 +167,7 @@ std::string Edge::id() const { namespace std { // Inject a customized hash function -std::size_t hash::operator()(const nebula::Edge& h) const noexcept { +std::size_t hash::operator()(const nebula::Edge& h) const { const auto& src = h.type > 0 ? h.src.toString() : h.dst.toString(); const auto& dst = h.type > 0 ? h.dst.toString() : h.src.toString(); auto type = h.type > 0 ? h.type : -h.type; diff --git a/src/common/datatypes/Edge.h b/src/common/datatypes/Edge.h index e873c62689a..dcdef8a58c7 100644 --- a/src/common/datatypes/Edge.h +++ b/src/common/datatypes/Edge.h @@ -100,7 +100,7 @@ namespace std { // Inject a customized hash function template <> struct hash { - std::size_t operator()(const nebula::Edge& h) const noexcept; + std::size_t operator()(const nebula::Edge& h) const; }; } // namespace std diff --git a/src/common/datatypes/Geography.cpp b/src/common/datatypes/Geography.cpp index 05885d294db..01eb56e6a7b 100644 --- a/src/common/datatypes/Geography.cpp +++ b/src/common/datatypes/Geography.cpp @@ -387,7 +387,7 @@ bool Geography::operator<(const Geography& rhs) const { namespace std { // Inject a customized hash function -std::size_t hash::operator()(const nebula::Geography& v) const noexcept { +std::size_t hash::operator()(const nebula::Geography& v) const { std::string wkb = v.asWKB(); return hash{}(wkb); } diff --git a/src/common/datatypes/Geography.h b/src/common/datatypes/Geography.h index 6d819750af4..2f93c157b3d 100644 --- a/src/common/datatypes/Geography.h +++ b/src/common/datatypes/Geography.h @@ -238,7 +238,7 @@ namespace std { // Inject a customized hash function template <> struct hash { - std::size_t operator()(const nebula::Geography& h) const noexcept; + std::size_t operator()(const nebula::Geography& h) const; }; } // namespace std diff --git a/src/common/datatypes/List.h b/src/common/datatypes/List.h index 28b55caf5cf..d2509d9b687 100644 --- a/src/common/datatypes/List.h +++ b/src/common/datatypes/List.h @@ -103,7 +103,7 @@ inline std::ostream& operator<<(std::ostream& os, const List& l) { namespace std { template <> struct hash { - std::size_t operator()(const nebula::List& h) const noexcept { + std::size_t operator()(const nebula::List& h) const { if (h.values.size() == 1) { return std::hash()(h.values[0]); } diff --git a/src/common/datatypes/Map.cpp b/src/common/datatypes/Map.cpp index 095d001cc4a..7cb1de2b80a 100644 --- a/src/common/datatypes/Map.cpp +++ b/src/common/datatypes/Map.cpp @@ -91,7 +91,7 @@ Map::Map(const folly::dynamic& obj) { } // namespace nebula namespace std { -std::size_t hash::operator()(const nebula::Map& m) const noexcept { +std::size_t hash::operator()(const nebula::Map& m) const { size_t seed = 0; for (auto& v : m.kvs) { seed ^= hash()(v.first) + 0x9e3779b9 + (seed << 6) + (seed >> 2); diff --git a/src/common/datatypes/Map.h b/src/common/datatypes/Map.h index 91134a48387..15a0dd9099e 100644 --- a/src/common/datatypes/Map.h +++ b/src/common/datatypes/Map.h @@ -88,7 +88,7 @@ inline std::ostream& operator<<(std::ostream& os, const Map& m) { namespace std { template <> struct hash { - std::size_t operator()(const nebula::Map& m) const noexcept; + std::size_t operator()(const nebula::Map& m) const; }; } // namespace std diff --git a/src/common/datatypes/Path.cpp b/src/common/datatypes/Path.cpp index b752239ed12..d8303e9b7b3 100644 --- a/src/common/datatypes/Path.cpp +++ b/src/common/datatypes/Path.cpp @@ -81,13 +81,13 @@ bool Path::hasDuplicateEdges() const { namespace std { -std::size_t hash::operator()(const nebula::Step& h) const noexcept { +std::size_t hash::operator()(const nebula::Step& h) const { size_t hv = hash()(h.dst); hv = folly::hash::fnv64_buf(reinterpret_cast(&h.type), sizeof(h.type), hv); return folly::hash::fnv64_buf(reinterpret_cast(&h.ranking), sizeof(h.ranking), hv); } -std::size_t hash::operator()(const nebula::Path& h) const noexcept { +std::size_t hash::operator()(const nebula::Path& h) const { size_t hv = hash()(h.src); for (auto& s : h.steps) { hv += (hv << 1) + (hv << 4) + (hv << 5) + (hv << 7) + (hv << 8) + (hv << 40); diff --git a/src/common/datatypes/Path.h b/src/common/datatypes/Path.h index 5dbedb3b9d0..c6d805b3ad2 100644 --- a/src/common/datatypes/Path.h +++ b/src/common/datatypes/Path.h @@ -28,11 +28,7 @@ struct Step { name(std::move(s.name)), ranking(std::move(s.ranking)), props(std::move(s.props)) {} - Step(Vertex d, - EdgeType t, - std::string n, - EdgeRanking r, - std::unordered_map p) noexcept + Step(Vertex d, EdgeType t, std::string n, EdgeRanking r, std::unordered_map p) : dst(std::move(d)), type(t), name(std::move(n)), ranking(r), props(std::move(p)) {} void clear() { @@ -71,7 +67,7 @@ struct Step { return *this; } - Step& operator=(const Step& rhs) noexcept { + Step& operator=(const Step& rhs) { if (&rhs != this) { dst = rhs.dst; type = rhs.type; @@ -190,7 +186,7 @@ struct Path { return *this; } - Path& operator=(const Path& rhs) noexcept { + Path& operator=(const Path& rhs) { if (&rhs != this) { src = rhs.src; steps = rhs.steps; @@ -242,12 +238,12 @@ namespace std { template <> struct hash { - std::size_t operator()(const nebula::Step& h) const noexcept; + std::size_t operator()(const nebula::Step& h) const; }; template <> struct hash { - std::size_t operator()(const nebula::Path& h) const noexcept; + std::size_t operator()(const nebula::Path& h) const; }; } // namespace std diff --git a/src/common/datatypes/Set.cpp b/src/common/datatypes/Set.cpp index 103170546e4..92f116f2c10 100644 --- a/src/common/datatypes/Set.cpp +++ b/src/common/datatypes/Set.cpp @@ -44,7 +44,7 @@ folly::dynamic Set::getMetaData() const { } // namespace nebula namespace std { -std::size_t hash::operator()(const nebula::Set& s) const noexcept { +std::size_t hash::operator()(const nebula::Set& s) const { size_t seed = 0; for (auto& v : s.values) { seed ^= hash()(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2); diff --git a/src/common/datatypes/Set.h b/src/common/datatypes/Set.h index 107cf3aee5f..5e3e30870b8 100644 --- a/src/common/datatypes/Set.h +++ b/src/common/datatypes/Set.h @@ -72,7 +72,7 @@ inline std::ostream& operator<<(std::ostream& os, const Set& s) { namespace std { template <> struct hash { - std::size_t operator()(const nebula::Set& s) const noexcept; + std::size_t operator()(const nebula::Set& s) const; }; } // namespace std diff --git a/src/common/datatypes/Value.cpp b/src/common/datatypes/Value.cpp index b0cd600effe..4dd1aef39ce 100644 --- a/src/common/datatypes/Value.cpp +++ b/src/common/datatypes/Value.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -931,7 +932,10 @@ void Value::clearSlow() { break; } case Type::STRING: { - destruct(value_.sVal); + if (value_.sVal) { + destruct(value_.sVal); + value_.sVal = nullptr; + } break; } case Type::DATE: { @@ -967,31 +971,52 @@ void Value::clearSlow() { break; } case Type::PATH: { - destruct(value_.pVal); + if (value_.pVal) { + destruct(value_.pVal); + value_.pVal = nullptr; + } break; } case Type::LIST: { - destruct(value_.lVal); + if (value_.lVal) { + destruct(value_.lVal); + value_.lVal = nullptr; + } break; } case Type::MAP: { - destruct(value_.mVal); + if (value_.mVal) { + destruct(value_.mVal); + value_.mVal = nullptr; + } break; } case Type::SET: { - destruct(value_.uVal); + if (value_.uVal) { + destruct(value_.uVal); + value_.uVal = nullptr; + } break; } case Type::DATASET: { - destruct(value_.gVal); + if (value_.gVal) { + destruct(value_.gVal); + value_.gVal = nullptr; + } break; } case Type::GEOGRAPHY: { - destruct(value_.ggVal); + if (value_.ggVal) { + destruct(value_.ggVal); + value_.ggVal = nullptr; + } break; } case Type::DURATION: { - destruct(value_.duVal); + if (value_.duVal) { + destruct(value_.duVal); + value_.duVal = nullptr; + } break; } } @@ -1177,265 +1202,267 @@ Value& Value::operator=(const Value& rhs) { } void Value::setN(const NullType& v) { - type_ = Type::NULLVALUE; new (std::addressof(value_.nVal)) NullType(v); + type_ = Type::NULLVALUE; } void Value::setN(NullType&& v) { - type_ = Type::NULLVALUE; new (std::addressof(value_.nVal)) NullType(std::move(v)); + type_ = Type::NULLVALUE; } void Value::setB(const bool& v) { - type_ = Type::BOOL; new (std::addressof(value_.bVal)) bool(v); // NOLINT + type_ = Type::BOOL; } void Value::setB(bool&& v) { - type_ = Type::BOOL; new (std::addressof(value_.bVal)) bool(std::move(v)); // NOLINT + type_ = Type::BOOL; } void Value::setI(const int64_t& v) { - type_ = Type::INT; new (std::addressof(value_.iVal)) int64_t(v); // NOLINT + type_ = Type::INT; } void Value::setI(int64_t&& v) { - type_ = Type::INT; new (std::addressof(value_.iVal)) int64_t(std::move(v)); // NOLINT + type_ = Type::INT; } void Value::setF(const double& v) { - type_ = Type::FLOAT; new (std::addressof(value_.fVal)) double(v); // NOLINT + type_ = Type::FLOAT; } void Value::setF(double&& v) { - type_ = Type::FLOAT; new (std::addressof(value_.fVal)) double(std::move(v)); // NOLINT + type_ = Type::FLOAT; } void Value::setS(std::unique_ptr v) { - type_ = Type::STRING; new (std::addressof(value_.sVal)) std::unique_ptr(std::move(v)); + type_ = Type::STRING; } void Value::setS(const std::string& v) { - type_ = Type::STRING; new (std::addressof(value_.sVal)) std::unique_ptr(new std::string(v)); + type_ = Type::STRING; } void Value::setS(std::string&& v) { - type_ = Type::STRING; +// auto ptr = std::make_unique(std::move(v)); +// value_.sVal = std::move(ptr); new (std::addressof(value_.sVal)) std::unique_ptr(new std::string(std::move(v))); + type_ = Type::STRING; } void Value::setS(const char* v) { - type_ = Type::STRING; new (std::addressof(value_.sVal)) std::unique_ptr(new std::string(v)); + type_ = Type::STRING; } void Value::setD(const Date& v) { - type_ = Type::DATE; new (std::addressof(value_.dVal)) Date(v); + type_ = Type::DATE; } void Value::setD(Date&& v) { - type_ = Type::DATE; new (std::addressof(value_.dVal)) Date(std::move(v)); + type_ = Type::DATE; } void Value::setT(const Time& v) { - type_ = Type::TIME; new (std::addressof(value_.tVal)) Time(v); + type_ = Type::TIME; } void Value::setT(Time&& v) { - type_ = Type::TIME; new (std::addressof(value_.tVal)) Time(std::move(v)); + type_ = Type::TIME; } void Value::setDT(const DateTime& v) { - type_ = Type::DATETIME; new (std::addressof(value_.dtVal)) DateTime(v); + type_ = Type::DATETIME; } void Value::setDT(DateTime&& v) { - type_ = Type::DATETIME; new (std::addressof(value_.dtVal)) DateTime(std::move(v)); + type_ = Type::DATETIME; } void Value::setV(Vertex* v) { - type_ = Type::VERTEX; value_.vVal = v; value_.vVal->ref(); + type_ = Type::VERTEX; } void Value::setV(const Vertex& v) { - type_ = Type::VERTEX; new (std::addressof(value_.vVal)) Vertex*(new Vertex(v)); + type_ = Type::VERTEX; } void Value::setV(Vertex&& v) { - type_ = Type::VERTEX; new (std::addressof(value_.vVal)) Vertex*(new Vertex(std::move(v))); + type_ = Type::VERTEX; } void Value::setE(Edge* v) { - type_ = Type::EDGE; value_.eVal = v; value_.eVal->ref(); + type_ = Type::EDGE; } void Value::setE(const Edge& v) { - type_ = Type::EDGE; new (std::addressof(value_.eVal)) Edge*(new Edge(v)); + type_ = Type::EDGE; } void Value::setE(Edge&& v) { - type_ = Type::EDGE; new (std::addressof(value_.eVal)) Edge*(new Edge(std::move(v))); + type_ = Type::EDGE; } void Value::setP(const std::unique_ptr& v) { - type_ = Type::PATH; new (std::addressof(value_.pVal)) std::unique_ptr(new Path(*v)); + type_ = Type::PATH; } void Value::setP(std::unique_ptr&& v) { - type_ = Type::PATH; new (std::addressof(value_.pVal)) std::unique_ptr(std::move(v)); + type_ = Type::PATH; } void Value::setP(const Path& v) { - type_ = Type::PATH; new (std::addressof(value_.pVal)) std::unique_ptr(new Path(v)); + type_ = Type::PATH; } void Value::setP(Path&& v) { - type_ = Type::PATH; new (std::addressof(value_.pVal)) std::unique_ptr(new Path(std::move(v))); + type_ = Type::PATH; } void Value::setL(const std::unique_ptr& v) { - type_ = Type::LIST; new (std::addressof(value_.lVal)) std::unique_ptr(new List(*v)); + type_ = Type::LIST; } void Value::setL(std::unique_ptr&& v) { - type_ = Type::LIST; new (std::addressof(value_.lVal)) std::unique_ptr(std::move(v)); + type_ = Type::LIST; } void Value::setL(const List& v) { - type_ = Type::LIST; new (std::addressof(value_.lVal)) std::unique_ptr(new List(v)); + type_ = Type::LIST; } void Value::setL(List&& v) { - type_ = Type::LIST; new (std::addressof(value_.lVal)) std::unique_ptr(new List(std::move(v))); + type_ = Type::LIST; } void Value::setM(const std::unique_ptr& v) { - type_ = Type::MAP; new (std::addressof(value_.mVal)) std::unique_ptr(new Map(*v)); + type_ = Type::MAP; } void Value::setM(std::unique_ptr&& v) { - type_ = Type::MAP; new (std::addressof(value_.mVal)) std::unique_ptr(std::move(v)); + type_ = Type::MAP; } void Value::setM(const Map& v) { - type_ = Type::MAP; new (std::addressof(value_.mVal)) std::unique_ptr(new Map(v)); + type_ = Type::MAP; } void Value::setM(Map&& v) { - type_ = Type::MAP; new (std::addressof(value_.mVal)) std::unique_ptr(new Map(std::move(v))); + type_ = Type::MAP; } void Value::setU(const std::unique_ptr& v) { - type_ = Type::SET; new (std::addressof(value_.uVal)) std::unique_ptr(new Set(*v)); + type_ = Type::SET; } void Value::setU(std::unique_ptr&& v) { - type_ = Type::SET; new (std::addressof(value_.uVal)) std::unique_ptr(std::move(v)); + type_ = Type::SET; } void Value::setU(const Set& v) { - type_ = Type::SET; new (std::addressof(value_.uVal)) std::unique_ptr(new Set(v)); + type_ = Type::SET; } void Value::setU(Set&& v) { - type_ = Type::SET; new (std::addressof(value_.vVal)) std::unique_ptr(new Set(std::move(v))); + type_ = Type::SET; } void Value::setG(const std::unique_ptr& v) { - type_ = Type::DATASET; new (std::addressof(value_.gVal)) std::unique_ptr(new DataSet(*v)); + type_ = Type::DATASET; } void Value::setG(std::unique_ptr&& v) { - type_ = Type::DATASET; new (std::addressof(value_.gVal)) std::unique_ptr(std::move(v)); + type_ = Type::DATASET; } void Value::setG(const DataSet& v) { - type_ = Type::DATASET; new (std::addressof(value_.gVal)) std::unique_ptr(new DataSet(v)); + type_ = Type::DATASET; } void Value::setG(DataSet&& v) { - type_ = Type::DATASET; new (std::addressof(value_.gVal)) std::unique_ptr(new DataSet(std::move(v))); + type_ = Type::DATASET; } void Value::setGG(const std::unique_ptr& v) { - type_ = Type::GEOGRAPHY; new (std::addressof(value_.ggVal)) std::unique_ptr(new Geography(*v)); + type_ = Type::GEOGRAPHY; } void Value::setGG(std::unique_ptr&& v) { - type_ = Type::GEOGRAPHY; new (std::addressof(value_.ggVal)) std::unique_ptr(std::move(v)); + type_ = Type::GEOGRAPHY; } void Value::setGG(const Geography& v) { - type_ = Type::GEOGRAPHY; new (std::addressof(value_.ggVal)) std::unique_ptr(new Geography(v)); + type_ = Type::GEOGRAPHY; } void Value::setGG(Geography&& v) { - type_ = Type::GEOGRAPHY; new (std::addressof(value_.ggVal)) std::unique_ptr(new Geography(std::move(v))); + type_ = Type::GEOGRAPHY; } void Value::setDU(const std::unique_ptr& v) { - type_ = Type::DURATION; new (std::addressof(value_.duVal)) std::unique_ptr(new Duration(*v)); + type_ = Type::DURATION; } void Value::setDU(std::unique_ptr&& v) { - type_ = Type::DURATION; new (std::addressof(value_.duVal)) std::unique_ptr(std::move(v)); + type_ = Type::DURATION; } void Value::setDU(const Duration& v) { - type_ = Type::DURATION; new (std::addressof(value_.duVal)) std::unique_ptr(new Duration(v)); + type_ = Type::DURATION; } void Value::setDU(Duration&& v) { - type_ = Type::DURATION; new (std::addressof(value_.duVal)) std::unique_ptr(new Duration(std::move(v))); + type_ = Type::DURATION; } // Convert Nebula::Value to a value compatible with Json standard diff --git a/src/common/datatypes/Value.h b/src/common/datatypes/Value.h index 9749b529d3f..3e228446a78 100644 --- a/src/common/datatypes/Value.h +++ b/src/common/datatypes/Value.h @@ -412,7 +412,7 @@ struct Value { (&val)->~T(); } - // Null value + // Null val void setN(const NullType& v); void setN(NullType&& v); // Bool value @@ -555,7 +555,7 @@ namespace std { // Inject a customized hash function template <> struct hash { - std::size_t operator()(const nebula::Value& h) const noexcept { + std::size_t operator()(const nebula::Value& h) const { if (h.isInt()) { return h.getInt(); } else if (h.isStr()) { @@ -567,28 +567,28 @@ struct hash { template <> struct hash { - std::size_t operator()(const nebula::Value* h) const noexcept { + std::size_t operator()(const nebula::Value* h) const { return h == nullptr ? 0 : hash()(*h); } }; template <> struct hash { - std::size_t operator()(const nebula::Value* h) const noexcept { + std::size_t operator()(const nebula::Value* h) const { return h == nullptr ? 0 : hash()(*h); } }; template <> struct equal_to { - bool operator()(const nebula::Value* lhs, const nebula::Value* rhs) const noexcept { + bool operator()(const nebula::Value* lhs, const nebula::Value* rhs) const { return lhs == rhs ? true : (lhs != nullptr) && (rhs != nullptr) && (*lhs == *rhs); } }; template <> struct equal_to { - bool operator()(const nebula::Value* lhs, const nebula::Value* rhs) const noexcept { + bool operator()(const nebula::Value* lhs, const nebula::Value* rhs) const { return lhs == rhs ? true : (lhs != nullptr) && (rhs != nullptr) && (*lhs == *rhs); } }; diff --git a/src/common/datatypes/ValueOps-inl.h b/src/common/datatypes/ValueOps-inl.h index c58cb0a5261..769c04943dd 100644 --- a/src/common/datatypes/ValueOps-inl.h +++ b/src/common/datatypes/ValueOps-inl.h @@ -334,7 +334,9 @@ void Cpp2Ops::read(Protocol* proto, nebula::Value* obj) { case 5: { if (readState.fieldType == apache::thrift::protocol::T_STRING) { obj->setStr(""); - proto->readBinary(obj->mutableStr()); + std::string s; + proto->readBinary(s); + obj->setStr(std::move(s)); } else { proto->skip(readState.fieldType); } diff --git a/src/common/datatypes/Vertex.cpp b/src/common/datatypes/Vertex.cpp index 291e6cfd6f1..eb0fbc4d13c 100644 --- a/src/common/datatypes/Vertex.cpp +++ b/src/common/datatypes/Vertex.cpp @@ -129,11 +129,11 @@ bool Vertex::operator<(const Vertex& rhs) const { namespace std { // Inject a customized hash function -std::size_t hash::operator()(const nebula::Tag& h) const noexcept { +std::size_t hash::operator()(const nebula::Tag& h) const { return folly::hash::fnv64(h.name); } -std::size_t hash::operator()(const nebula::Vertex& h) const noexcept { +std::size_t hash::operator()(const nebula::Vertex& h) const { size_t hv = folly::hash::fnv64(h.vid.toString()); for (auto& t : h.tags) { hv += (hv << 1) + (hv << 4) + (hv << 5) + (hv << 7) + (hv << 8) + (hv << 40); diff --git a/src/common/datatypes/Vertex.h b/src/common/datatypes/Vertex.h index 29ef6f83753..2541c801255 100644 --- a/src/common/datatypes/Vertex.h +++ b/src/common/datatypes/Vertex.h @@ -125,12 +125,12 @@ namespace std { // Inject a customized hash function template <> struct hash { - std::size_t operator()(const nebula::Tag& h) const noexcept; + std::size_t operator()(const nebula::Tag& h) const; }; template <> struct hash { - std::size_t operator()(const nebula::Vertex& h) const noexcept; + std::size_t operator()(const nebula::Vertex& h) const; }; } // namespace std diff --git a/src/common/expression/AttributeExpression.cpp b/src/common/expression/AttributeExpression.cpp index 20438134d57..5e3130442f5 100644 --- a/src/common/expression/AttributeExpression.cpp +++ b/src/common/expression/AttributeExpression.cpp @@ -16,7 +16,7 @@ namespace nebula { const Value &AttributeExpression::eval(ExpressionContext &ctx) { auto &lvalue = left()->eval(ctx); auto &rvalue = right()->eval(ctx); - DCHECK(rvalue.isStr()); +// DCHECK(rvalue.isStr()); // TODO(dutor) Take care of the builtin properties, _src, _vid, _type, etc. switch (lvalue.type()) { @@ -36,7 +36,7 @@ const Value &AttributeExpression::eval(ExpressionContext &ctx) { return Value::kNullValue; } case Value::Type::EDGE: { - DCHECK(!rvalue.getStr().empty()); +// DCHECK(!rvalue.getStr().empty()); if (rvalue.getStr()[0] == '_') { if (rvalue.getStr() == kSrc) { result_ = lvalue.getEdge().src; diff --git a/src/common/expression/Expression.cpp b/src/common/expression/Expression.cpp index ec36dab0b67..52f0e923ca5 100644 --- a/src/common/expression/Expression.cpp +++ b/src/common/expression/Expression.cpp @@ -50,12 +50,12 @@ std::string Expression::Encoder::moveStr() { return std::move(buf_); } -Expression::Encoder& Expression::Encoder::operator<<(Kind kind) noexcept { +Expression::Encoder& Expression::Encoder::operator<<(Kind kind) { buf_.append(reinterpret_cast(&kind), sizeof(uint8_t)); return *this; } -Expression::Encoder& Expression::Encoder::operator<<(const std::string& str) noexcept { +Expression::Encoder& Expression::Encoder::operator<<(const std::string& str) { size_t sz = str.size(); buf_.append(reinterpret_cast(&sz), sizeof(size_t)); if (sz > 0) { @@ -64,22 +64,22 @@ Expression::Encoder& Expression::Encoder::operator<<(const std::string& str) noe return *this; } -Expression::Encoder& Expression::Encoder::operator<<(const Value& val) noexcept { +Expression::Encoder& Expression::Encoder::operator<<(const Value& val) { serializer::serialize(val, &buf_); return *this; } -Expression::Encoder& Expression::Encoder::operator<<(size_t size) noexcept { +Expression::Encoder& Expression::Encoder::operator<<(size_t size) { buf_.append(reinterpret_cast(&size), sizeof(size_t)); return *this; } -Expression::Encoder& Expression::Encoder::operator<<(Value::Type vType) noexcept { +Expression::Encoder& Expression::Encoder::operator<<(Value::Type vType) { buf_.append(reinterpret_cast(&vType), sizeof(Value::Type)); return *this; } -Expression::Encoder& Expression::Encoder::operator<<(const Expression& exp) noexcept { +Expression::Encoder& Expression::Encoder::operator<<(const Expression& exp) { exp.writeTo(*this); return *this; } @@ -100,7 +100,7 @@ std::string Expression::Decoder::getHexStr() const { return toHexStr(encoded_); } -Expression::Kind Expression::Decoder::readKind() noexcept { +Expression::Kind Expression::Decoder::readKind() { CHECK_LE(ptr_ + sizeof(uint8_t), encoded_.end()); Expression::Kind kind; @@ -110,7 +110,7 @@ Expression::Kind Expression::Decoder::readKind() noexcept { return kind; } -std::string Expression::Decoder::readStr() noexcept { +std::string Expression::Decoder::readStr() { CHECK_LE(ptr_ + sizeof(size_t), encoded_.end()); size_t sz = 0; @@ -127,28 +127,28 @@ std::string Expression::Decoder::readStr() noexcept { return std::string(ptr, sz); } -Value Expression::Decoder::readValue() noexcept { +Value Expression::Decoder::readValue() { Value val; size_t len = serializer::deserialize(folly::StringPiece(ptr_, encoded_.end()), val); ptr_ += len; return val; } -size_t Expression::Decoder::readSize() noexcept { +size_t Expression::Decoder::readSize() { size_t sz = 0; memcpy(reinterpret_cast(&sz), ptr_, sizeof(size_t)); ptr_ += sizeof(size_t); return sz; } -Value::Type Expression::Decoder::readValueType() noexcept { +Value::Type Expression::Decoder::readValueType() { Value::Type type; memcpy(reinterpret_cast(&type), ptr_, sizeof(Value::Type)); ptr_ += sizeof(Value::Type); return type; } -Expression* Expression::Decoder::readExpression(ObjectPool* pool) noexcept { +Expression* Expression::Decoder::readExpression(ObjectPool* pool) { return Expression::decode(pool, *this); } diff --git a/src/common/expression/Expression.h b/src/common/expression/Expression.h index 0b21287a5fd..49962f895bc 100644 --- a/src/common/expression/Expression.h +++ b/src/common/expression/Expression.h @@ -177,12 +177,12 @@ class Expression { explicit Encoder(size_t bufSizeHint = 2048); std::string moveStr(); - Encoder& operator<<(Kind kind) noexcept; - Encoder& operator<<(const std::string& str) noexcept; - Encoder& operator<<(const Value& val) noexcept; - Encoder& operator<<(size_t size) noexcept; - Encoder& operator<<(Value::Type vType) noexcept; - Encoder& operator<<(const Expression& exp) noexcept; + Encoder& operator<<(Kind kind); + Encoder& operator<<(const std::string& str); + Encoder& operator<<(const Value& val); + Encoder& operator<<(size_t size); + Encoder& operator<<(Value::Type vType); + Encoder& operator<<(const Expression& exp); private: std::string buf_; @@ -194,12 +194,12 @@ class Expression { bool finished() const; - Kind readKind() noexcept; - std::string readStr() noexcept; - Value readValue() noexcept; - size_t readSize() noexcept; - Value::Type readValueType() noexcept; - Expression* readExpression(ObjectPool* pool) noexcept; + Kind readKind(); + std::string readStr(); + Value readValue(); + size_t readSize(); + Value::Type readValueType(); + Expression* readExpression(ObjectPool* pool); // Convert the unprocessed part into the hex string std::string getHexStr() const; diff --git a/src/common/expression/PropertyExpression.cpp b/src/common/expression/PropertyExpression.cpp index 09ec28eb4a6..7e07cfadb6a 100644 --- a/src/common/expression/PropertyExpression.cpp +++ b/src/common/expression/PropertyExpression.cpp @@ -46,7 +46,7 @@ void PropertyExpression::resetFrom(Decoder& decoder) { const Value& PropertyExpression::eval(ExpressionContext& ctx) { // TODO maybe cypher need it. UNUSED(ctx); - DLOG(FATAL) << "Unimplemented"; +// DLOG(FATAL) << "Unimplemented"; return Value::kNullBadType; } diff --git a/src/common/geo/GeoIndex.cpp b/src/common/geo/GeoIndex.cpp index 0995afc99eb..b041557216e 100644 --- a/src/common/geo/GeoIndex.cpp +++ b/src/common/geo/GeoIndex.cpp @@ -57,7 +57,7 @@ nebula::storage::cpp2::IndexColumnHint ScanRange::toIndexColumnHint() const { return hint; } -std::vector GeoIndex::indexCells(const Geography& g) const noexcept { +std::vector GeoIndex::indexCells(const Geography& g) const { auto r = g.asS2(); if (UNLIKELY(!r)) { return {}; @@ -72,7 +72,7 @@ std::vector GeoIndex::indexCells(const Geography& g) const noexcept { return cellIds; } -std::vector GeoIndex::intersects(const Geography& g) const noexcept { +std::vector GeoIndex::intersects(const Geography& g) const { auto r = g.asS2(); if (UNLIKELY(!r)) { return {}; @@ -82,16 +82,16 @@ std::vector GeoIndex::intersects(const Geography& g) const noexcept { } // covers degenerates to intersects currently -std::vector GeoIndex::covers(const Geography& g) const noexcept { +std::vector GeoIndex::covers(const Geography& g) const { return intersects(g); } // coveredBy degenerates to intersects currently -std::vector GeoIndex::coveredBy(const Geography& g) const noexcept { +std::vector GeoIndex::coveredBy(const Geography& g) const { return intersects(g); } -std::vector GeoIndex::dWithin(const Geography& g, double distance) const noexcept { +std::vector GeoIndex::dWithin(const Geography& g, double distance) const { auto r = g.asS2(); if (UNLIKELY(!r)) { return {}; @@ -124,7 +124,7 @@ std::vector GeoIndex::dWithin(const Geography& g, double distance) co } } -std::vector GeoIndex::intersects(const S2Region& r, bool isPoint) const noexcept { +std::vector GeoIndex::intersects(const S2Region& r, bool isPoint) const { auto cells = coveringCells(r, isPoint); std::vector scanRanges; for (const S2CellId& cellId : cells) { @@ -147,7 +147,7 @@ std::vector GeoIndex::intersects(const S2Region& r, bool isPoint) con return scanRanges; } -std::vector GeoIndex::coveringCells(const S2Region& r, bool isPoint) const noexcept { +std::vector GeoIndex::coveringCells(const S2Region& r, bool isPoint) const { // Currently we don't apply region coverer params to point, because it's useless. // Point always use level 30. if (isPoint) { @@ -166,7 +166,7 @@ std::vector GeoIndex::coveringCells(const S2Region& r, bool isPoint) c return covering; } -std::vector GeoIndex::ancestorCells(const std::vector& cells) const noexcept { +std::vector GeoIndex::ancestorCells(const std::vector& cells) const { // DCHECK(rc.IsCanonical(cells)); std::vector ancestors; std::unordered_set seen; diff --git a/src/common/geo/GeoIndex.h b/src/common/geo/GeoIndex.h index 3b1c7e618f4..cdd5032ed97 100644 --- a/src/common/geo/GeoIndex.h +++ b/src/common/geo/GeoIndex.h @@ -64,24 +64,24 @@ class GeoIndex { : rcParams_(params), pointsOnly_(pointsOnly) {} // Build geo index for the geography g - std::vector indexCells(const Geography& g) const noexcept; + std::vector indexCells(const Geography& g) const; // Query the geo index // ST_Intersects(g, x), x is the indexed geography column - std::vector intersects(const Geography& g) const noexcept; + std::vector intersects(const Geography& g) const; // ST_Covers(g, x), x is the indexed geography column - std::vector covers(const Geography& g) const noexcept; + std::vector covers(const Geography& g) const; // ST_CoveredBy(g, x), x is the indexed geography column - std::vector coveredBy(const Geography& g) const noexcept; + std::vector coveredBy(const Geography& g) const; // ST_Distance(g, x, distance), x is the indexed geography column - std::vector dWithin(const Geography& g, double distance) const noexcept; + std::vector dWithin(const Geography& g, double distance) const; private: - std::vector intersects(const S2Region& r, bool isPoint = false) const noexcept; + std::vector intersects(const S2Region& r, bool isPoint = false) const; - std::vector coveringCells(const S2Region& r, bool isPoint = false) const noexcept; + std::vector coveringCells(const S2Region& r, bool isPoint = false) const; - std::vector ancestorCells(const std::vector& cells) const noexcept; + std::vector ancestorCells(const std::vector& cells) const; private: RegionCoverParams rcParams_; diff --git a/src/common/memory/Memory.h b/src/common/memory/Memory.h index 418685900bd..14f63fd8099 100644 --- a/src/common/memory/Memory.h +++ b/src/common/memory/Memory.h @@ -105,11 +105,22 @@ inline ALWAYS_INLINE size_t getActualAllocationSize(size_t size, std::align_val_ } inline ALWAYS_INLINE void trackMemory(std::size_t size) { + std::size_t actual_size = getActualAllocationSize(size); + MemoryTracker::alloc(actual_size); +} + +inline ALWAYS_INLINE void trackMemoryNoThrow(std::size_t size) { std::size_t actual_size = getActualAllocationSize(size); MemoryTracker::allocNoThrow(actual_size); } + inline ALWAYS_INLINE void trackMemory(std::size_t size, std::align_val_t align) { + std::size_t actual_size = getActualAllocationSize(size, align); + MemoryTracker::alloc(actual_size); +} + +inline ALWAYS_INLINE void trackMemoryNoThrow(std::size_t size, std::align_val_t align) { std::size_t actual_size = getActualAllocationSize(size, align); MemoryTracker::allocNoThrow(actual_size); } diff --git a/src/common/memory/MemoryTracker.cpp b/src/common/memory/MemoryTracker.cpp index a22a0aabf0d..cae9c756b72 100644 --- a/src/common/memory/MemoryTracker.cpp +++ b/src/common/memory/MemoryTracker.cpp @@ -41,8 +41,8 @@ bool MemoryTracker::isOn() { return MemoryStats::instance().throwOnMemoryExceeded(); } -void MemoryTracker::allocImpl(int64_t size, bool) { - MemoryStats::instance().alloc(size); +void MemoryTracker::allocImpl(int64_t size, bool throw_if_memory_exceeded) { + MemoryStats::instance().alloc(size, throw_if_memory_exceeded); } } // namespace memory diff --git a/src/common/memory/MemoryTracker.h b/src/common/memory/MemoryTracker.h index f42d5223ad9..5e55ee035c2 100644 --- a/src/common/memory/MemoryTracker.h +++ b/src/common/memory/MemoryTracker.h @@ -63,7 +63,7 @@ class MemoryStats { } /// Inform size of memory allocation - inline ALWAYS_INLINE void alloc(int64_t size) { + inline ALWAYS_INLINE void alloc(int64_t size, bool throw_if_memory_exceeded) { int64_t willBe = threadMemoryStats_.reserved - size; if (UNLIKELY(willBe < 0)) { @@ -74,7 +74,7 @@ class MemoryStats { } // allocGlobal() may end with bad_alloc, only invoke allocGlobal() once (ALL_OR_NOTHING // semantic) - allocGlobal(getFromGlobal); + allocGlobal(getFromGlobal, throw_if_memory_exceeded); willBe += getFromGlobal; } // Only update after successful allocations, failed allocations should not be taken into @@ -143,12 +143,17 @@ class MemoryStats { return threadMemoryStats_.throwOnMemoryExceeded; } + static bool setThrowOnMemoryExceeded(bool value) { + return threadMemoryStats_.throwOnMemoryExceeded = value; + } + private: - inline ALWAYS_INLINE void allocGlobal(int64_t size) { + inline ALWAYS_INLINE void allocGlobal(int64_t size, bool throw_if_memory_exceeded) { int64_t willBe = size + used_.fetch_add(size, std::memory_order_relaxed); - if (threadMemoryStats_.throwOnMemoryExceeded && willBe > limit_) { + if (threadMemoryStats_.throwOnMemoryExceeded && throw_if_memory_exceeded && willBe > limit_) { // revert used_.fetch_sub(size, std::memory_order_relaxed); + threadMemoryStats_.throwOnMemoryExceeded = false; throw std::bad_alloc(); } } @@ -174,6 +179,18 @@ struct MemoryCheckGuard { } }; +struct MemoryCheckOffGuard { + bool previous; + MemoryCheckOffGuard() { + previous = MemoryStats::throwOnMemoryExceeded(); + MemoryStats::turnOffThrow(); + } + + ~MemoryCheckOffGuard() { + MemoryStats::setThrowOnMemoryExceeded(previous); + } +}; + // A global static memory tracker enable tracking every memory allocation and deallocation. // This is not the place where real memory allocation or deallocation happens, only do the // memory tracking. diff --git a/src/common/memory/MemoryUtils.cpp b/src/common/memory/MemoryUtils.cpp index 1d7170baffb..f8950fd3d21 100644 --- a/src/common/memory/MemoryUtils.cpp +++ b/src/common/memory/MemoryUtils.cpp @@ -44,7 +44,7 @@ DEFINE_string(cgroup_v2_memory_current_path, DEFINE_bool(memory_purge_enabled, true, "memory purge enabled, default true"); DEFINE_int32(memory_purge_interval_seconds, 10, "memory purge interval in seconds, default 10"); -DEFINE_bool(memory_tracker_detail_log, true, "print memory stats detail log"); +DEFINE_bool(memory_tracker_detail_log, false, "print memory stats detail log"); DEFINE_int32(memory_tracker_detail_log_interval_ms, 60000, "print memory stats detail log interval in ms"); diff --git a/src/common/memory/NewDelete.cpp b/src/common/memory/NewDelete.cpp index 5bc67076553..4d7c58caccb 100644 --- a/src/common/memory/NewDelete.cpp +++ b/src/common/memory/NewDelete.cpp @@ -43,22 +43,22 @@ void *operator new[](std::size_t size, std::align_val_t align) { } void *operator new(std::size_t size, const std::nothrow_t &) noexcept { - nebula::memory::trackMemory(size); + nebula::memory::trackMemoryNoThrow(size); return nebula::memory::newNoException(size); } void *operator new[](std::size_t size, const std::nothrow_t &) noexcept { - nebula::memory::trackMemory(size); + nebula::memory::trackMemoryNoThrow(size); return nebula::memory::newNoException(size); } void *operator new(std::size_t size, std::align_val_t align, const std::nothrow_t &) noexcept { - nebula::memory::trackMemory(size, align); + nebula::memory::trackMemoryNoThrow(size, align); return nebula::memory::newNoException(size, align); } void *operator new[](std::size_t size, std::align_val_t align, const std::nothrow_t &) noexcept { - nebula::memory::trackMemory(size, align); + nebula::memory::trackMemoryNoThrow(size, align); return nebula::memory::newNoException(size, align); } diff --git a/src/graph/context/ExecutionContext.cpp b/src/graph/context/ExecutionContext.cpp index 1f1baae0429..762d2da6506 100644 --- a/src/graph/context/ExecutionContext.cpp +++ b/src/graph/context/ExecutionContext.cpp @@ -26,7 +26,7 @@ void ExecutionContext::setResult(const std::string& name, Result&& result) { } void ExecutionContext::dropResult(const std::string& name) { - DCHECK_EQ(valueMap_.count(name), 1); + DCHECK_EQ(valueMap_.count(name), 1) << "not found" << name; auto& val = valueMap_[name]; if (FLAGS_enable_async_gc) { GC::instance().clear(std::move(val)); diff --git a/src/graph/executor/admin/AddHostsExecutor.cpp b/src/graph/executor/admin/AddHostsExecutor.cpp index 462e4043fc6..7cbc5fcfef5 100644 --- a/src/graph/executor/admin/AddHostsExecutor.cpp +++ b/src/graph/executor/admin/AddHostsExecutor.cpp @@ -10,6 +10,7 @@ namespace nebula { namespace graph { folly::Future AddHostsExecutor::execute() { + memory::MemoryCheckGuard guard; SCOPED_TIMER(&execTime_); auto *ahNode = asNode(node()); return qctx() diff --git a/src/graph/executor/admin/ChangePasswordExecutor.cpp b/src/graph/executor/admin/ChangePasswordExecutor.cpp index da5ac0b1761..5283b31f050 100644 --- a/src/graph/executor/admin/ChangePasswordExecutor.cpp +++ b/src/graph/executor/admin/ChangePasswordExecutor.cpp @@ -12,6 +12,7 @@ namespace nebula { namespace graph { folly::Future ChangePasswordExecutor::execute() { + memory::MemoryCheckGuard guard; SCOPED_TIMER(&execTime_); return changePassword(); } diff --git a/src/graph/executor/admin/CharsetExecutor.cpp b/src/graph/executor/admin/CharsetExecutor.cpp index 38b0b360632..bf952b2bf5e 100644 --- a/src/graph/executor/admin/CharsetExecutor.cpp +++ b/src/graph/executor/admin/CharsetExecutor.cpp @@ -7,6 +7,7 @@ namespace nebula { namespace graph { folly::Future ShowCharsetExecutor::execute() { + memory::MemoryCheckGuard guard; SCOPED_TIMER(&execTime_); DataSet dataSet({"Charset", "Description", "Default collation", "Maxlen"}); diff --git a/src/graph/executor/admin/ConfigExecutor.cpp b/src/graph/executor/admin/ConfigExecutor.cpp index a0da15288d5..d6644ebef53 100644 --- a/src/graph/executor/admin/ConfigExecutor.cpp +++ b/src/graph/executor/admin/ConfigExecutor.cpp @@ -57,6 +57,7 @@ folly::Future ShowConfigsExecutor::execute() { } folly::Future SetConfigExecutor::execute() { + memory::MemoryCheckGuard guard; SCOPED_TIMER(&execTime_); auto *scNode = asNode(node()); @@ -97,6 +98,7 @@ folly::Future SetConfigExecutor::execute() { } folly::Future GetConfigExecutor::execute() { + memory::MemoryCheckGuard guard; SCOPED_TIMER(&execTime_); auto *gcNode = asNode(node()); diff --git a/src/graph/executor/admin/KillQueryExecutor.cpp b/src/graph/executor/admin/KillQueryExecutor.cpp index 55d827c6316..454ed84a112 100644 --- a/src/graph/executor/admin/KillQueryExecutor.cpp +++ b/src/graph/executor/admin/KillQueryExecutor.cpp @@ -9,6 +9,7 @@ namespace nebula { namespace graph { folly::Future KillQueryExecutor::execute() { + memory::MemoryCheckGuard guard; SCOPED_TIMER(&execTime_); QueriesMap toBeVerifiedQueries; diff --git a/src/graph/executor/admin/ListRolesExecutor.cpp b/src/graph/executor/admin/ListRolesExecutor.cpp index b2e3639ec80..31a2509121a 100644 --- a/src/graph/executor/admin/ListRolesExecutor.cpp +++ b/src/graph/executor/admin/ListRolesExecutor.cpp @@ -13,6 +13,7 @@ namespace nebula { namespace graph { folly::Future ListRolesExecutor::execute() { + memory::MemoryCheckGuard guard; SCOPED_TIMER(&execTime_); return listRoles(); } diff --git a/src/graph/executor/admin/PartExecutor.cpp b/src/graph/executor/admin/PartExecutor.cpp index 5868b0e6d40..6b48a400955 100644 --- a/src/graph/executor/admin/PartExecutor.cpp +++ b/src/graph/executor/admin/PartExecutor.cpp @@ -11,6 +11,7 @@ using nebula::network::NetworkUtils; namespace nebula { namespace graph { folly::Future ShowPartsExecutor::execute() { + memory::MemoryCheckGuard guard; SCOPED_TIMER(&execTime_); auto* spNode = asNode(node()); diff --git a/src/graph/executor/admin/SessionExecutor.cpp b/src/graph/executor/admin/SessionExecutor.cpp index b27e09e7ae4..d8c9e6ff7c3 100644 --- a/src/graph/executor/admin/SessionExecutor.cpp +++ b/src/graph/executor/admin/SessionExecutor.cpp @@ -12,6 +12,7 @@ namespace nebula { namespace graph { folly::Future ShowSessionsExecutor::execute() { + memory::MemoryCheckGuard guard; SCOPED_TIMER(&execTime_); auto *showNode = asNode(node()); if (showNode->isSetSessionID()) { diff --git a/src/graph/executor/admin/ShowHostsExecutor.cpp b/src/graph/executor/admin/ShowHostsExecutor.cpp index 47a139f105a..94611130346 100644 --- a/src/graph/executor/admin/ShowHostsExecutor.cpp +++ b/src/graph/executor/admin/ShowHostsExecutor.cpp @@ -12,6 +12,7 @@ namespace nebula { namespace graph { folly::Future ShowHostsExecutor::execute() { + memory::MemoryCheckGuard guard; SCOPED_TIMER(&execTime_); return showHosts(); } diff --git a/src/graph/executor/admin/ShowQueriesExecutor.cpp b/src/graph/executor/admin/ShowQueriesExecutor.cpp index ec77ec13f72..096ee4ad0da 100644 --- a/src/graph/executor/admin/ShowQueriesExecutor.cpp +++ b/src/graph/executor/admin/ShowQueriesExecutor.cpp @@ -12,6 +12,7 @@ namespace nebula { namespace graph { folly::Future ShowQueriesExecutor::execute() { + memory::MemoryCheckGuard guard; SCOPED_TIMER(&execTime_); auto* showQueries = asNode(node()); diff --git a/src/graph/executor/admin/ShowServiceClientsExecutor.cpp b/src/graph/executor/admin/ShowServiceClientsExecutor.cpp index 651763f2dc3..14bda537591 100644 --- a/src/graph/executor/admin/ShowServiceClientsExecutor.cpp +++ b/src/graph/executor/admin/ShowServiceClientsExecutor.cpp @@ -14,6 +14,7 @@ namespace nebula { namespace graph { folly::Future ShowServiceClientsExecutor::execute() { + memory::MemoryCheckGuard guard; SCOPED_TIMER(&execTime_); return showServiceClients(); } diff --git a/src/graph/executor/algo/BFSShortestPathExecutor.cpp b/src/graph/executor/algo/BFSShortestPathExecutor.cpp index cf9faafa0d9..c6fc194a76d 100644 --- a/src/graph/executor/algo/BFSShortestPathExecutor.cpp +++ b/src/graph/executor/algo/BFSShortestPathExecutor.cpp @@ -11,7 +11,7 @@ namespace nebula { namespace graph { folly::Future BFSShortestPathExecutor::execute() { // MemoryTrackerVerified - + memory::MemoryCheckGuard guard1; SCOPED_TIMER(&execTime_); pathNode_ = asNode(node()); terminateEarlyVar_ = pathNode_->terminateEarlyVar(); diff --git a/src/graph/executor/algo/BatchShortestPath.cpp b/src/graph/executor/algo/BatchShortestPath.cpp index 95ac030019d..2fa3ebda372 100644 --- a/src/graph/executor/algo/BatchShortestPath.cpp +++ b/src/graph/executor/algo/BatchShortestPath.cpp @@ -15,6 +15,7 @@ namespace graph { folly::Future BatchShortestPath::execute(const HashSet& startVids, const HashSet& endVids, DataSet* result) { + memory::MemoryCheckGuard guard1; // MemoryTrackerVerified size_t rowSize = init(startVids, endVids); std::vector> futures; diff --git a/src/graph/executor/algo/CartesianProductExecutor.cpp b/src/graph/executor/algo/CartesianProductExecutor.cpp index 147b60e5af1..517c755f539 100644 --- a/src/graph/executor/algo/CartesianProductExecutor.cpp +++ b/src/graph/executor/algo/CartesianProductExecutor.cpp @@ -10,6 +10,7 @@ namespace nebula { namespace graph { folly::Future CartesianProductExecutor::execute() { + memory::MemoryCheckGuard guard1; SCOPED_TIMER(&execTime_); auto* cartesianProduct = asNode(node()); diff --git a/src/graph/executor/algo/MultiShortestPathExecutor.cpp b/src/graph/executor/algo/MultiShortestPathExecutor.cpp index d9f0fddff15..47f3633dbb3 100644 --- a/src/graph/executor/algo/MultiShortestPathExecutor.cpp +++ b/src/graph/executor/algo/MultiShortestPathExecutor.cpp @@ -8,6 +8,7 @@ DECLARE_int32(num_operator_threads); namespace nebula { namespace graph { folly::Future MultiShortestPathExecutor::execute() { + memory::MemoryCheckGuard guard1; SCOPED_TIMER(&execTime_); pathNode_ = asNode(node()); terminationVar_ = pathNode_->terminationVar(); diff --git a/src/graph/executor/algo/ProduceAllPathsExecutor.cpp b/src/graph/executor/algo/ProduceAllPathsExecutor.cpp index f2b709a000f..127ea8b149a 100644 --- a/src/graph/executor/algo/ProduceAllPathsExecutor.cpp +++ b/src/graph/executor/algo/ProduceAllPathsExecutor.cpp @@ -11,6 +11,7 @@ DECLARE_int32(num_operator_threads); namespace nebula { namespace graph { folly::Future ProduceAllPathsExecutor::execute() { + memory::MemoryCheckGuard guard1; SCOPED_TIMER(&execTime_); pathNode_ = asNode(node()); noLoop_ = pathNode_->noLoop(); diff --git a/src/graph/executor/algo/ShortestPathExecutor.cpp b/src/graph/executor/algo/ShortestPathExecutor.cpp index 98381a9e72a..2a0823438af 100644 --- a/src/graph/executor/algo/ShortestPathExecutor.cpp +++ b/src/graph/executor/algo/ShortestPathExecutor.cpp @@ -16,6 +16,7 @@ DEFINE_uint32(num_path_thread, 0, "number of concurrent threads when do shortest namespace nebula { namespace graph { folly::Future ShortestPathExecutor::execute() { + memory::MemoryCheckGuard guard1; // MemoryTrackerVerified SCOPED_TIMER(&execTime_); if (FLAGS_num_path_thread == 0) { diff --git a/src/graph/executor/algo/SingleShortestPath.cpp b/src/graph/executor/algo/SingleShortestPath.cpp index fd509d765f6..eb538233053 100644 --- a/src/graph/executor/algo/SingleShortestPath.cpp +++ b/src/graph/executor/algo/SingleShortestPath.cpp @@ -13,6 +13,7 @@ namespace graph { folly::Future SingleShortestPath::execute(const HashSet& startVids, const HashSet& endVids, DataSet* result) { + memory::MemoryCheckGuard guard1; size_t rowSize = startVids.size() * endVids.size(); init(startVids, endVids, rowSize); std::vector> futures; diff --git a/src/graph/executor/algo/SubgraphExecutor.cpp b/src/graph/executor/algo/SubgraphExecutor.cpp index cb3e9ca7634..e7d046c2893 100644 --- a/src/graph/executor/algo/SubgraphExecutor.cpp +++ b/src/graph/executor/algo/SubgraphExecutor.cpp @@ -13,6 +13,7 @@ namespace nebula { namespace graph { folly::Future SubgraphExecutor::execute() { + memory::MemoryCheckGuard guard1; SCOPED_TIMER(&execTime_); totalSteps_ = subgraph_->steps(); auto iter = ectx_->getResult(subgraph_->inputVar()).iter(); diff --git a/src/graph/executor/logic/ArgumentExecutor.cpp b/src/graph/executor/logic/ArgumentExecutor.cpp index 1e74f3ba165..599a0f227b2 100644 --- a/src/graph/executor/logic/ArgumentExecutor.cpp +++ b/src/graph/executor/logic/ArgumentExecutor.cpp @@ -13,6 +13,8 @@ ArgumentExecutor::ArgumentExecutor(const PlanNode *node, QueryContext *qctx) : Executor("ArgumentExecutor", node, qctx) {} folly::Future ArgumentExecutor::execute() { + memory::MemoryCheckGuard guard; + // MemoryTrackerVerified auto *argNode = asNode(node()); auto &alias = argNode->getAlias(); diff --git a/src/graph/executor/logic/LoopExecutor.cpp b/src/graph/executor/logic/LoopExecutor.cpp index e45faaa7696..d86d6fd0ea9 100644 --- a/src/graph/executor/logic/LoopExecutor.cpp +++ b/src/graph/executor/logic/LoopExecutor.cpp @@ -13,6 +13,8 @@ LoopExecutor::LoopExecutor(const PlanNode *node, QueryContext *qctx) : Executor("LoopExecutor", node, qctx) {} folly::Future LoopExecutor::execute() { + memory::MemoryCheckGuard guard; + SCOPED_TIMER(&execTime_); auto *loopNode = asNode(node()); diff --git a/src/graph/executor/logic/PassThroughExecutor.cpp b/src/graph/executor/logic/PassThroughExecutor.cpp index 28101a54770..a47f0ecd5bf 100644 --- a/src/graph/executor/logic/PassThroughExecutor.cpp +++ b/src/graph/executor/logic/PassThroughExecutor.cpp @@ -9,6 +9,8 @@ namespace nebula { namespace graph { folly::Future PassThroughExecutor::execute() { + memory::MemoryCheckGuard guard; + SCOPED_TIMER(&execTime_); const auto &result = ectx_->getResult(node()->outputVar()); diff --git a/src/graph/executor/logic/SelectExecutor.cpp b/src/graph/executor/logic/SelectExecutor.cpp index 3df0d48a066..91c977d7a83 100644 --- a/src/graph/executor/logic/SelectExecutor.cpp +++ b/src/graph/executor/logic/SelectExecutor.cpp @@ -13,6 +13,8 @@ SelectExecutor::SelectExecutor(const PlanNode* node, QueryContext* qctx) : Executor("SelectExecutor", node, qctx) {} folly::Future SelectExecutor::execute() { + memory::MemoryCheckGuard guard; + SCOPED_TIMER(&execTime_); auto* select = asNode