infinity
infinity copied to clipboard
[Bug]: BMP index optimize, segment fault
Is there an existing issue for the same bug?
- [x] I have checked the existing issues.
Version or Commit ID
007127dbf93e577ea308629fcd6903fd958d5a42
Other environment information
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 46 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 48
On-line CPU(s) list: 0-47
Vendor ID: GenuineIntel
Model name: Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz
CPU family: 6
Model: 79
Thread(s) per core: 2
Core(s) per socket: 12
Socket(s): 2
Stepping: 1
CPU(s) scaling MHz: 42%
CPU max MHz: 2900.0000
CPU min MHz: 1200.0000
BogoMIPS: 4400.49
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe sy
scall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni
pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt a
es xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 invpcid_single rsb_ctxsw tpr_shadow vnmi flexpriority
ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed adx smap intel_pt xsaveopt cqm_llc
cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts
Virtualization features:
Virtualization: VT-x
Caches (sum of all):
L1d: 768 KiB (24 instances)
L1i: 768 KiB (24 instances)
L2: 6 MiB (24 instances)
L3: 60 MiB (2 instances)
NUMA:
NUMA node(s): 2
NUMA node0 CPU(s): 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46
NUMA node1 CPU(s): 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47
Vulnerabilities:
Gather data sampling: Not affected
Itlb multihit: KVM: Mitigation: Split huge pages
L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
Mds: Vulnerable: Clear CPU buffers attempted, no microcode; SMT vulnerable
Meltdown: Mitigation; PTI
Mmio stale data: Vulnerable: Clear CPU buffers attempted, no microcode; SMT vulnerable
Retbleed: Not affected
Spec store bypass: Vulnerable
Spectre v1: Mitigation; Load fences, usercopy/swapgs barriers and __user pointer sanitization
Spectre v2: Vulnerable: Retpoline without IBPB
Srbds: Not affected
Tsx async abort: Vulnerable: Clear CPU buffers attempted, no microcode; SMT vulnerable
(myenv) root@77ef10745de6:/home/ubuntu/infinity# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=24.04
DISTRIB_CODENAME=noble
DISTRIB_DESCRIPTION="Ubuntu 24.04.1 LTS"
Actual behavior and How to reproduce it
Error: Infinity Core dump
[18:47:07.428] [29148] [critical] 40, /lib/x86_64-linux-gnu/libc.so.6(+0x9ca94) [0x7fac4eff5a94]
[18:47:07.428] [29148] [critical] 41, /lib/x86_64-linux-gnu/libc.so.6(__clone+0x44) [0x7fac4f082a34]
[18:47:07.443] [29148] [info] Periodic trigger stop ...
Segmentation fault
Reproduce: Pyton3 run.py (below)
# Copyright(C) 2023 InfiniFlow, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
'''
This example is to connect local infinity instance, create table, insert data, search the data
'''
# import infinity_embedded as infinity
from operator import index
import infinity
import sys
import infinity.index as index
from infinity.common import ConflictType, LOCAL_HOST, SparseVector
from infinity.errors import ErrorCode
try:
# Use infinity_embedded module to open a local directory
# infinity_instance = infinity.connect("/var/infinity")
# Use infinity module to connect a remote server
infinity_instance = infinity.connect(infinity.common.NetworkAddress("127.0.0.1", 23817))
# 'default_db' is the default database
db_instance = infinity_instance.get_database("default_db")
# Drop my_table if it already exists
db_instance.drop_table("my_table", infinity.common.ConflictType.Ignore)
# Create a table named "my_table"
table_instance = db_instance.create_table("my_table", {
"num": {"type": "integer"},
"body": {"type": "varchar"},
"vec": {"type": "sparse,100,float,int"}
})
# Insert 3 rows of data into the 'my_table'
table_instance.insert(
[
{
"num": 1,
"body": r"unnecessary and harmful",
"vec": infinity.common.SparseVector([10, 20, 30], [1.1, 2.2, 3.3])
},
{
"num": 2,
"body": r"Office for Harmful Blooms",
"vec": infinity.common.SparseVector([40, 50, 60], [4.4, 5.5, 6.6])
},
{
"num": 3,
"body": r"A Bloom filter is a space-efficient probabilistic data structure, conceived by Burton Howard Bloom in 1970, that is used to test whether an element is a member of a set.",
"vec": infinity.common.SparseVector([70, 80, 90], [7.7, 8.8, 9.9])
},
]
)
res = table_instance.create_index("bmp_index", index.IndexInfo("vec", index.IndexType.BMP,
{
"block_size": "8",
"compress_type": "compress"
}),
ConflictType.Error)
assert res.error_code == ErrorCode.OK
table_instance.optimize("bmp_index", {"topk": "3", "bp_reorder": ""})
result, extra_result = table_instance.output(["num", "vec", "_similarity"]).match_sparse("vec", infinity.common.SparseVector([0, 20, 80], [1.0, 2.0, 3.0]), "ip", 3).to_pl()
print(result)
if extra_result is not None:
print(extra_result)
infinity_instance.disconnect()
print('test done')
sys.exit(0)
except Exception as e:
print(str(e))
sys.exit(-1)
Expected behavior
No response
Additional information
No response
# Copyright(C) 2024 InfiniFlow, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# import infinity_embedded as infinity
import infinity
import sys
import infinity.index as index
from infinity.common import ConflictType, LOCAL_HOST, SparseVector
from infinity.errors import ErrorCode
try:
# Use infinity_embedded module to open a local directory
# infinity_instance = infinity.connect("/var/infinity")
# Use infinity module to connect a remote server
infinity_instance = infinity.connect(infinity.common.NetworkAddress("127.0.0.1", 23817))
# 'default_db' is the default database
db_instance = infinity_instance.get_database("default_db")
# Drop my_table if it already exists
db_instance.drop_table("my_table", infinity.common.ConflictType.Ignore)
# Create a table named "my_table"
table_instance = db_instance.create_table("my_table", {
"num": {"type": "integer"},
"body": {"type": "varchar"},
"vec": {"type": "tensor,4,float"},
})
# Insert 4 rows of data into the 'my_table'
table_instance.insert(
[
{
"num": 1,
"body": r"unnecessary and harmful",
"vec": [[1.0, 0.0, 0.0, 0.0], [1.1, 0.0, 0.0, 0.0]],
},
{
"num": 2,
"body": r"Office for Harmful Blooms",
"vec": [[4.0, 0.0, 4.3, 4.5], [4.0, 4.2, 4.4, 5.0]],
},
{
"num": 3,
"body": r"A Bloom filter is a space-efficient probabilistic data structure, conceived by Burton Howard Bloom in 1970, that is used to test whether an element is a member of a set.",
"vec": [[0.9, 0.1, 0.0, 0.0], [1.1, 0.0, 0.0, 0.0]],
},
{
"num": 4,
"body": r"The American Football Conference (AFC) harm chemical anarchism add test is one of harm chemical the two conferences of the National Football League (NFL). This add test conference and its counterpart, the National Football Conference (NFC), currently contain 16 teams each, making up the 32 teams of the NFL. The current AFC title holder is the New England Patriots.",
"vec": [[4.0, 4.2, 4.3, 4.5], [4.0, 4.2, 4.3, 4.4]],
},
]
)
res = table_instance.create_index("tensor_index", index.IndexInfo("vec", index.IndexType.EMVB,
{
"pq_subspace_num":"1",
"pq_subspace_bits":"8",
}
),
ConflictType.Error)
result, extra_result = table_instance.output(["num", "vec", "_score"]).match_tensor("vec",
[[0.9, 0.0, 0.0, 0.0],
[1.1, 0.0, 0.0, 0.0]],
'float', 2).to_pl()
print(result)
if extra_result is not None:
print(extra_result)
infinity_instance.disconnect()
print('test done')
sys.exit(0)
except Exception as e:
print(str(e))
sys.exit(-1)
same with emvb