StarRocks / starrocks

StarRocks, a Linux Foundation project, is a next-generation sub-second MPP OLAP database for full analytics scenarios, including multi-dimensional analytics, real-time analytics, and ad-hoc queries.
https://starrocks.io
Apache License 2.0
8.67k stars 1.75k forks source link

[BITMAP BUG] BITMAP_FROM_STRING #7320

Closed szza closed 2 years ago

szza commented 2 years ago

The create table sql is :

CREATE TABLE pv_bitmap (
    dt INT(11) NULL COMMENT "",
    page VARCHAR(10) NULL COMMENT "",
    user_id bitmap BITMAP_UNION NULL COMMENT ""
) ENGINE=OLAP
AGGREGATE KEY(dt, page)
COMMENT "OLAP"
DISTRIBUTED BY HASH(dt) BUCKETS 2;

and then use following sql to load data:

insert into  pv_bitmap (dt,page,user_id) VALUES (1,1,BITMAP_FROM_STRING('0,1,2,3,4,5,6,7,8'));

and then crash:

(gdb) bt
#0  0x00000000073edb40 in ra_portable_serialize ()
#1  0x00000000046238fa in Roaring::write (this=0xe8a11f8, buf=0xe6a1711 ";0", portable=true) at /var/local/thirdparty/installed/include/roaring/roaring.hh:436
#2  0x0000000004feb8c4 in starrocks::detail::Roaring64Map::write (this=0xe896c40, buf=0xe6a1711 ";0", serialize_version=1) at /root/starrocks/be/src/util/bitmap_value.h:584
#3  0x0000000004fec0b6 in starrocks::BitmapValue::write (this=0xe896c80, dst=0xe6a1710 "\002;0") at /root/starrocks/be/src/util/bitmap_value.h:1589
#4  0x0000000004fec597 in starrocks::BitmapValue::serialize (this=0xe896c80, dst=0xe6a1710 "\002;0") at /root/starrocks/be/src/util/bitmap_value.h:1731
#5  0x0000000004fef270 in starrocks::vectorized::ObjectColumn<starrocks::BitmapValue>::_build_slices (this=0xe87f570) at /root/starrocks/be/src/column/object_column.cpp:251
#6  0x00000000045469ec in starrocks::vectorized::ObjectColumn<starrocks::BitmapValue>::raw_data (this=0xe87f570) at /root/starrocks/be/src/column/object_column.h:50
#7  0x0000000004fe3e5b in starrocks::vectorized::NullableColumn::raw_data (this=0xe896100) at /root/starrocks/be/src/column/nullable_column.h:69
#8  0x0000000004705623 in starrocks::ScalarColumnWriter::append (this=0xe75f1d0, column=...) at /root/starrocks/be/src/storage/rowset/column_writer.cpp:620
#9  0x00000000044ca05a in starrocks::SegmentWriter::append_chunk (this=0xe716780, chunk=...) at /root/starrocks/be/src/storage/rowset/segment_writer.cpp:295
#10 0x000000000499400c in starrocks::HorizontalBetaRowsetWriter::flush_chunk (this=0xdb83680, chunk=...) at /root/starrocks/be/src/storage/rowset/beta_rowset_writer.cpp:292
#11 0x0000000004915c89 in starrocks::vectorized::MemTable::flush (this=0xe716500) at /root/starrocks/be/src/storage/vectorized/memtable.cpp:197
#12 0x000000000462d334 in starrocks::FlushToken::_flush_memtable (this=0xe977600, memtable=0xe716500) at /root/starrocks/be/src/storage/memtable_flush_executor.cpp:82
#13 0x000000000462e4ab in starrocks::MemtableFlushTask::run (this=0xe868fa0) at /root/starrocks/be/src/storage/memtable_flush_executor.cpp:42
#14 0x0000000004bf0541 in starrocks::ThreadPool::dispatch_thread (this=0xd94ee00) at /root/starrocks/be/src/util/threadpool.cpp:514
#15 0x0000000004bfcd0e in std::__invoke_impl<void, void (starrocks::ThreadPool::*&)(), starrocks::ThreadPool*&> (__f=@0xdba9520: (void (starrocks::ThreadPool::*)(starrocks::ThreadPool * const)) 0x4befe10 <starrocks::ThreadPool::dispatch_thread()>,
    __t=@0xdba9530: 0xd94ee00) at /usr/include/c++/10.3.0/bits/invoke.h:73
