Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Optimize LoadsHistorySyncer #53864

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

gengjun-git
Copy link
Contributor

@gengjun-git gengjun-git commented Dec 12, 2024

Why I'm doing:

  1. If there are no load jobs, LoadsHistorySyncer still runs.
  2. LoadsHistorySyncer does not ignore its own load job, so cause Infinite loop.

What I'm doing:

  1. Record the last sync time, if there are no new load jobs, do not run sync SQL.
  2. Ignore the LoadsHistorySyncer triggered dml SQL.

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.4
    • 3.3
    • 3.2
    • 3.1
    • 3.0

@gengjun-git gengjun-git changed the title [Enhancement] Opt load history sync [Enhancement] Optimize LoadsHistorySyncer logic Dec 12, 2024
@gengjun-git gengjun-git changed the title [Enhancement] Optimize LoadsHistorySyncer logic [Enhancement] Optimize LoadsHistorySyncer Dec 12, 2024
LOG.warn("failed to get db: {}, table: {}", LOADS_HISTORY_DB_NAME, LOADS_HISTORY_TABLE_NAME);
return;
}
long latestFinishTime = GlobalStateMgr.getCurrentState().getLoadMgr()
Copy link
Contributor

Choose a reason for hiding this comment

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

also need to check StreamLoadMgr

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

nshangyiming
nshangyiming previously approved these changes Dec 12, 2024
Copy link

[FE Incremental Coverage Report]

pass : 40 / 41 (97.56%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/load/loadv2/LoadsHistorySyncer.java 19 20 95.00% [155]
🔵 com/starrocks/load/streamload/StreamLoadMgr.java 8 8 100.00% []
🔵 com/starrocks/load/loadv2/LoadMgr.java 12 12 100.00% []
🔵 com/starrocks/load/loadv2/InsertLoadJob.java 1 1 100.00% []

@gengjun-git gengjun-git enabled auto-merge (squash) December 13, 2024 06:13
if (syncedLoadFinishTime < latestFinishTime) {
syncData();
// refer to SQL:LOADS_HISTORY_SYNC. Only sync loads that completed more than 1 minute ago
long oneMinAgo = System.currentTimeMillis() - 60000;
Copy link
Contributor

Choose a reason for hiding this comment

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

before syncData()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@gengjun-git
Copy link
Contributor Author

@Mergifyio rebase

Signed-off-by: gengjun-git <[email protected]>
Signed-off-by: gengjun-git <[email protected]>
Signed-off-by: gengjun-git <[email protected]>
Signed-off-by: gengjun-git <[email protected]>
Signed-off-by: gengjun-git <[email protected]>
Signed-off-by: gengjun-git <[email protected]>
Copy link
Contributor

mergify bot commented Dec 13, 2024

rebase

✅ Branch has been successfully rebased

@gengjun-git gengjun-git force-pushed the opt_load_history_sync branch from 37c1158 to 2b6267e Compare December 13, 2024 11:56
Copy link

sonarcloud bot commented Dec 13, 2024

Copy link

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

[BE Incremental Coverage Report]

pass : 0 / 0 (0%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants