Skip to content

Add Storage Cleanup Logic - #2123

Merged
sadeemsaleh merged 6 commits into
masterfrom
sadeem-materialization-cleanup
Sep 5, 2023
Merged

Add Storage Cleanup Logic#2123
sadeemsaleh merged 6 commits into
masterfrom
sadeem-materialization-cleanup

Conversation

@sadeemsaleh

@sadeemsaleh sadeemsaleh commented Aug 22, 2023

Copy link
Copy Markdown
Contributor

This PR adds logic to clean mongodb results. Below are the changes to this PR and a description of the lifecycle of the cleanup.

  1. assign the execution number to every result so that the results of different executions are persisted,
  2. before compiling the logical DAG to the physical DAG, we store metadata of an execution in MySQL with pointers of where the Mongo collections will be stored,
  3. when we start the server for the first time, we do a one time cleanup to delete the results of those workflows that were killed/aborted , we can identify these workflows if they have a status other than completed because there is no way in our current engine that the workflows are still running/paused etc when the server is just initialized,
  4. then we start a recurring function that periodically deletes expired results based on a configured Time-to-Live,
  5. the function checks MySQL's execution table that already includes the status, pointers to the results, first time, last update time, etc.,
  6. when we delete a result, we also update the pointers in MySQL so that they point to no results, to avoid checking them again.

@sadeemsaleh
sadeemsaleh marked this pull request as draft August 22, 2023 22:22
@sadeemsaleh sadeemsaleh self-assigned this Aug 22, 2023
@sadeemsaleh
sadeemsaleh marked this pull request as ready for review August 22, 2023 23:25
@sadeemsaleh sadeemsaleh added refactor Refactor the code java labels Aug 22, 2023
@sadeemsaleh
sadeemsaleh requested a review from chenlica August 23, 2023 07:35
Comment thread core/amber/src/main/scala/edu/uci/ics/texera/web/TexeraWebApplication.scala Outdated
Comment thread core/amber/src/main/scala/edu/uci/ics/texera/web/TexeraWebApplication.scala Outdated

@shengquan-ni shengquan-ni left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

left some comments.

@shengquan-ni
shengquan-ni self-requested a review September 5, 2023 12:23

@shengquan-ni shengquan-ni left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. will leave the refactoring in a separate PR.

@sadeemsaleh
sadeemsaleh merged commit ec6100f into master Sep 5, 2023
@sadeemsaleh
sadeemsaleh deleted the sadeem-materialization-cleanup branch September 5, 2023 12:46
shengquan-ni added a commit that referenced this pull request Sep 26, 2023
After #2031, the logic in #2123 for updating mongo collection pointers
is missing when we create sink storages. This PR added the missing code
and should fix #2161.
yangzhang75 pushed a commit to yangzhang75/texera that referenced this pull request Jun 22, 2026
This PR adds logic to clean mongodb results. Below are the changes to this PR and a description of the lifecycle of the cleanup.
1. assign the execution number to every result so that the results of different executions are persisted,
2. before compiling the logical DAG to the physical DAG, we store metadata of an execution in MySQL with pointers of where the Mongo collections will be stored,
3. when we start the server for the first time, we do a one time cleanup to delete the results of those workflows that were killed/aborted , we can identify these workflows if they have a status other than completed because there is no way in our current engine that the workflows are still running/paused etc when the server is just initialized,
4. then we start a recurring function that periodically deletes expired results based on a configured Time-to-Live,
5. the function checks MySQL's execution table that already includes the status, pointers to the results, first time, last update time, etc.,
6. when we delete a result, we also update the pointers in MySQL so that they point to no results, to avoid checking them again.

Co-authored-by: Shengquan Ni <13672781+shengquan-ni@users.noreply.github.com>
yangzhang75 pushed a commit to yangzhang75/texera that referenced this pull request Jun 22, 2026
After apache#2031, the logic in apache#2123 for updating mongo collection pointers
is missing when we create sink storages. This PR added the missing code
and should fix apache#2161.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Refactor the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants