Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.fluss.flink.tiering.committer;
package org.apache.fluss.client.tiering;

import org.apache.fluss.annotation.VisibleForTesting;
import org.apache.fluss.client.metadata.MetadataUpdater;
Expand Down Expand Up @@ -197,7 +197,7 @@ public void commit(
}
}

void commit(
public void commit(
long tableId,
long snapshotId,
String lakeBucketTieredOffsetsPath,
Expand Down Expand Up @@ -233,14 +233,6 @@ void commit(
}
}

/**
* Converts the prepare commit parameters to a {@link PrepareLakeTableSnapshotRequest}.
*
* @param tableId the table ID
* @param tablePath the table path
* @param logEndOffsets the log end offsets for each bucket
* @return the prepared commit request
*/
private PrepareLakeTableSnapshotRequest toPrepareLakeTableSnapshotRequest(
long tableId, TablePath tablePath, Map<TableBucket, Long> logEndOffsets) {
PrepareLakeTableSnapshotRequest prepareLakeTableSnapshotRequest =
Expand All @@ -264,29 +256,6 @@ private PrepareLakeTableSnapshotRequest toPrepareLakeTableSnapshotRequest(
return prepareLakeTableSnapshotRequest;
}

/**
* Converts the commit parameters to a {@link CommitLakeTableSnapshotRequest}.
*
* <p>This method creates a request that includes:
*
* <ul>
* <li>Lake table snapshot metadata (snapshot ID, table ID, file paths)
* <li>PbLakeTableSnapshotInfo for metrics reporting (log end offsets and max tiered
* timestamps)
* </ul>
*
* @param tableId the table ID
* @param snapshotId the lake snapshot ID
* @param tieredBucketOffsetsPath the file path where the tiered bucket offsets is stored
* @param readableBucketTieredOffsetsPath the file path where the readable bucket offsets is
* stored
* @param logEndOffsets the log end offsets for each bucket
* @param logMaxTieredTimestamps the max tiered timestamps for each bucket
* @param earliestSnapshotIDToKeep the earliest snapshot ID to keep. Null means keep only the
* latest (discard all previous). -1 ({@link LakeCommitResult#KEEP_ALL_PREVIOUS}) means keep
* all previous snapshots (infinite retention).
* @return the commit request
*/
private CommitLakeTableSnapshotRequest toCommitLakeTableSnapshotRequest(
long tableId,
long snapshotId,
Expand All @@ -298,12 +267,10 @@ private CommitLakeTableSnapshotRequest toCommitLakeTableSnapshotRequest(
CommitLakeTableSnapshotRequest commitLakeTableSnapshotRequest =
new CommitLakeTableSnapshotRequest();

// Add lake table snapshot metadata
PbLakeTableSnapshotMetadata pbLakeTableSnapshotMetadata =
commitLakeTableSnapshotRequest.addLakeTableSnapshotMetadata();
pbLakeTableSnapshotMetadata.setSnapshotId(snapshotId);
pbLakeTableSnapshotMetadata.setTableId(tableId);
// tiered snapshot file path is equal to readable snapshot currently
pbLakeTableSnapshotMetadata.setTieredBucketOffsetsFilePath(tieredBucketOffsetsPath);
if (readableBucketTieredOffsetsPath != null) {
pbLakeTableSnapshotMetadata.setReadableBucketOffsetsFilePath(
Expand All @@ -313,8 +280,6 @@ private CommitLakeTableSnapshotRequest toCommitLakeTableSnapshotRequest(
pbLakeTableSnapshotMetadata.setEarliestSnapshotIdToKeep(earliestSnapshotIDToKeep);
}

// Add PbLakeTableSnapshotInfo for metrics reporting (to notify tablet servers about
// synchronized log end offsets and max timestamps)
if (!logEndOffsets.isEmpty()) {
commitLakeTableSnapshotRequest =
addLogEndOffsets(
Expand All @@ -328,7 +293,7 @@ private CommitLakeTableSnapshotRequest toCommitLakeTableSnapshotRequest(
}

@VisibleForTesting
protected CommitLakeTableSnapshotRequest addLogEndOffsets(
public CommitLakeTableSnapshotRequest addLogEndOffsets(
CommitLakeTableSnapshotRequest commitLakeTableSnapshotRequest,
long tableId,
long snapshotId,
Expand Down Expand Up @@ -358,7 +323,7 @@ protected CommitLakeTableSnapshotRequest addLogEndOffsets(
}

@VisibleForTesting
CoordinatorGateway getCoordinatorGateway() {
public CoordinatorGateway getCoordinatorGateway() {
return coordinatorGateway;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.fluss.flink.tiering.source;
package org.apache.fluss.client.tiering;

import org.apache.fluss.lake.writer.LakeWriter;
import org.apache.fluss.metadata.TableBucket;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.fluss.client.tiering;

import org.apache.fluss.lake.committer.TieringStats;

import javax.annotation.Nullable;

/**
* The result of one table's commit round, holding the lake committable (nullable for empty commits
* where no data was written) and the associated tiering statistics.
*
* @param <Committable> the type of the lake committable
*/
public class TieringCommitResult<Committable> {

/** The lake committable, or {@code null} if nothing was written in this round. */
@Nullable private final Committable committable;

/** Per-table tiering statistics collected during this round. */
@Nullable private final TieringStats stats;

public TieringCommitResult(@Nullable Committable committable, @Nullable TieringStats stats) {
this.committable = committable;
this.stats = stats;
}

@Nullable
public Committable getCommittable() {
return committable;
}

@Nullable
public TieringStats getStats() {
return stats;
}
}
Loading
Loading