Skip to content

Commit

Permalink
Revert "[Enhancement] upgrade roaring bitmap lib to v1.1.3 (StarRocks…
Browse files Browse the repository at this point in the history
…#23502)"

This reverts commit e6ee2f3.
  • Loading branch information
kangkaisen committed Jun 6, 2023
1 parent 89aaff6 commit ed48970
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 28 deletions.
2 changes: 1 addition & 1 deletion be/src/storage/del_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ string DelVector::to_string() const {
void DelVector::_update_stats() {
// TODO(cbl): optimization
if (_roaring) {
roaring::api::roaring_statistics_t st;
roaring_statistics_t st;
roaring_bitmap_statistics(&_roaring->roaring, &st);
_memory_usage = st.n_bytes_array_containers + st.n_bytes_bitset_containers + st.n_bytes_run_containers;
//_memory_usage = _roaring->getSizeInBytes(false);
Expand Down
2 changes: 0 additions & 2 deletions be/src/storage/del_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@

namespace starrocks {

using Roaring = roaring::Roaring;

// A bitmap(uint32_t set) to store all the deleted rows' ids of a segment.
// Each DelVector is associated with a version, which is EditVersion's majar version.
// Serialization format:
Expand Down
2 changes: 0 additions & 2 deletions be/src/storage/rowset/bitmap_index_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@

namespace starrocks {

using Roaring = roaring::Roaring;

BitmapIndexReader::BitmapIndexReader() {
MEM_TRACKER_SAFE_CONSUME(ExecEnv::GetInstance()->bitmap_index_mem_tracker(), sizeof(BitmapIndexReader));
}
Expand Down
2 changes: 0 additions & 2 deletions be/src/storage/rowset/bitmap_index_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ class BitmapIndexIterator;
class IndexedColumnReader;
class IndexedColumnIterator;

using Roaring = roaring::Roaring;

class BitmapIndexReader {
public:
BitmapIndexReader();
Expand Down
4 changes: 3 additions & 1 deletion be/src/storage/rowset/bitmap_index_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

namespace starrocks {

using Roaring = roaring::Roaring;
namespace {

class BitmapUpdateContext {
static const size_t estimate_size_threshold = 1024;
Expand Down Expand Up @@ -269,6 +269,8 @@ class BitmapIndexWriterImpl : public BitmapIndexWriter {
mutable std::vector<BitmapUpdateContext*> _late_update_context_vector;
};

} // namespace

struct BitmapIndexWriterBuilder {
template <LogicalType ftype>
std::unique_ptr<BitmapIndexWriter> operator()(const TypeInfoPtr& typeinfo) {
Expand Down
4 changes: 2 additions & 2 deletions be/src/storage/rowset/bitmap_range_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ class BitmapRangeIterator {

private:
void _read_next_batch() {
uint32_t n = roaring::api::roaring_read_uint32_iterator(&_iter, _buf, kBatchSize);
uint32_t n = roaring_read_uint32_iterator(&_iter, _buf, kBatchSize);
_buf_pos = 0;
_buf_size = n;
_eof = n == 0;
}

static const uint32_t kBatchSize = 256;

roaring::api::roaring_uint32_iterator_t _iter{};
roaring_uint32_iterator_t _iter{};
uint32_t _last_val{0};
uint32_t _buf_pos{0};
uint32_t _buf_size{0};
Expand Down
2 changes: 1 addition & 1 deletion be/src/storage/rowset/segment_iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ class SegmentIterator final : public ChunkIterator {
Status _get_dcg_st;
DelVectorPtr _del_vec;
DeltaColumnGroupList _dcgs;
roaring::api::roaring_uint32_iterator_t _roaring_iter;
roaring_uint32_iterator_t _roaring_iter;

std::unordered_map<ColumnId, std::unique_ptr<RandomAccessFile>> _column_files;

Expand Down
7 changes: 0 additions & 7 deletions be/src/types/bitmap_value_detail.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,6 @@ struct BitmapTypeCode {

namespace detail {

// https://github.com/RoaringBitmap/CRoaring/blob/5d6dd2342d9e3ffaf481aa5ebe344e19984faa4a/src/roaring.c#L21
// The tow macro is not in .h file, so copy to here.
#define SERIALIZATION_ARRAY_UINT32 1
#define SERIALIZATION_CONTAINER 2

using Roaring = roaring::Roaring;

class Roaring64MapSetBitForwardIterator;

// Forked from https://github.com/RoaringBitmap/CRoaring/blob/v0.2.60/cpp/roaring64map.hh
Expand Down
4 changes: 2 additions & 2 deletions be/test/types/bitmap_value_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ TEST(BitmapValueTest, bitmap_serde) {
BitmapValue bitmap32(std::vector<uint64_t>{0, UINT32_MAX});
std::string buffer = convert_bitmap_to_string(bitmap32);

roaring::Roaring roaring;
Roaring roaring;
roaring.add(0);
roaring.add(UINT32_MAX);
std::string expect_buffer(1, type_bitmap32);
Expand Down Expand Up @@ -209,7 +209,7 @@ TEST(BitmapValueTest, bitmap_serde) {
BitmapValue bitmap64(std::vector<uint64_t>{0, static_cast<uint64_t>(UINT32_MAX) + 1});
std::string buffer = convert_bitmap_to_string(bitmap64);

roaring::Roaring roaring;
Roaring roaring;
roaring.add(0);
std::string expect_buffer(1, type_bitmap64);
put_varint64(&expect_buffer, 2); // map size
Expand Down
4 changes: 0 additions & 4 deletions thirdparty/build-thirdparty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -685,8 +685,6 @@ build_bitshuffle() {
}

# croaring bitmap
# If open AVX512 default, current version will be compiled failed on some machine, so close AVX512 default,
# When this problem is solved, a switch will be added to control.
build_croaringbitmap() {
FORCE_AVX=ON
# avx2 is not supported by aarch64.
Expand All @@ -707,8 +705,6 @@ build_croaringbitmap() {
-DENABLE_ROARING_TESTS=OFF \
-DROARING_DISABLE_NATIVE=ON \
-DFORCE_AVX=$FORCE_AVX \
-DROARING_DISABLE_AVX512=ON \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_LIBRARY_PATH="$TP_INSTALL_DIR/lib;$TP_INSTALL_DIR/lib64" ..
${BUILD_SYSTEM} -j$PARALLEL
${BUILD_SYSTEM} install
Expand Down
8 changes: 4 additions & 4 deletions thirdparty/vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,10 @@ BITSHUFFLE_SOURCE=bitshuffle-0.5.1
BITSHUFFLE_MD5SUM="b3bf6a9838927f7eb62214981c138e2f"

# CROARINGBITMAP
CROARINGBITMAP_DOWNLOAD="https://github.com/RoaringBitmap/CRoaring/archive/refs/tags/v1.1.3.tar.gz"
CROARINGBITMAP_NAME=CRoaring-1.1.3.tar.gz
CROARINGBITMAP_SOURCE=CRoaring-1.1.3
CROARINGBITMAP_MD5SUM="605924d21c14c760e66466799215868f"
CROARINGBITMAP_DOWNLOAD="https://github.com/RoaringBitmap/CRoaring/archive/v0.2.60.tar.gz"
CROARINGBITMAP_NAME=CRoaring-0.2.60.tar.gz
CROARINGBITMAP_SOURCE=CRoaring-0.2.60
CROARINGBITMAP_MD5SUM="29602918e6890ffdeed84cb171857046"

# jemalloc
JEMALLOC_DOWNLOAD="https://github.com/jemalloc/jemalloc/releases/download/5.2.1/jemalloc-5.2.1.tar.bz2"
Expand Down

0 comments on commit ed48970

Please sign in to comment.