Fixing line lengths in murmur3 and hdfs plugins ()

This commit is contained in:
Benjamin Trent 2018-10-18 09:57:20 -05:00 committed by GitHub
parent f11a23be2f
commit 6ccaa83d2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 7 deletions
plugins/repository-hdfs/src
main/java/org/elasticsearch/repositories/hdfs
test/java/org/elasticsearch/repositories/hdfs

@ -82,7 +82,9 @@ public final class HdfsRepository extends BlobStoreRepository {
uri = URI.create(uriSetting); uri = URI.create(uriSetting);
if ("hdfs".equalsIgnoreCase(uri.getScheme()) == false) { if ("hdfs".equalsIgnoreCase(uri.getScheme()) == false) {
throw new IllegalArgumentException(String.format(Locale.ROOT, throw new IllegalArgumentException(String.format(Locale.ROOT,
"Invalid scheme [%s] specified in uri [%s]; only 'hdfs' uri allowed for hdfs snapshot/restore", uri.getScheme(), uriSetting)); "Invalid scheme [%s] specified in uri [%s]; only 'hdfs' uri allowed for hdfs snapshot/restore",
uri.getScheme(),
uriSetting));
} }
if (Strings.hasLength(uri.getPath()) && uri.getPath().equals("/") == false) { if (Strings.hasLength(uri.getPath()) && uri.getPath().equals("/") == false) {
throw new IllegalArgumentException(String.format(Locale.ROOT, throw new IllegalArgumentException(String.format(Locale.ROOT,
@ -134,7 +136,10 @@ public final class HdfsRepository extends BlobStoreRepository {
} }
}); });
logger.debug("Using file-system [{}] for URI [{}], path [{}]", fileContext.getDefaultFileSystem(), fileContext.getDefaultFileSystem().getUri(), path); logger.debug("Using file-system [{}] for URI [{}], path [{}]",
fileContext.getDefaultFileSystem(),
fileContext.getDefaultFileSystem().getUri(),
path);
try { try {
return new HdfsBlobStore(fileContext, path, bufferSize, isReadOnly(), haEnabled); return new HdfsBlobStore(fileContext, path, bufferSize, isReadOnly(), haEnabled);

@ -76,11 +76,25 @@ public class HdfsTests extends ESSingleNodeTestCase {
assertThat(count(client, "test-idx-3"), equalTo(100L)); assertThat(count(client, "test-idx-3"), equalTo(100L));
logger.info("--> snapshot"); logger.info("--> snapshot");
CreateSnapshotResponse createSnapshotResponse = client.admin().cluster().prepareCreateSnapshot("test-repo", "test-snap").setWaitForCompletion(true).setIndices("test-idx-*", "-test-idx-3").get(); CreateSnapshotResponse createSnapshotResponse = client.admin()
.cluster()
.prepareCreateSnapshot("test-repo", "test-snap")
.setWaitForCompletion(true)
.setIndices("test-idx-*", "-test-idx-3")
.get();
assertThat(createSnapshotResponse.getSnapshotInfo().successfulShards(), greaterThan(0)); assertThat(createSnapshotResponse.getSnapshotInfo().successfulShards(), greaterThan(0));
assertThat(createSnapshotResponse.getSnapshotInfo().successfulShards(), equalTo(createSnapshotResponse.getSnapshotInfo().totalShards())); assertThat(createSnapshotResponse.getSnapshotInfo().successfulShards(),
equalTo(createSnapshotResponse.getSnapshotInfo().totalShards()));
assertThat(client.admin().cluster().prepareGetSnapshots("test-repo").setSnapshots("test-snap").get().getSnapshots().get(0).state(), equalTo(SnapshotState.SUCCESS)); assertThat(client.admin()
.cluster()
.prepareGetSnapshots("test-repo")
.setSnapshots("test-snap")
.get()
.getSnapshots()
.get(0)
.state(),
equalTo(SnapshotState.SUCCESS));
logger.info("--> delete some data"); logger.info("--> delete some data");
for (int i = 0; i < 50; i++) { for (int i = 0; i < 50; i++) {
@ -101,7 +115,12 @@ public class HdfsTests extends ESSingleNodeTestCase {
client.admin().indices().prepareClose("test-idx-1", "test-idx-2").get(); client.admin().indices().prepareClose("test-idx-1", "test-idx-2").get();
logger.info("--> restore all indices from the snapshot"); logger.info("--> restore all indices from the snapshot");
RestoreSnapshotResponse restoreSnapshotResponse = client.admin().cluster().prepareRestoreSnapshot("test-repo", "test-snap").setWaitForCompletion(true).execute().actionGet(); RestoreSnapshotResponse restoreSnapshotResponse = client.admin()
.cluster()
.prepareRestoreSnapshot("test-repo", "test-snap")
.setWaitForCompletion(true)
.execute()
.actionGet();
assertThat(restoreSnapshotResponse.getRestoreInfo().totalShards(), greaterThan(0)); assertThat(restoreSnapshotResponse.getRestoreInfo().totalShards(), greaterThan(0));
ensureGreen(); ensureGreen();
@ -113,7 +132,13 @@ public class HdfsTests extends ESSingleNodeTestCase {
logger.info("--> delete indices"); logger.info("--> delete indices");
client().admin().indices().prepareDelete("test-idx-1", "test-idx-2").get(); client().admin().indices().prepareDelete("test-idx-1", "test-idx-2").get();
logger.info("--> restore one index after deletion"); logger.info("--> restore one index after deletion");
restoreSnapshotResponse = client.admin().cluster().prepareRestoreSnapshot("test-repo", "test-snap").setWaitForCompletion(true).setIndices("test-idx-*", "-test-idx-2").execute().actionGet(); restoreSnapshotResponse = client.admin()
.cluster()
.prepareRestoreSnapshot("test-repo", "test-snap")
.setWaitForCompletion(true)
.setIndices("test-idx-*", "-test-idx-2")
.execute()
.actionGet();
assertThat(restoreSnapshotResponse.getRestoreInfo().totalShards(), greaterThan(0)); assertThat(restoreSnapshotResponse.getRestoreInfo().totalShards(), greaterThan(0));
ensureGreen(); ensureGreen();
assertThat(count(client, "test-idx-1"), equalTo(100L)); assertThat(count(client, "test-idx-1"), equalTo(100L));