@@ -70,6 +70,11 @@ def _drop_sql_index_if_exists(store: OracleDocumentStore, index_name: str) -> No
7070 raise
7171
7272
73+ def _skip_if_vector_memory_exhausted (exc : oracledb .DatabaseError ) -> None :
74+ if "ORA-51962" in str (exc ):
75+ pytest .skip ("Oracle vector memory area is exhausted; live vector index creation is unavailable" )
76+
77+
7378@contextmanager
7479def _temporary_store (
7580 connection_config , embedding_dim : int = 4 , * , prefix : str = "HS_IT"
@@ -141,43 +146,53 @@ def test_contains_and_not_contains_filters_live(connection_config) -> None:
141146 assert [doc .content for doc in not_contains_results ] == ["Haystack pipelines" ]
142147
143148
144- def test_hnsw_and_ivf_vector_index_creation_live (connection_config ) -> None :
149+ def test_hnsw_vector_index_creation_live (connection_config ) -> None :
145150 with _temporary_store (connection_config , prefix = "HS_HNSW" ) as hnsw_store :
146151 hnsw_index_name = f"{ hnsw_store .table_name } _HNSW"
147152 hnsw_store .write_documents (
148153 [Document (content = "hnsw" , embedding = [1.0 , 0.0 , 0.0 , 0.0 ])],
149154 policy = DuplicatePolicy .NONE ,
150155 )
151156 try :
152- hnsw_store .create_vector_index (
153- index_type = "HNSW" ,
154- params = {
155- "idx_name" : hnsw_index_name ,
156- "neighbors" : 2 ,
157- "efConstruction" : 16 ,
158- "accuracy" : 80 ,
159- "parallel" : 1 ,
160- },
161- )
157+ try :
158+ hnsw_store .create_vector_index (
159+ index_type = "HNSW" ,
160+ params = {
161+ "idx_name" : hnsw_index_name ,
162+ "neighbors" : 2 ,
163+ "efConstruction" : 16 ,
164+ "accuracy" : 80 ,
165+ "parallel" : 1 ,
166+ },
167+ )
168+ except oracledb .DatabaseError as exc :
169+ _skip_if_vector_memory_exhausted (exc )
170+ raise
162171 finally :
163172 _drop_sql_index_if_exists (hnsw_store , hnsw_index_name )
164173
174+
175+ def test_ivf_vector_index_creation_live (connection_config ) -> None :
165176 with _temporary_store (connection_config , prefix = "HS_IVF" ) as ivf_store :
166177 ivf_index_name = f"{ ivf_store .table_name } _IVF"
167178 ivf_store .write_documents (
168179 [Document (content = "ivf" , embedding = [1.0 , 0.0 , 0.0 , 0.0 ])],
169180 policy = DuplicatePolicy .NONE ,
170181 )
171182 try :
172- ivf_store .create_vector_index (
173- index_type = "IVF" ,
174- params = {
175- "idx_name" : ivf_index_name ,
176- "neighbor_partitions" : 1 ,
177- "accuracy" : 90 ,
178- "parallel" : 1 ,
179- },
180- )
183+ try :
184+ ivf_store .create_vector_index (
185+ index_type = "IVF" ,
186+ params = {
187+ "idx_name" : ivf_index_name ,
188+ "neighbor_partitions" : 1 ,
189+ "accuracy" : 90 ,
190+ "parallel" : 1 ,
191+ },
192+ )
193+ except oracledb .DatabaseError as exc :
194+ _skip_if_vector_memory_exhausted (exc )
195+ raise
181196 finally :
182197 _drop_sql_index_if_exists (ivf_store , ivf_index_name )
183198
@@ -191,15 +206,19 @@ async def test_async_ivf_vector_index_creation_live(connection_config) -> None:
191206 policy = DuplicatePolicy .NONE ,
192207 )
193208 try :
194- await store .create_vector_index_async (
195- index_type = "IVF" ,
196- params = {
197- "idx_name" : index_name ,
198- "neighbor_partitions" : 1 ,
199- "accuracy" : 90 ,
200- "parallel" : 1 ,
201- },
202- )
209+ try :
210+ await store .create_vector_index_async (
211+ index_type = "IVF" ,
212+ params = {
213+ "idx_name" : index_name ,
214+ "neighbor_partitions" : 1 ,
215+ "accuracy" : 90 ,
216+ "parallel" : 1 ,
217+ },
218+ )
219+ except oracledb .DatabaseError as exc :
220+ _skip_if_vector_memory_exhausted (exc )
221+ raise
203222 finally :
204223 _drop_sql_index_if_exists (store , index_name )
205224
0 commit comments