Skip to content

Commit

Permalink
fix(tianm):oltp_read_write.lua sysbench returned error 1366(#1371)
Browse files Browse the repository at this point in the history
Cause of the problem:
The bit bitmap was not initialized when it was created, resulting in the subsequent data confusion
  • Loading branch information
konghaiya committed Mar 9, 2023
1 parent d66a3ca commit 1fbc54d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion storage/tianmu/util/bitset.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#ifndef TIANMU_UTIL_BITSET_H_
#define TIANMU_UTIL_BITSET_H_
#pragma once

#include<string.h>
namespace Tianmu {
namespace utils {

Expand All @@ -32,6 +32,7 @@ class BitSet {
ptr_ = new char[(sz + NO_OF_BITS - 1) / NO_OF_BITS]();
allocated_ = true;
}
memset(ptr_, 0, (sz + NO_OF_BITS - 1) / NO_OF_BITS);
}

~BitSet() {
Expand All @@ -50,6 +51,7 @@ class BitSet {
ptr_ = new char[(sz + NO_OF_BITS - 1) / NO_OF_BITS]();
allocated_ = true;
}
memset(ptr_, 0, (sz + NO_OF_BITS - 1) / NO_OF_BITS);
}

bool operator[](size_t pos) const { return ptr_[pos / NO_OF_BITS] & (1U << (pos % NO_OF_BITS)); }
Expand Down

0 comments on commit 1fbc54d

Please sign in to comment.