Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ public final class OzoneConsts {
"/serviceList";
public static final String OZONE_DB_CHECKPOINT_HTTP_ENDPOINT =
"/dbCheckpoint";
public static final String OZONE_DB_CHECKPOINT_HTTP_ENDPOINT_V2 =
"/v2/dbCheckpoint";

// Ozone File System scheme
public static final String OZONE_URI_SCHEME = "o3fs";
Expand Down
148 changes: 0 additions & 148 deletions hadoop-hdds/docs/content/design/om-bootstrapping-with-snapshots.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,12 @@
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.hdds.HddsUtils;
import org.apache.hadoop.ozone.OzoneConsts;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/** Create and extract archives. */
public final class Archiver {

static final int MIN_BUFFER_SIZE = 8 * (int) OzoneConsts.KB; // same as IOUtils.DEFAULT_BUFFER_SIZE
static final int MAX_BUFFER_SIZE = (int) OzoneConsts.MB;
private static final Logger LOG = LoggerFactory.getLogger(Archiver.class);

private Archiver() {
// no instances (for now)
Expand Down Expand Up @@ -114,46 +111,6 @@ public static long includeFile(File file, String entryName,
return bytes;
}

/**
* Creates a hard link to the specified file in the provided temporary directory,
* adds the linked file as an entry to the archive with the given entry name, writes
* its contents to the archive output, and then deletes the temporary hard link.
* <p>
* This approach avoids altering the original file and works around limitations
* of certain archiving libraries that may require the source file to be present
* in a specific location or have a specific name. Any errors during the hardlink
* creation or archiving process are logged.
* </p>
*
* @param file the file to be included in the archive
* @param entryName the name/path under which the file should appear in the archive
* @param archiveOutput the output stream for the archive (e.g., tar)
* @param tmpDir the temporary directory in which to create the hard link
* @return number of bytes copied to the archive for this file
* @throws IOException if an I/O error occurs other than hardlink creation failure
*/
public static long linkAndIncludeFile(File file, String entryName,
ArchiveOutputStream<TarArchiveEntry> archiveOutput, Path tmpDir) throws IOException {
File link = tmpDir.resolve(entryName).toFile();
long bytes = 0;
try {
Files.createLink(link.toPath(), file.toPath());
TarArchiveEntry entry = archiveOutput.createArchiveEntry(link, entryName);
archiveOutput.putArchiveEntry(entry);
try (InputStream input = Files.newInputStream(link.toPath())) {
bytes = IOUtils.copyLarge(input, archiveOutput);
}
archiveOutput.closeArchiveEntry();
} catch (IOException ioe) {
LOG.error("Couldn't create hardlink for file {} while including it in tarball.",
file.getAbsolutePath(), ioe);
throw ioe;
} finally {
Files.deleteIfExists(link.toPath());
}
return bytes;
}

public static void extractEntry(ArchiveEntry entry, InputStream input, long size,
Path ancestor, Path path) throws IOException {
HddsUtils.validatePath(path, ancestor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import static org.apache.hadoop.ozone.OzoneConsts.OZONE_DB_CHECKPOINT_REQUEST_TO_EXCLUDE_SST;
import static org.apache.hadoop.ozone.OzoneConsts.ROCKSDB_SST_SUFFIX;

import com.google.common.annotations.VisibleForTesting;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
Expand Down Expand Up @@ -123,10 +122,6 @@ public void initialize(DBStore store, DBCheckpointMetrics metrics,
}
}

public File getBootstrapTempData() {
return bootstrapTempData;
}

private boolean hasPermission(UserGroupInformation user) {
// Check ACL for dbCheckpoint only when global Ozone ACL and SPNEGO is
// enabled
Expand All @@ -137,7 +132,7 @@ private boolean hasPermission(UserGroupInformation user) {
}
}

protected static void logSstFileList(Collection<String> sstList, String msg, int sampleSize) {
private static void logSstFileList(Collection<String> sstList, String msg, int sampleSize) {
int count = sstList.size();
if (LOG.isDebugEnabled()) {
LOG.debug(msg, count, "", sstList);
Expand Down Expand Up @@ -204,8 +199,7 @@ private void generateSnapshotCheckpoint(HttpServletRequest request,
processMetadataSnapshotRequest(request, response, isFormData, flush);
}

@VisibleForTesting
public void processMetadataSnapshotRequest(HttpServletRequest request, HttpServletResponse response,
private void processMetadataSnapshotRequest(HttpServletRequest request, HttpServletResponse response,
boolean isFormData, boolean flush) {
List<String> excludedSstList = new ArrayList<>();
String[] sstParam = isFormData ?
Expand Down Expand Up @@ -278,22 +272,11 @@ public void processMetadataSnapshotRequest(HttpServletRequest request, HttpServl
}
}

protected static Set<String> extractSstFilesToExclude(String[] filesInExclusionParam) {
Set<String> sstFilesToExclude = new HashSet<>();
if (filesInExclusionParam != null) {
sstFilesToExclude.addAll(
Arrays.stream(filesInExclusionParam).filter(s -> s.endsWith(ROCKSDB_SST_SUFFIX))
.distinct().collect(Collectors.toList()));
logSstFileList(sstFilesToExclude, "Received list of {} SST files to be excluded{}: {}", 5);
}
return sstFilesToExclude;
}

protected static Set<String> extractFilesToExclude(String[] sstParam) {
protected static Set<String> extractSstFilesToExclude(String[] sstParam) {
Set<String> receivedSstFiles = new HashSet<>();
if (sstParam != null) {
receivedSstFiles.addAll(
Arrays.stream(sstParam).distinct().collect(Collectors.toList()));
Arrays.stream(sstParam).filter(s -> s.endsWith(ROCKSDB_SST_SUFFIX)).distinct().collect(Collectors.toList()));
logSstFileList(receivedSstFiles, "Received list of {} SST files to be excluded{}: {}", 5);
}
return receivedSstFiles;
Expand All @@ -309,7 +292,7 @@ public DBCheckpoint getCheckpoint(Path ignoredTmpdir, boolean flush)
* @param request the HTTP servlet request
* @return array of parsed sst form data parameters for exclusion
*/
protected static String[] parseFormDataParameters(HttpServletRequest request) {
private static String[] parseFormDataParameters(HttpServletRequest request) {
ServletFileUpload upload = new ServletFileUpload();
List<String> sstParam = new ArrayList<>();

Expand Down
Loading