[NO ISSUE] Use DebugHolePuncher for non-linux machines
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
Use DebugHolePuncher instead of throwing an exception
on non-linux boxes.
Change-Id: Id19aabffdd52d6578cd48e0e8578bec3fe729a8a
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18312
Reviewed-by: Michael Blow <mblow@apache.org>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Wail Alkowaileet <wael.y.k@gmail.com>
diff --git a/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/lazy/filesystem/HolePuncherProvider.java b/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/lazy/filesystem/HolePuncherProvider.java
index 406f2f3..a2cdda8 100644
--- a/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/lazy/filesystem/HolePuncherProvider.java
+++ b/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/lazy/filesystem/HolePuncherProvider.java
@@ -18,6 +18,9 @@
*/
package org.apache.asterix.cloud.lazy.filesystem;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
import java.io.IOException;
import java.nio.ByteBuffer;
@@ -31,6 +34,7 @@
import org.apache.hyracks.cloud.filesystem.FileSystemOperationDispatcherUtil;
public final class HolePuncherProvider {
+ private static final Logger LOGGER = LogManager.getLogger();
private static final IHolePuncher UNSUPPORTED = HolePuncherProvider::unsupported;
private static final IHolePuncher LINUX = HolePuncherProvider::linuxPunchHole;
@@ -45,13 +49,12 @@
if (FileSystemOperationDispatcherUtil.isLinux()) {
return LINUX;
- } else if (cloudProperties.isStorageDebugModeEnabled()) {
- // Running on debug mode on a non-Linux box
- return new DebugHolePuncher(cloudIOManager, bufferProvider);
}
- throw new UnsupportedOperationException(
- "Hole puncher is not supported using " + FileSystemOperationDispatcherUtil.getOSName());
+ // Running a debug hole puncher on a non-Linux box
+ String osName = FileSystemOperationDispatcherUtil.getOSName();
+ LOGGER.warn("Using 'DebugHolePuncher' as the OS '{}' does not support punishing holes", osName);
+ return new DebugHolePuncher(cloudIOManager, bufferProvider);
}
private static int unsupported(IFileHandle fileHandle, long offset, long length) {