[Flink-39911][historyserver] Support Pluggable Storage Backend for HistoryServer#28402
[Flink-39911][historyserver] Support Pluggable Storage Backend for HistoryServer#28402chenzihao5 wants to merge 4 commits into
Conversation
… FileArchiveStorage implementation
…m HistoryServerStaticFileServerHandler
reswqa
left a comment
There was a problem hiding this comment.
Thanks @chenzihao5 for improving history server.
I made a rough scan first and left some comments.
| * | ||
| * @param <T> Type of the storage entries. | ||
| */ | ||
| public interface ArchiveStorage<T> extends Closeable { |
There was a problem hiding this comment.
extends Closeable should be moved to the first commit.
| if (keyPrefix == null || keyPrefix.isEmpty()) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
| if (keyPrefix == null || keyPrefix.isEmpty()) { | |
| return; | |
| } | |
| if(StringUtils.isNullOrWhitespaceOnly(keyPrefix)) return; |
| * | ||
| * <p>Such as deleting all archived files for a given job or application. | ||
| * | ||
| * @param keyPrefix key prefix; should end with a separator (e.g. {@code "/"}) when the intent |
There was a problem hiding this comment.
I don't think it is reasonable to introduce such constraints in the interface. Delete all entries with key prefix is well-defined in itself. We should not impose any hidden burden on the interface caller.
| * is to delete all entries under a logical directory | ||
| * @throws IOException if entries cannot be deleted | ||
| */ | ||
| void deletePrefix(String keyPrefix) throws IOException; |
There was a problem hiding this comment.
| void deletePrefix(String keyPrefix) throws IOException; | |
| void deleteByPrefix(String keyPrefix) throws IOException; |
| * @param prefix storage key prefix; should end with a separator (e.g. {@code "/"}) when the | ||
| * intent is to list all entries under a logical directory |
|
|
||
| /** Compression type used for the bottommost level of the RocksDB SST files. */ | ||
| public static final ConfigOption<String> HISTORY_SERVER_ARCHIVE_ROCKSDB_BOTTOMMOST_COMPRESSION = | ||
| key("historyserver.archive.rocksdb.bottommost-compression") |
There was a problem hiding this comment.
Could we use enum type rather than String here?
| if (!success) { | ||
| LOG.debug("Unable to load requested resource {} from classloader", requestPath); | ||
| throw new NotFoundException("Resource not found."); | ||
| } |
There was a problem hiding this comment.
Why these code have to execute in finally block?
| private final File webApplicationDir; | ||
| private final File webApplicationsOverviewDir; |
There was a problem hiding this comment.
Could this two fields be local variable?
| * ArchiveRetainedStrategy} and {@link HistoryServerOptions#HISTORY_SERVER_CLEANUP_EXPIRED_JOBS}. | ||
| */ | ||
| class HistoryServerArchiveFetcher { | ||
| public class HistoryServerArchiveFetcher { |
There was a problem hiding this comment.
Could we introduce generic type param for this fetch class?
| * @throws IOException if the entry cannot be read | ||
| */ | ||
| @Nullable | ||
| T get(String key) throws IOException; |
There was a problem hiding this comment.
This is not a well-defined protocol as "put" and "get" method is not symmetrical.
What is the purpose of the change
This pull request introduces a pluggable archive storage backend for the HistoryServer, so that downloaded job archives no longer have to be unpacked into a large number of small JSON files on the local filesystem. And this PR adds a RocksDB backend that stores all archive entries as key-value pairs inside a single embedded RocksDB instance, while keeping the existing FILE backend as the default to preserve backwards compatibility.
Brief change log
Verifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation
Was generative AI tooling used to co-author this PR?