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 ec75c28
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions storage/tianmu/util/bitset.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#define TIANMU_UTIL_BITSET_H_
#pragma once

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

Expand All @@ -32,6 +33,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 +52,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 ec75c28

Please sign in to comment.