Skip to content

Commit

Permalink
add debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
chengw-netflix committed Jul 19, 2023
1 parent cc9665f commit bf6cfb1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ public abstract class AbstractFileSystem implements IBackupFileSystem {
// file system. This is to ensure that we don't make too many API calls to remote file system.
private final Cache<Path, Boolean> objectCache;

@Inject
public AbstractFileSystem(
IConfiguration configuration,
BackupMetrics backupMetrics,
Expand All @@ -89,6 +88,16 @@ public AbstractFileSystem(
files for "sync" feature which might compete with backups for scheduling.
Also, we may want to have different TIMEOUT for each kind of operation (upload/download) based on our file system choices.
*/

logger.info("Initializing AbstractFileSystem ...");
// Get the current thread's stack trace
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();

// Loop through each stack trace element
for (StackTraceElement element : stackTraceElements) {
logger.info(element.toString());
}

BlockingQueue<Runnable> uploadQueue =
new ArrayBlockingQueue<>(configuration.getBackupQueueSize());
PolledMeter.using(backupMetrics.getRegistry())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ public BackupFileSystemContext(
this.encryptedFs = encryptedFs;
}

@Inject
public BackupFileSystemContext(
@Named("backup") IBackupFileSystem fs) {
this.fs = fs;
}

public IBackupFileSystem getFileStrategy(IConfiguration config) {

if (!config.isEncryptBackupEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,22 @@
import com.netflix.priam.compress.CompressionType;
import com.netflix.priam.config.BackupsToCompress;
import com.netflix.priam.config.IConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Instant;
import java.util.Set;
import java.util.stream.Stream;
import javax.inject.Inject;
import javax.inject.Provider;

public class BackupHelperImpl implements BackupHelper {

private static final Logger logger = LoggerFactory.getLogger(BackupHelperImpl.class);
private static final String COMPRESSION_SUFFIX = "-CompressionInfo.db";
private static final String DATA_SUFFIX = "-Data.db";
private final Provider<AbstractBackupPath> pathFactory;
Expand Down Expand Up @@ -56,6 +60,8 @@ public ImmutableList<ListenableFuture<AbstractBackupPath>> uploadAndDeleteAllFil
final ImmutableList.Builder<ListenableFuture<AbstractBackupPath>> futures =
ImmutableList.builder();
for (AbstractBackupPath bp : getBackupPaths(parent, type)) {
logger.info(String.format("AbstractBackupPath: %s, localPath: %s", bp, Paths.get(bp.getBackupFile().getAbsolutePath())));

futures.add(fs.uploadAndDelete(bp, target, async));
}
return futures.build();
Expand Down

0 comments on commit bf6cfb1

Please sign in to comment.