Only Log Index Attempt CC Pair Miscount (#1355)

This commit is contained in:
Yuhong Sun 2024-04-20 09:25:08 -07:00 committed by GitHub
parent 58545ccf3a
commit 4e9605e652
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -295,6 +295,9 @@ def count_unique_cc_pairs_with_successful_index_attempts(
embedding_model_id: int | None,
db_session: Session,
) -> int:
"""Collect all of the Index Attempts that are successful and for the specified embedding model
Then do distinct by connector_id and credential_id which is equivalent to the cc-pair. Finally,
do a count to get the total number of unique cc-pairs with successful attempts"""
unique_pairs_count = (
db_session.query(IndexAttempt.connector_id, IndexAttempt.credential_id)
.filter(

View File

@ -31,8 +31,10 @@ def check_index_swap(db_session: Session) -> None:
embedding_model_id=embedding_model.id, db_session=db_session
)
# Index Attempts are cleaned up as well when the cc-pair is deleted so the logic in this
# function is correct. The unique_cc_indexings are specifically for the existing cc-pairs
if unique_cc_indexings > cc_pair_count:
raise RuntimeError("More unique indexings than cc pairs, should not occur")
logger.error("More unique indexings than cc pairs, should not occur")
if cc_pair_count == 0 or cc_pair_count == unique_cc_indexings:
# Swap indices