Browse Source

Migration Guide changes for BlobContainer (#19731)

Adds a notice in the migration guide for removing
two deleteBlobs and one writeBlob method from the
BlobContainer interface.
Ali Beyad 9 years ago
parent
commit
4f70ee521f
1 changed files with 23 additions and 0 deletions
  1. 23 0
      docs/reference/migration/migrate_5_0/java.asciidoc

+ 23 - 0
docs/reference/migration/migrate_5_0/java.asciidoc

@@ -377,3 +377,26 @@ in favor of using `addTokenFilter(String)`/`addTokenFilter(Map)` and `addCharFil
 
 The `setTokenFilters(String...)` and `setCharFilters(String...)` methods have been removed
 in favor of using `addTokenFilter(String)`/`addTokenFilter(Map)` and `addCharFilter(String)`/`addCharFilter(Map)` each filters
+
+==== BlobContainer Interface for Snapshot/Restore
+
+Some methods have been removed from the `BlobContainer` interface for Snapshot/Restore repositories.  In particular,
+the following three methods have been removed:
+
+ 1. `deleteBlobs(Collection<String>)` (use `deleteBlob(String)` instead)
+ 2. `deleteBlobsByPrefix(String)` (use `deleteBlob(String)` instead)
+ 3. `writeBlob(String, BytesReference)` (use `writeBlob(String, InputStream, long)` instead)
+
+The `deleteBlob` methods that took multiple blobs as arguments were deleted because no atomic guarantees can be made about either deleting all blobs or deleting none of them, and exception handling in such a situation is ambiguous and best left to the caller. Hence, all delete blob calls use the singular `deleteBlob(String)` method. 
+
+The extra `writeBlob` method offered no real advantage to the interface and all calls to `writeBlob(blobName, bytesRef)` can be replaced with:
+
+[source,java]
+-----
+try (InputStream stream = bytesRef.streamInput()) {
+    blobContainer.writeBlob(blobName, stream, bytesRef.length());
+}
+-----
+
+For any custom implementation of the `BlobContainer` interface, these three methods must be removed.
+