diff --git a/clients/hadoopfs/pom.xml b/clients/hadoopfs/pom.xml
index ff31651e65a..066c38356dc 100644
--- a/clients/hadoopfs/pom.xml
+++ b/clients/hadoopfs/pom.xml
@@ -287,7 +287,7 @@ To export to S3:
io.lakefs
sdk
- 1.18.0
+ 1.43.0
org.apache.commons
diff --git a/clients/hadoopfs/src/main/java/io/lakefs/LakeFSLinker.java b/clients/hadoopfs/src/main/java/io/lakefs/LakeFSLinker.java
index 9f7f9a88b31..76674d1845e 100644
--- a/clients/hadoopfs/src/main/java/io/lakefs/LakeFSLinker.java
+++ b/clients/hadoopfs/src/main/java/io/lakefs/LakeFSLinker.java
@@ -1,6 +1,7 @@
package io.lakefs;
import java.io.IOException;
+import java.util.Date;
import org.apache.hadoop.fs.Path;
import io.lakefs.clients.sdk.ApiException;
import io.lakefs.clients.sdk.StagingApi;
@@ -24,10 +25,16 @@ public LakeFSLinker(LakeFSFileSystem lfs, LakeFSClient lfsClient,
this.overwrite = overwrite;
}
- public void link(String eTag, long byteSize) throws IOException {
+ public void link(String eTag, long byteSize, Date time) throws IOException {
StagingApi staging = lakeFSClient.getStagingApi();
- StagingMetadata stagingMetadata =
- new StagingMetadata().checksum(eTag).sizeBytes(byteSize).staging(stagingLocation);
+ StagingMetadata stagingMetadata = new StagingMetadata()
+ .checksum(eTag)
+ .sizeBytes(byteSize)
+ .staging(stagingLocation);
+ if (time != null) {
+ long secs = (time.getTime() + 500) / 1000;
+ stagingMetadata.setMtime(secs);
+ }
try {
StagingApi.APIlinkPhysicalAddressRequest request =
staging.linkPhysicalAddress(objectLoc.getRepository(), objectLoc.getRef(), objectLoc.getPath(), stagingMetadata);
diff --git a/clients/hadoopfs/src/main/java/io/lakefs/storage/LakeFSFileSystemOutputStream.java b/clients/hadoopfs/src/main/java/io/lakefs/storage/LakeFSFileSystemOutputStream.java
index c33bcec278c..d823477c93e 100644
--- a/clients/hadoopfs/src/main/java/io/lakefs/storage/LakeFSFileSystemOutputStream.java
+++ b/clients/hadoopfs/src/main/java/io/lakefs/storage/LakeFSFileSystemOutputStream.java
@@ -50,7 +50,7 @@ public void close() throws IOException {
if (eTag == null) {
throw new IOException("Failed to finish writing to presigned link. No ETag found.");
}
- linker.link(eTag, buffer.size());
+ linker.link(eTag, buffer.size(), null);
if (connection.getResponseCode() > 299) {
throw new IOException("Failed to finish writing to presigned link. Response code: "
+ connection.getResponseCode());
diff --git a/clients/hadoopfs/src/main/java/io/lakefs/storage/LinkOnCloseOutputStream.java b/clients/hadoopfs/src/main/java/io/lakefs/storage/LinkOnCloseOutputStream.java
index ceb8eb3d42f..4a2a869cf41 100644
--- a/clients/hadoopfs/src/main/java/io/lakefs/storage/LinkOnCloseOutputStream.java
+++ b/clients/hadoopfs/src/main/java/io/lakefs/storage/LinkOnCloseOutputStream.java
@@ -58,7 +58,7 @@ public void close() throws IOException {
// the underlying Hadoop FileSystem) so we can link it on lakeFS.
if (!this.isLinked.getAndSet(true)) {
ObjectMetadata objectMetadata = metadataClient.getObjectMetadata(physicalUri);
- linker.link(objectMetadata.getETag(), objectMetadata.getContentLength());
+ linker.link(objectMetadata.getETag(), objectMetadata.getContentLength(), objectMetadata.getLastModified());
}
}
}
diff --git a/clients/hadoopfs/src/test/java/io/lakefs/FSTestBase.java b/clients/hadoopfs/src/test/java/io/lakefs/FSTestBase.java
index 6b41dd1da4b..de4a9fd3c66 100644
--- a/clients/hadoopfs/src/test/java/io/lakefs/FSTestBase.java
+++ b/clients/hadoopfs/src/test/java/io/lakefs/FSTestBase.java
@@ -121,20 +121,12 @@ protected String getS3Key(StagingLocation stagingLocation) {
return removeStart(stagingLocation.getPhysicalAddress(), s3Base);
}
- /**
- * Override to add to Hadoop configuration.
- */
- protected void addHadoopConfiguration(Configuration conf) {
- }
-
@Before
public void hadoopSetup() throws IOException, URISyntaxException {
s3Base = "s3a://UNUSED/"; // Overridden if S3 will be used!
conf = new Configuration(false);
- addHadoopConfiguration(conf);
-
conf.set("fs.lakefs.impl", "io.lakefs.LakeFSFileSystem");
conf.set("fs.lakefs.access.key", "unused-but-checked");
diff --git a/clients/hadoopfs/src/test/java/io/lakefs/LakeFSFileSystemServerS3Test.java b/clients/hadoopfs/src/test/java/io/lakefs/LakeFSFileSystemServerS3Test.java
index ef70cc74ac4..55efc2bb2a4 100644
--- a/clients/hadoopfs/src/test/java/io/lakefs/LakeFSFileSystemServerS3Test.java
+++ b/clients/hadoopfs/src/test/java/io/lakefs/LakeFSFileSystemServerS3Test.java
@@ -9,14 +9,13 @@
import io.lakefs.utils.ObjectLocation;
import org.apache.commons.io.IOUtils;
-import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileAlreadyExistsException;
import org.apache.hadoop.fs.Path;
-import com.amazonaws.HttpMethod;
import com.amazonaws.services.s3.model.*;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -29,21 +28,13 @@
import static org.mockserver.model.JsonBody.json;
import java.io.*;
-import java.net.URL;
import java.util.Date;
import java.util.Arrays;
-import java.util.concurrent.TimeUnit;
@RunWith(Parameterized.class)
public class LakeFSFileSystemServerS3Test extends S3FSTestBase {
static private final Logger LOG = LoggerFactory.getLogger(LakeFSFileSystemServerS3Test.class);
- public static interface PhysicalAddressCreator {
- default void initConfiguration(Configuration conf) {}
- String createGetPhysicalAddress(S3FSTestBase o, String key);
- StagingLocation createPutStagingLocation(S3FSTestBase o, String namespace, String repo, String branch, String path);
- }
-
@Parameters(name="{1}")
public static Iterable