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

Fix memory sanitizer issues #1084

Merged
merged 1 commit into from
Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/include/binder/bound_statement.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class BoundStatement {
public:
explicit BoundStatement(StatementType statementType) : statementType{statementType} {}

virtual ~BoundStatement() = default;

inline StatementType getStatementType() const { return statementType; }

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class BoundDeleteNode {
class BoundDeleteClause : public BoundUpdatingClause {
public:
BoundDeleteClause() : BoundUpdatingClause{ClauseType::DELETE} {};
~BoundDeleteClause() override = default;

inline void addDeleteNode(unique_ptr<BoundDeleteNode> deleteNode) {
deleteNodes.push_back(std::move(deleteNode));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class BoundSetClause : public BoundUpdatingClause {

public:
BoundSetClause() : BoundUpdatingClause{ClauseType::SET} {};
~BoundSetClause() override = default;

inline void addSetItem(expression_pair setItem) { setItems.push_back(std::move(setItem)); }

Expand Down
3 changes: 3 additions & 0 deletions src/include/catalog/catalog_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ struct PropertyNameDataType {
}
PropertyNameDataType(string name, DataType dataType)
: name{std::move(name)}, dataType{std::move(dataType)} {};
virtual ~PropertyNameDataType() = default;

string name;
DataType dataType;
Expand Down Expand Up @@ -60,6 +61,8 @@ struct TableSchema {
TableSchema(string tableName, table_id_t tableID, bool isNodeTable)
: tableName{move(tableName)}, tableID{tableID}, isNodeTable{isNodeTable} {}

virtual ~TableSchema() = default;

static inline bool isReservedPropertyName(const string& propertyName) {
return propertyName == INTERNAL_ID_SUFFIX;
}
Expand Down
2 changes: 2 additions & 0 deletions src/include/parser/statement.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class Statement {
public:
explicit Statement(StatementType statementType) : statementType{statementType} {}

virtual ~Statement() = default;

inline StatementType getStatementType() const { return statementType; }

private:
Expand Down
14 changes: 7 additions & 7 deletions src/include/storage/storage_structure/storage_structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class StorageStructure {
}
}

virtual ~StorageStructure() = default;

inline VersionedFileHandle* getFileHandle() { return &fileHandle; }

protected:
Expand Down Expand Up @@ -63,7 +65,11 @@ class StorageStructure {
class BaseColumnOrList : public StorageStructure {

public:
DataTypeID getDataTypeId() const { return dataType.typeID; }
~BaseColumnOrList() override {
if (isInMemory_) {
StorageStructureUtils::unpinEachPageOfFile(fileHandle, bufferManager);
}
}

// Maps the position of element in page to its byte offset in page.
// TODO(Everyone): we should slowly get rid of this function.
Expand All @@ -76,12 +82,6 @@ class BaseColumnOrList : public StorageStructure {
DataType dataType, const size_t& elementSize, BufferManager& bufferManager,
bool hasNULLBytes, bool isInMemory, WAL* wal);

virtual ~BaseColumnOrList() {
if (isInMemory_) {
StorageStructureUtils::unpinEachPageOfFile(fileHandle, bufferManager);
}
}

void readBySequentialCopy(Transaction* transaction, const shared_ptr<ValueVector>& vector,
PageElementCursor& cursor,
const std::function<page_idx_t(page_idx_t)>& logicalToPhysicalPageMapper);
Expand Down
2 changes: 1 addition & 1 deletion src/storage/store/nodes_statistics_and_deleted_ids.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ node_offset_t NodeStatisticsAndDeletedIDs::addNode() {
node_offset_t retVal = *nodeOffsetIter;
iter->second.erase(nodeOffsetIter);
if (iter->second.empty()) {
deletedNodeOffsetsPerMorsel.erase(iter);
hasDeletedNodesPerMorsel[iter->first] = false;
deletedNodeOffsetsPerMorsel.erase(iter);
}
return retVal;
}
Expand Down