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

[AMORO-2365] Fix get target snapshot NPE when commiting #2366

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

HuangFru
Copy link
Contributor

@HuangFru HuangFru commented Nov 27, 2023

Why are the changes needed?

Close #2365.

Brief change log

  • Add 'PLANNING' status in `OptimizingProcess.Status' and set it as default.
  • Generic the TableOptimizingProcess when the table is planning and update it after planned.
  • Change judgment in 'SnapshotExpire' to not expire the snapshot that is used for planning.
  • Change the init SQL to make 'optimizing_type' default null.

How was this patch tested?

  • Add some test cases that check the changes thoroughly including negative and positive cases if possible

  • Add screenshots for manual tests if appropriate

  • Run test locally before making a pull request

Documentation

  • Does this pull request introduce a new feature? (no)
  • If yes, how is the feature documented? (not applicable)

@HuangFru HuangFru marked this pull request as draft November 27, 2023 11:10
@github-actions github-actions bot added the module:ams-dashboard Ams dashboard module label Nov 27, 2023
Copy link

codecov bot commented Nov 27, 2023

Codecov Report

Attention: 21 lines in your changes are missing coverage. Please review.

Comparison is base (24dbeed) 53.14% compared to head (11c3582) 52.77%.

Files Patch % Lines
...ease/arctic/server/optimizing/OptimizingQueue.java 76.00% 7 Missing and 5 partials ⚠️
...er/table/executor/TableRuntimeRefreshExecutor.java 20.00% 3 Missing and 1 partial ⚠️
.../arctic/server/dashboard/utils/OptimizingUtil.java 0.00% 2 Missing ⚠️
.../com/netease/arctic/server/table/TableRuntime.java 80.00% 1 Missing and 1 partial ⚠️
.../optimizing/maintainer/IcebergTableMaintainer.java 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2366      +/-   ##
============================================
- Coverage     53.14%   52.77%   -0.38%     
- Complexity     3785     4374     +589     
============================================
  Files           488      534      +46     
  Lines         25641    30384    +4743     
  Branches       2450     2967     +517     
============================================
+ Hits          13628    16035    +2407     
- Misses        10953    13059    +2106     
- Partials       1060     1290     +230     
Flag Coverage Δ
core 53.11% <71.62%> (-0.04%) ⬇️
trino 50.93% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@HuangFru HuangFru marked this pull request as ready for review November 29, 2023 07:20
@HuangFru
Copy link
Contributor Author

When the table is planning:
image

image

After planning:
image

image

When the table is planning:
image
image

Restart the AMS:
image

When the table is planning I set self-optimizing.enabled to 'fasle':
image
image

Copy link
Contributor

@wangtaohz wangtaohz left a comment

Choose a reason for hiding this comment

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

I left some comments, please take a look @HuangFru

HuangFru and others added 7 commits December 6, 2023 09:57
…-npe

# Conflicts:
#	ams/server/src/main/java/com/netease/arctic/server/optimizing/OptimizingQueue.java
#	ams/server/src/main/java/com/netease/arctic/server/optimizing/maintainer/IcebergTableMaintainer.java
#	ams/server/src/main/java/com/netease/arctic/server/table/executor/TableRuntimeRefreshExecutor.java
@HuangFru HuangFru marked this pull request as draft December 6, 2023 06:10
@HuangFru HuangFru marked this pull request as ready for review December 6, 2023 06:50
@HuangFru
Copy link
Contributor Author

HuangFru commented Dec 6, 2023

I left some comments, please take a look @HuangFru

Fixed.

private volatile String failedReason;
private long endTime = ArcticServiceConstants.INVALID_TIME;
private Map<String, Long> fromSequence = Maps.newHashMap();
private Map<String, Long> toSequence = Maps.newHashMap();
private final OptimizingPlanner planner;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the main issue here is that the planner, as a field of the optimizing process, is not being persisted, which leads to the process having to be closed after restarting AMS.
My suggestion is not to add this field planner, but instead to construct a new planner when calling planTasks() and pass it as a parameter, and the targetSnapshotId and targetChangeSnapshotId will be set when planning tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module:ams-dashboard Ams dashboard module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Expired the snapshot that is planning in optimizing process
2 participants