You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fluss.apache.org by "LiebingYu (via GitHub)" <gi...@apache.org> on 2025/09/15 03:51:57 UTC
[PR] [server] Lake tiering service report the max timestamp of fluss record [fluss]
LiebingYu opened a new pull request, #1700:
URL: https://github.com/apache/fluss/pull/1700
<!--
*Thank you very much for contributing to Fluss - we are happy that you want to help us improve Fluss. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.*
## Contribution Checklist
- Make sure that the pull request corresponds to a [GitHub issue](https://github.com/apache/fluss/issues). Exceptions are made for typos in JavaDoc or documentation files, which need no issue.
- Name the pull request in the format "[component] Title of the pull request", where *[component]* should be replaced by the name of the component being changed. Typically, this corresponds to the component label assigned to the issue (e.g., [kv], [log], [client], [flink]). Skip *[component]* if you are unsure about which is the best component.
- Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
- Make sure that the change passes the automated tests, i.e., `mvn clean verify` passes.
- Each pull request should address only one issue, not mix up code from multiple issues.
**(The sections below can be removed for hotfixes or typos)**
-->
### Purpose
<!-- Linking this pull request to the issue -->
Linked issue: close #1687
<!-- What is the purpose of the change -->
### Brief change log
<!-- Please describe the changes made in this pull request and explain how they address the issue -->
### Tests
<!-- List UT and IT cases to verify this change -->
### API and Format
<!-- Does this change affect API or storage format -->
### Documentation
<!-- Does this change introduce a new feature -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [server] Lake tiering service report the max timestamp of fluss record [fluss]
Posted by "luoyuxia (via GitHub)" <gi...@apache.org>.
luoyuxia commented on code in PR #1700:
URL: https://github.com/apache/fluss/pull/1700#discussion_r2352037202
##########
fluss-common/src/main/java/org/apache/fluss/lake/committer/BucketOffset.java:
##########
@@ -22,23 +22,29 @@
import java.io.Serializable;
import java.util.Objects;
-/** The bucket offset information to be expected to be stored in Lake's snapshot property. */
+/**
+ * The bucket offset and timestamp information to be expected to be stored in Lake's snapshot
+ * property.
+ */
public class BucketOffset implements Serializable {
private static final long serialVersionUID = 1L;
public static final String FLUSS_LAKE_SNAP_BUCKET_OFFSET_PROPERTY = "fluss-offsets";
private final long logOffset;
+ private final long timestamp;
Review Comment:
we also don't need to store timestamp in `BucketOffset` currently.
##########
fluss-common/src/main/java/org/apache/fluss/lake/committer/CommittedLakeSnapshot.java:
##########
@@ -22,17 +22,21 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
+import java.util.Set;
/**
- * The lake already committed snapshot, containing the lake snapshot id and the bucket end offsets
- * in this snapshot.
+ * The lake already committed snapshot, containing the lake snapshot id, the bucket end offsets and
+ * max timestamp in this snapshot.
*/
public class CommittedLakeSnapshot {
private final long lakeSnapshotId;
// <partition_id, bucket> -> log offset, partition_id will be null if it's not a
// partition bucket
private final Map<Tuple2<Long, Integer>, Long> logEndOffsets = new HashMap<>();
+ // <partition_id, bucket> -> max timestamp, partition_id will be null if it's not a
+ // partition bucket
+ private final Map<Tuple2<Long, Integer>, Long> maxTimestamps = new HashMap<>();
Review Comment:
we can remove `maxTimestamps`
##########
fluss-client/src/main/java/org/apache/fluss/client/metadata/LakeSnapshot.java:
##########
@@ -37,16 +37,21 @@ public class LakeSnapshot {
// the specific log offset of the snapshot
private final Map<TableBucket, Long> tableBucketsOffset;
+ // the specific timestamp of the snapshot
+ private final Map<TableBucket, Long> tableBucketsTimestamp;
Review Comment:
currently, we don't need to expose timestamp in here.
##########
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/tiering/committer/FlussTableLakeSnapshotCommitter.java:
##########
@@ -114,13 +120,14 @@ private CommitLakeTableSnapshotRequest toCommitLakeTableSnapshotRequest(
pbLakeTableSnapshotInfo.setTableId(flussTableLakeSnapshot.tableId());
pbLakeTableSnapshotInfo.setSnapshotId(flussTableLakeSnapshot.lakeSnapshotId());
- for (Map.Entry<Tuple2<TableBucket, String>, Long> bucketEndOffsetEntry :
- flussTableLakeSnapshot.logEndOffsets().entrySet()) {
+ for (Tuple2<TableBucket, String> bucketPartition :
+ flussTableLakeSnapshot.tablePartitionBuckets()) {
PbLakeTableOffsetForBucket pbLakeTableOffsetForBucket =
pbLakeTableSnapshotInfo.addBucketsReq();
- TableBucket tableBucket = bucketEndOffsetEntry.getKey().f0;
- String partitionName = bucketEndOffsetEntry.getKey().f1;
- long endOffset = bucketEndOffsetEntry.getValue();
+ TableBucket tableBucket = bucketPartition.f0;
+ String partitionName = bucketPartition.f1;
+ long endOffset = flussTableLakeSnapshot.getLogEndOffset(bucketPartition);
+ long maxTimestamp = flussTableLakeSnapshot.getMaxTimestamp(bucketPartition);
Review Comment:
Yes, we just need to to timestamp in here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [server] Lake tiering service report the max timestamp of fluss record [fluss]
Posted by "luoyuxia (via GitHub)" <gi...@apache.org>.
luoyuxia commented on code in PR #1700:
URL: https://github.com/apache/fluss/pull/1700#discussion_r2354679074
##########
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/tiering/committer/FlussTableLakeSnapshotCommitter.java:
##########
@@ -88,7 +88,8 @@ public void commit(long tableId, CommittedLakeSnapshot committedLakeSnapshot)
Long partitionId = partitionBucket.f0;
if (partitionId == null) {
tableBucket = new TableBucket(tableId, partitionBucket.f1);
- flussTableLakeSnapshot.addBucketOffset(tableBucket, entry.getValue());
+ flussTableLakeSnapshot.addBucketOffsetAndTimestamp(
+ tableBucket, entry.getValue(), -1);
Review Comment:
add comment:
```
we use -1 since we don't store timestamp in lake snapshot property for simplicity, it may cause the timestamp to be -1 during constructing lake snapshot to commit to Fluss. But it should happen rarely and should be a normal value after next tiering.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [server] Lake tiering service report the max timestamp of fluss record [fluss]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #1700:
URL: https://github.com/apache/fluss/pull/1700#discussion_r2351710772
##########
fluss-server/src/main/java/org/apache/fluss/server/zk/data/LakeTableSnapshot.java:
##########
@@ -32,10 +32,11 @@ public class LakeTableSnapshot {
// the log offset of the bucket
- // mapping from bucket id to log start/end offset,
+ // mapping from bucket id to log start/end offset or max timestamp,
// will be null if log offset is unknown such as reading the snapshot of primary key table
Review Comment:
The comment should be more precise. It describes mappings to 'log start/end offset or max timestamp' but the actual fields are separate maps for start offsets, end offsets, and max timestamps.
```suggestion
// Mappings from bucket id to log start offset, log end offset, and max timestamp, respectively.
// Each map will be null if the corresponding value is unknown, such as when reading the snapshot of a primary key table.
```
##########
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/tiering/source/TableBucketWriteResult.java:
##########
@@ -42,12 +42,16 @@ public class TableBucketWriteResult<WriteResult> implements Serializable {
// null when the bucket is not for a partition
@Nullable private final String partitionName;
- // will be null when no any data write, such as for tiering a empty log split
+ // will be null when no any data write, such as for tiering an empty log split
Review Comment:
Change 'no any data write' to 'no data is written' for better grammar.
```suggestion
// will be null when no data is written, such as for tiering an empty log split
```
##########
fluss-flink/fluss-flink-common/src/test/java/org/apache/fluss/flink/tiering/committer/TieringCommitOperatorTest.java:
##########
@@ -413,13 +483,15 @@ private void verifyLakeSnapshot(
TablePath tablePath,
long tableId,
long expectedSnapshotId,
- Map<TableBucket, Long> expectedLogEndOffsets)
+ Map<TableBucket, Long> expectedLogEndOffsets,
+ Map<TableBucket, Long> expectedMaxTimestamp)
throws Exception {
LakeSnapshot lakeSnapshot = admin.getLatestLakeSnapshot(tablePath).get();
assertThat(lakeSnapshot.getSnapshotId()).isEqualTo(expectedSnapshotId);
assertThat(lakeSnapshot.getTableBucketsOffset()).isEqualTo(expectedLogEndOffsets);
+ assertThat(lakeSnapshot.getTableBucketsTimestamp()).isEqualTo(expectedMaxTimestamp);
- // check the tableId has been send to mark finished
+ // check the tableId has been sent to mark finished
Review Comment:
Good correction of 'send' to 'sent' for proper past tense.
##########
fluss-flink/fluss-flink-common/src/test/java/org/apache/fluss/flink/tiering/committer/TieringCommitOperatorTest.java:
##########
@@ -433,15 +505,17 @@ private void verifyLakeSnapshot(
long tableId,
long expectedSnapshotId,
Map<TableBucket, Long> expectedLogEndOffsets,
+ Map<TableBucket, Long> expectedMaxTimestamp,
Map<Long, String> expectedPartitionIdByName,
String failedReason)
throws Exception {
LakeSnapshot lakeSnapshot = admin.getLatestLakeSnapshot(tablePath).get();
assertThat(lakeSnapshot.getSnapshotId()).isEqualTo(expectedSnapshotId);
assertThat(lakeSnapshot.getTableBucketsOffset()).isEqualTo(expectedLogEndOffsets);
+ assertThat(lakeSnapshot.getTableBucketsTimestamp()).isEqualTo(expectedMaxTimestamp);
assertThat(lakeSnapshot.getPartitionNameById()).isEqualTo(expectedPartitionIdByName);
- // check the tableId has been send to mark failed
+ // check the tableId has been sent to mark failed
Review Comment:
Good correction of 'send' to 'sent' for proper past tense.
```suggestion
// check the tableId has been sent to mark as failed
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [server] Lake tiering service report the max timestamp of fluss record [fluss]
Posted by "LiebingYu (via GitHub)" <gi...@apache.org>.
LiebingYu commented on PR #1700:
URL: https://github.com/apache/fluss/pull/1700#issuecomment-3300890841
> @LiebingYu Thanks for the pr. In this issue, we only want to store maxtimestamp in zk and notify maxtimestmap of the lake along with log end offset. Let's keep it simple
Got it. I have simplified the PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [server] Lake tiering service report the max timestamp of fluss record [fluss]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #1700:
URL: https://github.com/apache/fluss/pull/1700#discussion_r2354614083
##########
fluss-flink/fluss-flink-common/src/test/java/org/apache/fluss/flink/tiering/committer/TieringCommitOperatorTest.java:
##########
@@ -413,13 +483,17 @@ private void verifyLakeSnapshot(
TablePath tablePath,
long tableId,
long expectedSnapshotId,
- Map<TableBucket, Long> expectedLogEndOffsets)
+ Map<TableBucket, Long> expectedLogEndOffsets,
+ Map<TableBucket, Long> expectedMaxTimestamp)
throws Exception {
LakeSnapshot lakeSnapshot = admin.getLatestLakeSnapshot(tablePath).get();
assertThat(lakeSnapshot.getSnapshotId()).isEqualTo(expectedSnapshotId);
assertThat(lakeSnapshot.getTableBucketsOffset()).isEqualTo(expectedLogEndOffsets);
- // check the tableId has been send to mark finished
+ // TODO: replace with LakeSnapshot when support max timestamp
+ verifyLakeSnapshotMaxTimestamp(tableId, expectedMaxTimestamp);
+
+ // check the tableId has been sent to mark finished
Review Comment:
Grammar inconsistency: 'sent' should be 'send' to match the original comment style, or change line 522 to 'sent' for consistency.
```suggestion
// check the tableId has been send to mark finished
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [server] Lake tiering service report the max timestamp of fluss record [fluss]
Posted by "LiebingYu (via GitHub)" <gi...@apache.org>.
LiebingYu commented on PR #1700:
URL: https://github.com/apache/fluss/pull/1700#issuecomment-3302473352
> @LiebingYu The pr looks good to me overall. Could you please also notify the timestamp to tablet server just like what we do for log end offset? In the future, we want to expose the lag between lake snapshot and fluss log data.
@luoyuxia sure. I have addded notify timestamp to tablet server along with log end offset.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [server] Lake tiering service report the max timestamp of fluss record [fluss]
Posted by "luoyuxia (via GitHub)" <gi...@apache.org>.
luoyuxia merged PR #1700:
URL: https://github.com/apache/fluss/pull/1700
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org