#16 0x0000000004bfc7b5 in std::__invoke<void (starrocks::ThreadPool::*&)(), starrocks::ThreadPool*&> (__fn=@0xdba9520: (void (starrocks::ThreadPool::*)(starrocks::ThreadPool * const)) 0x4befe10 <starrocks::ThreadPool::dispatch_thread()>)
    at /usr/include/c++/10.3.0/bits/invoke.h:95
#17 0x0000000004bfc052 in std::_Bind<void (starrocks::ThreadPool::*(starrocks::ThreadPool*))()>::__call<void, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) (this=0xdba9520, __args=...) at /usr/include/c++/10.3.0/functional:416
#18 0x0000000004bfb540 in std::_Bind<void (starrocks::ThreadPool::*(starrocks::ThreadPool*))()>::operator()<, void>() (this=0xdba9520) at /usr/include/c++/10.3.0/functional:499
#19 0x0000000004bfa1ce in std::__invoke_impl<void, std::_Bind<void (starrocks::ThreadPool::*(starrocks::ThreadPool*))()>&>(std::__invoke_other, std::_Bind<void (starrocks::ThreadPool::*(starrocks::ThreadPool*))()>&) (__f=...)
    at /usr/include/c++/10.3.0/bits/invoke.h:60
#20 0x0000000004bf8f40 in std::__invoke_r<void, std::_Bind<void (starrocks::ThreadPool::*(starrocks::ThreadPool*))()>&>(std::_Bind<void (starrocks::ThreadPool::*(starrocks::ThreadPool*))()>&) (__fn=...) at /usr/include/c++/10.3.0/bits/invoke.h:110
#21 0x0000000004bf7315 in std::_Function_handler<void (), std::_Bind<void (starrocks::ThreadPool::*(starrocks::ThreadPool*))()> >::_M_invoke(std::_Any_data const&) (__functor=...) at /usr/include/c++/10.3.0/bits/std_function.h:291
#22 0x000000000426733c in std::function<void ()>::operator()() const (this=0xdabc638) at /usr/include/c++/10.3.0/bits/std_function.h:622
#23 0x0000000004be7720 in starrocks::Thread::supervise_thread (arg=0xdabc620) at /root/starrocks/be/src/util/thread.cpp:327
#24 0x00007fb25701eea5 in start_thread () from /lib64/libpthread.so.0
#25 0x00007fb256639b0d in clone () from /lib64/libc.so.6

StarRocks version (Required)

branch 2.1 ~ branch 2.2 all have this problem.

mysql> select current_version();
+-------------------+
| current_version() |
+-------------------+
| UNKNOWN 147f178   |
+-------------------+
1 row in set (0.11 sec)

linux kernal

# uname  -a
Linux 732a8cf385b2 3.10.0-1160.62.1.el7.x86_64 #1 SMP Tue Apr 5 16:57:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

but it is noraml when run on another machine that linux kernel is

Linux k8s-master01.internal.chinacloudapp.cn 3.10.0-862.11.6.el7.x86_64 #1 SMP Tue Aug 14 21:49:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
stdpain commented 2 years ago

cat /proc/cpuinfo |grep avx2 and see output

szza commented 2 years ago

@stdpain nothing in output

$ cat /proc/cpuinfo | grep avx2

but I have disable the avx2 in build.sh


if [[ -z ${USE_AVX2} ]]; then
USE_AVX2=OFF
fi
if [[ -z ${USE_SSE4_2} ]]; then
USE_SSE4_2=ON
fi


> `cat /proc/cpuinfo |grep avx2` and see output
stdpain commented 2 years ago

CRoaringBitmap is compiled using AVX2 in the docker precompiled environment, you need to compile CRoaringBitmap manually

szza commented 2 years ago

CRoaringBitmap is compiled using AVX2 in the docker precompiled environment, you need to compile CRoaringBitmap manually

@stdpain thx very much !!!