-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[core] Optimize memory usage for expiring snapshots and tags (#4655)
This closes #4655.
- Loading branch information
1 parent
e18f6ed
commit 9191e2e
Showing
14 changed files
with
183 additions
and
78 deletions.
There are no files selected for viewing
86 changes: 86 additions & 0 deletions
86
paimon-core/src/main/java/org/apache/paimon/manifest/ExpireFileEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* 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.paimon.manifest; | ||
|
||
import org.apache.paimon.data.BinaryRow; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
import java.util.Optional; | ||
|
||
/** A {@link SimpleFileEntry} with {@link #fileSource}. */ | ||
public class ExpireFileEntry extends SimpleFileEntry { | ||
|
||
@Nullable private final FileSource fileSource; | ||
|
||
public ExpireFileEntry( | ||
FileKind kind, | ||
BinaryRow partition, | ||
int bucket, | ||
int level, | ||
String fileName, | ||
List<String> extraFiles, | ||
@Nullable byte[] embeddedIndex, | ||
BinaryRow minKey, | ||
BinaryRow maxKey, | ||
@Nullable FileSource fileSource) { | ||
super(kind, partition, bucket, level, fileName, extraFiles, embeddedIndex, minKey, maxKey); | ||
this.fileSource = fileSource; | ||
} | ||
|
||
public Optional<FileSource> fileSource() { | ||
return Optional.ofNullable(fileSource); | ||
} | ||
|
||
public static ExpireFileEntry from(ManifestEntry entry) { | ||
return new ExpireFileEntry( | ||
entry.kind(), | ||
entry.partition(), | ||
entry.bucket(), | ||
entry.level(), | ||
entry.fileName(), | ||
entry.file().extraFiles(), | ||
entry.file().embeddedIndex(), | ||
entry.minKey(), | ||
entry.maxKey(), | ||
entry.file().fileSource().orElse(null)); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
if (!super.equals(o)) { | ||
return false; | ||
} | ||
ExpireFileEntry that = (ExpireFileEntry) o; | ||
return fileSource == that.fileSource; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(super.hashCode(), fileSource); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.