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

[Kernel] [Cleanup] Move SnapshotManager::checkpoint to Checkpointer class #4147

Merged

Conversation

scottsand-db
Copy link
Collaborator

Which Delta project/connector is this regarding?

  • Spark
  • Standalone
  • Flink
  • Kernel
  • Other (fill in here)

Description

This PR moves SnapshotManager::checkpoint to Checkpointer class. This reduces coupling and increases cohesion.

I also tidy up some code and logger statements along the way.

How was this patch tested?

Just a refactor. Existing UTs.

Does this PR introduce any user-facing changes?

No.

/** The name of the last checkpoint file */
public static final String LAST_CHECKPOINT_FILE_NAME = "_last_checkpoint";

public static void checkpoint(Engine engine, Clock clock, SnapshotImpl snapshot)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

nearly a verbatim copy. no logic change. i change the inputs (snapshot instead of version), define tablePath and logPath and version variables, and make some minor logger improvements.

@@ -602,10 +533,7 @@ private Optional<Long> getStartCheckpointVersion(Engine engine, Optional<Long> v
});
})
.orElseGet(
() -> {
logger.info("Loading last checkpoint from the _last_checkpoint file");
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The invoker of a method should only log additional context that the invokee would not know about.

In this case, the invokee should be responsible for printing this.

Copy link
Collaborator

@vkorukanti vkorukanti left a comment

Choose a reason for hiding this comment

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

makes sense to separate it out.

@scottsand-db scottsand-db merged commit b02edc8 into delta-io:master Feb 12, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants