mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-05-04 17:27:50 +08:00
Fix: judge table name prefix before migrate (#13094)
### What problem does this PR solve? Judge table created with current infinity mapping before migrate db. #13089 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -33,12 +33,13 @@ from common.doc_store.doc_store_base import DocStoreConnection, MatchExpr, Order
|
||||
|
||||
|
||||
class InfinityConnectionBase(DocStoreConnection):
|
||||
def __init__(self, mapping_file_name: str = "infinity_mapping.json", logger_name: str = "ragflow.infinity_conn"):
|
||||
def __init__(self, mapping_file_name: str = "infinity_mapping.json", logger_name: str = "ragflow.infinity_conn", table_name_prefix: str="ragflow_"):
|
||||
from common.doc_store.infinity_conn_pool import INFINITY_CONN
|
||||
|
||||
self.dbName = settings.INFINITY.get("db_name", "default_db")
|
||||
self.mapping_file_name = mapping_file_name
|
||||
self.logger = logging.getLogger(logger_name)
|
||||
self.table_name_prefix = table_name_prefix
|
||||
infinity_uri = settings.INFINITY["uri"]
|
||||
if ":" in infinity_uri:
|
||||
host, port = infinity_uri.split(":")
|
||||
@ -77,6 +78,9 @@ class InfinityConnectionBase(DocStoreConnection):
|
||||
schema = json.load(f)
|
||||
table_names = inf_db.list_tables().table_names
|
||||
for table_name in table_names:
|
||||
if not table_name.startswith(self.table_name_prefix):
|
||||
# Skip tables not created by me
|
||||
continue
|
||||
inf_table = inf_db.get_table(table_name)
|
||||
index_names = inf_table.list_indexes().index_names
|
||||
if "q_vec_idx" not in index_names:
|
||||
|
||||
@ -30,7 +30,7 @@ from common.time_utils import date_string_to_timestamp
|
||||
@singleton
|
||||
class InfinityConnection(InfinityConnectionBase):
|
||||
def __init__(self):
|
||||
super().__init__(mapping_file_name="message_infinity_mapping.json")
|
||||
super().__init__(mapping_file_name="message_infinity_mapping.json", table_name_prefix="memory_")
|
||||
|
||||
"""
|
||||
Dataframe and fields convert
|
||||
|
||||
Reference in New Issue
Block a user