com.sap.hana.datalake.files.HdlfsKeepPendingMultipartUpload Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sap-hdlfs Show documentation
Show all versions of sap-hdlfs Show documentation
An implementation of org.apache.hadoop.fs.FileSystem targeting SAP HANA Data Lake Files.
// © 2022 SAP SE or an SAP affiliate company. All rights reserved.
package com.sap.hana.datalake.files;
import com.sap.hana.datalake.files.shaded.com.fasterxml.jackson.databind.JsonNode;
import com.sap.hana.datalake.files.shaded.com.fasterxml.jackson.databind.ObjectMapper;
import com.sap.hana.datalake.files.utils.HdlfsRetryUtils;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.Path;
import com.sap.hana.datalake.files.shaded.org.apache.hadoop.hdfs.web.WebHdfsFileSystem;
import org.apache.hadoop.io.retry.RetryPolicy;
import org.apache.hadoop.util.Progressable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
class HdlfsKeepPendingMultipartUpload extends HdlfsMultipartUpload {
private static final Logger LOG = LoggerFactory.getLogger(HdlfsKeepPendingMultipartUpload.class);
private final ObjectMapper mapper;
HdlfsKeepPendingMultipartUpload(final Path targetPath, final HdlfsBaseFileSystem fileSystem,
final Config multipartUploadConfig, final Progressable progressable,
final RetryPolicy retryPolicy) {
super(targetPath, fileSystem, multipartUploadConfig, progressable, retryPolicy);
this.mapper = new ObjectMapper();
}
@Override
public void complete() throws IOException {
this.waitForChunksToBeUploaded();
final Path pendingFilePath = this.createPendingFile(this.chunkPaths);
if (this.fsCacheEnabled) {
try {
this.addPendingFileToFsCache(pendingFilePath.getParent(), pendingFilePath.getName());
} catch (final IOException ex) {
throw new IOException(String.format("Could not update FsCache with pending file from path %s", pendingFilePath));
}
}
this.fileSystem.addPathToPendingFilesCreated(this.targetPath);
}
private JsonNode createPatch(String filename) {
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy