danielcweeks commented on code in PR #4518:
URL: https://github.com/apache/iceberg/pull/4518#discussion_r978821160
##########
core/src/main/java/org/apache/iceberg/ManifestFiles.java:
##########
@@ -300,4 +339,58 @@ private static ManifestFile copyManifestInternal(
return writer.toManifestFile();
}
+
+ private static InputFile newInputFile(FileIO io, String path, long length) {
+ boolean enabled = cachingEnabled(io);
+
+ if (enabled) {
+ ContentCache cache = contentCache(io);
+ Preconditions.checkNotNull(cache);
+ LOG.debug("FileIO-level cache stats: {}", CONTENT_CACHES.stats());
+ return cache.tryCache(io, path, length);
+ }
+
+ // caching is not enable for this io or caught RuntimeException.
+ return io.newInputFile(path, length);
+ }
+
+ private static int maxFileIO() {
+ String value =
System.getProperty(SystemProperties.IO_MANIFEST_CACHE_MAX_FILEIO);
+ if (value != null) {
+ try {
+ return Integer.parseUnsignedInt(value);
+ } catch (NumberFormatException e) {
+ // will return the default
+ }
+ }
+ return SystemProperties.IO_MANIFEST_CACHE_MAX_FILEIO_DEFAULT;
+ }
+
+ public static boolean cachingEnabled(FileIO io) {
+ return PropertyUtil.propertyAsBoolean(
+ io.properties(),
+ CatalogProperties.IO_MANIFEST_CACHE_ENABLED,
+ CatalogProperties.IO_MANIFEST_CACHE_ENABLED_DEFAULT);
+ }
+
+ public static long cacheDurationMs(FileIO io) {
+ return PropertyUtil.propertyAsLong(
+ io.properties(),
+ CatalogProperties.IO_MANIFEST_CACHE_EXPIRATION_INTERVAL_MS,
+ CatalogProperties.IO_MANIFEST_CACHE_EXPIRATION_INTERVAL_MS_DEFAULT);
+ }
+
+ public static long cacheTotalBytes(FileIO io) {
Review Comment:
This can be package level protection.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]