Skip to content

Commit

Permalink
[Spark][4.0] Rename managed commit to coordinated commits (#3241)
Browse files Browse the repository at this point in the history
<!--
Thanks for sending a pull request!  Here are some tips for you:
1. If this is your first time, please read our contributor guidelines:
https://github.com/delta-io/delta/blob/master/CONTRIBUTING.md
2. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP]
Your PR title ...'.
  3. Be sure to keep the PR description updated to reflect all changes.
  4. Please write your PR title to summarize what this PR proposes.
5. If possible, provide a concise example to reproduce the issue for a
faster review.
6. If applicable, include the corresponding issue number in the PR title
and link it in the body.
-->

#### Which Delta project/connector is this regarding?
<!--
Please add the component selected below to the beginning of the pull
request title
For example: [Spark] Title of my pull request
-->

- [x] Spark
- [ ] Standalone
- [ ] Flink
- [ ] Kernel
- [x] Other (RFC)

## Description

<!--
- Describe what this PR changes.
- Describe why we need the change.
 
If this PR resolves an issue be sure to include "Resolves #XXX" to
correctly link and close the issue upon merge.
-->
Renames Managed Commit to Coordinated Commits and Commit Owner to Commit
Coordinator to better express the meaning of the feature. Configs, table
feature name, classes, functions, comments, file names, and directory
names have all been updated to reflect the new terminology.


## How was this patch tested?

<!--
If tests were added, say they were added here. Please make sure to test
the changes thoroughly including negative and positive cases if
possible.
If the changes were tested in any way other than unit tests, please
clarify how you tested step by step (ideally copy and paste-able, so
that other reviewers can test and check, and descendants can verify in
the future).
If the changes were not tested, please explain why.
-->
Existing tests should cover these changes.

## Does this PR introduce _any_ user-facing changes?

<!--
If yes, please clarify the previous behavior and the change this PR
proposes - provide the console output, description and/or an example to
show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change
compared to the released Delta Lake versions or within the unreleased
branches such as master.
If no, write 'No'.
-->
Yes, the feature name and config names have changed.
  • Loading branch information
dhruvarya-db authored Jun 9, 2024
1 parent d5d01c9 commit 26f67e9
Show file tree
Hide file tree
Showing 51 changed files with 1,959 additions and 1,808 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ lazy val spark = (project in file("spark"))
"org.apache.spark" %% "spark-sql" % sparkVersion.value % "provided",
"org.apache.spark" %% "spark-core" % sparkVersion.value % "provided",
"org.apache.spark" %% "spark-catalyst" % sparkVersion.value % "provided",
// For DynamoDBCommitStore
// For DynamoDBCommitCoordinator
"com.amazonaws" % "aws-java-sdk" % "1.12.262" % "provided",

// Test deps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,9 @@ private[internal] class OptimisticTransactionImpl(
private def shouldCheckpoint(committedVersion: Long): Boolean = {
val checkpointingEnabled =
deltaLog.hadoopConf.getBoolean(StandaloneHadoopConf.CHECKPOINTING_ENABLED, true)
checkpointingEnabled && committedVersion != 0 && committedVersion % deltaLog.checkpointInterval == 0
checkpointingEnabled &&
committedVersion != 0 &&
committedVersion % deltaLog.checkpointInterval == 0
}

