Skip to content

Conversation

@EASYGOING45
Copy link
Collaborator

No description provided.

@EASYGOING45 EASYGOING45 added feat A new feature. Correlates with MINOR in SemVer project/monitor project monitor labels Oct 16, 2025
@unique0lai unique0lai requested a review from Copilot October 16, 2025 12:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR changes index rotation logic to skip potentially slow document count operations when a force rotation is requested, reducing timeouts.

  • Prioritizes the force_rotate branch to avoid calling Elasticsearch count
  • Removes the previous elif force_rotate block and adjusts comments/logging accordingly

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +3112 to +3117
if force_rotate: # 强制轮转时,直接进行创建
new_index = current_index_info["index"] + 1
logger.info("update_index_v2:table_id>[%s],index->[%s],will force_rotate", self.table_id, new_index)
elif (bounded_not_expired_alias_length != 0) and (
self.es_client.count(index=last_index_name).get("count", 0) == 0
):
): # 7.1 如果last_index存在已经绑定的别名,且其中的数据为空,那么则进行删除重建操作
Copy link

Copilot AI Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Reordering the condition changes precedence: when force_rotate is True, the 7.1 'delete-and-recreate if empty' branch will no longer execute. Add an explicit comment to document this behavior so future readers understand that force rotation intentionally bypasses the empty-index deletion path to avoid the count call.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat A new feature. Correlates with MINOR in SemVer project/monitor project monitor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant