fix(timestream-influxdb): retry restore archive uploads (#6064)

Reopen each backup tar for transient Docker upload retries without wrapping or buffering it. Keep restore commands outside the retry boundary and preserve cleanup on failure.

Refs #5096.
This commit is contained in:
Aniket Shukla authored and GitHub committed 2026-10-20 07:27:05 -04:00
1 parent 9b59b8997e
commit fa4bacd0d1
3 files changed
+152 -6

No files matched your search

@@ -11,6 +11,7 @@ import io.github.hectorvent.floci.core.common.docker.ContainerLifecycleManager.C
import io.github.hectorvent.floci.core.common.docker.ContainerLifecycleManager.EndpointInfo;
import io.github.hectorvent.floci.core.common.docker.ContainerStorageHelper;
import io.github.hectorvent.floci.core.common.docker.PortAllocator;
import io.github.hectorvent.floci.core.common.docker.RetryingTarCopier;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import org.jboss.logging.Logger;
@@ -342,12 +343,16 @@ public class TimestreamInfluxDbContainerManager implements ContainerTeardown {
}
private void copyToContainer(String containerId, Path archive, String remotePath) throws IOException {
try (InputStream stream = Files.newInputStream(archive)) {
lifecycleManager.getDockerClient().copyArchiveToContainerCmd(containerId)
.withRemotePath(remotePath)
.withTarInputStream(stream)
.exec();
}
copyToContainer(containerId, archive, remotePath, RetryingTarCopier.DEFAULT_BACKOFF_MS);
}
void copyToContainer(String containerId, Path archive, String remotePath, long backoffMillis) throws IOException {
RetryingTarCopier.copyStreamed(lifecycleManager.getDockerClient(), containerId, remotePath,
archive.getFileName().toString(), out -> {
try (InputStream stream = Files.newInputStream(archive)) {
stream.transferTo(out);
}
}, RetryingTarCopier.DEFAULT_MAX_ATTEMPTS, backoffMillis);
}
private void execOrThrow(String containerId, String[] command, String description) {