Skip to content
Open
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 @@ -182,9 +182,8 @@ public boolean exists(String path) throws IOException {
if (path.endsWith("/")) {
return storage.get(bucketName, path, Storage.BlobGetOption.fields()) != null;
} else {
final String filePath = path;
final String directoryPath = path + "/";
return storage.get(bucketName, filePath, Storage.BlobGetOption.fields()) != null
return storage.get(bucketName, path, Storage.BlobGetOption.fields()) != null
|| storage.get(bucketName, directoryPath, Storage.BlobGetOption.fields()) != null;
}
}
Expand All @@ -201,9 +200,7 @@ public PathType getPathType(URI path) throws IOException {

@Override
public String[] listAll(URI path) throws IOException {
final String blobName = appendTrailingSeparatorIfNecessary(path.toString());

final String pathStr = blobName;
final String pathStr = appendTrailingSeparatorIfNecessary(path.toString());
final List<String> result = new ArrayList<>();
storage
.list(
Expand Down Expand Up @@ -231,10 +228,10 @@ public String[] listAll(URI path) throws IOException {

@Override
public IndexInput openInput(URI dirPath, String fileName, IOContext ctx) throws IOException {
return openInput(dirPath, fileName, ctx, readBufferSizeBytes);
return openInput(dirPath, fileName, readBufferSizeBytes);
}

private IndexInput openInput(URI dirPath, String fileName, IOContext ctx, int bufferSize) {
private IndexInput openInput(URI dirPath, String fileName, int bufferSize) {
String blobName = resolve(dirPath, fileName).toString();

final BlobId blobId = BlobId.of(bucketName, blobName);
Expand Down Expand Up @@ -309,10 +306,9 @@ public void deleteDirectory(URI path) throws IOException {
}

protected List<BlobId> allBlobsAtDir(URI path) throws IOException {
final String blobName = appendTrailingSeparatorIfNecessary(path.toString());
final String pathStr = appendTrailingSeparatorIfNecessary(path.toString());

final List<BlobId> result = new ArrayList<>();
final String pathStr = blobName;
storage
.list(bucketName, Storage.BlobListOption.prefix(pathStr), Storage.BlobListOption.fields())
.iterateAll()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,17 @@
package org.apache.solr.gcs;

import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering;
import java.lang.invoke.MethodHandles;
import org.apache.lucene.tests.util.LuceneTestCase;
import org.apache.solr.cloud.api.collections.AbstractIncrementalBackupTest;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@LuceneTestCase.Nightly
@ThreadLeakLingering(linger = 10)
@LuceneTestCase.SuppressCodecs({
"SimpleText"
}) // Backups do checksum validation against a footer value not present in 'SimpleText'
public class GCSIncrementalBackupTest extends AbstractIncrementalBackupTest {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
public static final String SOLR_XML =
"<solr>\n"
+ "\n"
Expand Down Expand Up @@ -73,8 +69,6 @@ public class GCSIncrementalBackupTest extends AbstractIncrementalBackupTest {
+ " \n"
+ "</solr>\n";

private static String backupLocation;

@BeforeClass
public static void setupClass() throws Exception {
// Enable parallel backup/restore for cloud storage tests
Expand All @@ -88,7 +82,7 @@ public static void setupClass() throws Exception {
}

@AfterClass
public static void tearDownClass() throws Exception {
public static void tearDownClass() {
LocalStorageGCSBackupRepository.clearStashedStorage();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static void setupClass() throws Exception {
}

@AfterClass
public static void tearDownClass() throws Exception {
public static void tearDownClass() {
LocalStorageGCSBackupRepository.clearStashedStorage();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ protected Storage getSingletonStorage() {
}

// FakeStorageRpc isn't thread-safe, which causes flaky test failures when multiple cores
// attempt to backup files
// simultaneously. We work around this here by wrapping it in a delegating instance that adds a
// attempt to back up files simultaneously. We work around this here by wrapping it in a
// delegating instance that adds a
// measure of thread safety.
stashedStorage =
new ConcurrentDelegatingStorage(LocalStorageHelper.customOptions(false).getService());
Expand Down
Loading