/** Returns the next attempt version given the last attempted version */
Expand Down
2 changes: 1 addition & 1 deletion protocol_rfcs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Here is the history of all the RFCs propose/accepted/rejected since Feb 6, 2024,
|:--------------|:---------------------------------------------------------------------------------------------------------------------------------|:----------------------------------------------|:---------------------------------------|
| 2023-02-02 | [in-commit-timestamps.md](https://github.com/delta-io/delta/blob/master/protocol_rfcs/in-commit-timestamps.md) | https://github.com/delta-io/delta/issues/2532 | In-Commit Timestamps |
| 2023-02-09 | [type-widening.md](https://github.com/delta-io/delta/blob/master/protocol_rfcs/type-widening.md) | https://github.com/delta-io/delta/issues/2623 | Type Widening |
| 2023-02-14 | [managed-commits.md](https://github.com/delta-io/delta/blob/master/protocol_rfcs/managed-commits.md) | https://github.com/delta-io/delta/issues/2598 | Managed Commits |
| 2023-02-14 | [coordinated-commits.md](https://github.com/delta-io/delta/blob/master/protocol_rfcs/coordinated-commits.md) | https://github.com/delta-io/delta/issues/2598 | Coordinated Commits |
| 2023-02-26 | [column-mapping-usage.tracking.md](https://github.com/delta-io/delta/blob/master/protocol_rfcs/column-mapping-usage-tracking.md) | https://github.com/delta-io/delta/issues/2682 | Column Mapping Usage Tracking |
| 2023-04-24 | [variant-type.md](https://github.com/delta-io/delta/blob/master/protocol_rfcs/variant-type.md) | https://github.com/delta-io/delta/issues/2864 | Variant Data Type |
| 2024-04-30 | [collated-string-type.md](https://github.com/delta-io/delta/blob/master/protocol_rfcs/collated-string-type.md) | https://github.com/delta-io/delta/issues/2894 | Collated String Type |
Expand Down
202 changes: 101 additions & 101 deletions protocol_rfcs/managed-commits.md → protocol_rfcs/coordinated-commits.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@
* limitations under the License.
*/

package io.delta.dynamodbcommitstore;
package io.delta.dynamodbcommitcoordinator;

import org.apache.spark.sql.delta.managedcommit.AbstractMetadata;
import org.apache.spark.sql.delta.managedcommit.UpdatedActions;
import org.apache.spark.sql.delta.coordinatedcommits.AbstractMetadata;
import org.apache.spark.sql.delta.coordinatedcommits.UpdatedActions;
import org.apache.hadoop.fs.Path;

import java.util.UUID;

public class ManagedCommitUtils {
public class CoordinatedCommitsUtils {

private ManagedCommitUtils() {}
private CoordinatedCommitsUtils() {}

/** The subdirectory in which to store the unbackfilled commit files. */
final static String COMMIT_SUBDIR = "_commits";

/** The configuration key for the managed commit owner. */
private static final String MANAGED_COMMIT_OWNER_CONF_KEY =
"delta.managedCommit.commitOwner-preview";
/** The configuration key for the coordinated commits owner. */
private static final String COORDINATED_COMMITS_COORDINATOR_CONF_KEY =
"delta.coordinatedCommits.commitCoordinator-preview";

/**
* Creates a new unbackfilled delta file path for the given commit version.
Expand All @@ -55,23 +55,23 @@ public static Path getBackfilledDeltaFilePath(
return new Path(logPath, String.format("%020d.json", version));
}

private static String getManagedCommitOwner(AbstractMetadata metadata) {
private static String getCoordinatedCommitsCoordinator(AbstractMetadata metadata) {
return metadata
.getConfiguration()
.get(MANAGED_COMMIT_OWNER_CONF_KEY)
.get(COORDINATED_COMMITS_COORDINATOR_CONF_KEY)
.getOrElse(() -> "");
}

/**
* Returns true if the commit is a managed commit to filesystem conversion.
* Returns true if the commit is a coordinated commits to filesystem conversion.
*/
public static boolean isManagedCommitToFSConversion(
public static boolean isCoordinatedCommitsToFSConversion(
Long commitVersion,
UpdatedActions updatedActions) {
boolean oldMetadataHasManagedCommit =
!getManagedCommitOwner(updatedActions.getOldMetadata()).isEmpty();
boolean newMetadataHasManagedCommit =
!getManagedCommitOwner(updatedActions.getNewMetadata()).isEmpty();
return oldMetadataHasManagedCommit && !newMetadataHasManagedCommit && commitVersion > 0;
boolean oldMetadataHasCoordinatedCommits =
!getCoordinatedCommitsCoordinator(updatedActions.getOldMetadata()).isEmpty();
boolean newMetadataHasCoordinatedCommits =
!getCoordinatedCommitsCoordinator(updatedActions.getNewMetadata()).isEmpty();
return oldMetadataHasCoordinatedCommits && !newMetadataHasCoordinatedCommits && commitVersion > 0;
}
}
Loading

0 comments on commit 26f67e9

Please sign in to comment.