Skip to content

Commit 9ae0198

Browse files
PR comments
1 parent d951cc0 commit 9ae0198

File tree

7 files changed

+41
-24
lines changed

7 files changed

+41
-24
lines changed

hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/contracts/services/AppendRequestParameters.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public AppendRequestParameters(final long position,
8181
* @param leaseId leaseId of the blob to be appended
8282
* @param isExpectHeaderEnabled true if the expect header is enabled
8383
* @param blobParams parameters specific to append operation on Blob Endpoint.
84-
* @param md5 The Base64-encoded MD5 hash of the block for data integrity validation.
84+
* @param md5 The Base64-encoded MD5 hash of the block for data integrity validation.
8585
*/
8686
public AppendRequestParameters(final long position,
8787
final int offset,

hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsBlobBlock.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ public class AbfsBlobBlock extends AbfsBlock {
4646
*
4747
* @param outputStream AbfsOutputStream Instance.
4848
* @param offset Used to generate blockId based on offset.
49+
* @param blockIdLength the expected length of the generated block ID.
50+
* @param blockIndex the index of the block; used in block ID generation.
4951
* @throws IOException exception is thrown.
5052
*/
5153
AbfsBlobBlock(AbfsOutputStream outputStream, long offset, int blockIdLength, long blockIndex) throws IOException {
@@ -57,16 +59,15 @@ public class AbfsBlobBlock extends AbfsBlock {
5759
}
5860

5961
/**
60-
* Generates a Base64-encoded block ID string based on the given position, stream ID, and desired raw length.
61-
* The block ID is composed using the stream UUID and the block index, which is derived from
62-
* the given position divided by the output stream's buffer size. The resulting string is
63-
* optionally adjusted to match the specified raw length, padded or trimmed as needed, and
64-
* then Base64-encoded.
62+
* Generates a Base64-encoded block ID string using the given stream UUID and block index.
63+
* The block ID is first created as a raw string using a format with the stream ID and block index.
64+
* If a non-zero rawLength is provided, the raw block ID is padded or trimmed to match the length.
65+
* The final string is then Base64-encoded and returned.
6566
*
66-
* @param streamId The UUID representing the stream, used as a prefix in the block ID.
67-
* @param rawLength The desired length of the raw block ID string before Base64 encoding.
68-
* If 0, no length adjustment is made.
69-
* @return A Base64-encoded block ID string suitable for use in block-based storage APIs.
67+
* @param streamId the UUID of the stream used to generate the block ID.
68+
* @param rawLength the desired length of the raw block ID string before encoding.
69+
* If 0, no length adjustment is done.
70+
* @return the Base64-encoded block ID string.
7071
*/
7172
private String generateBlockId(UUID streamId, int rawLength) {
7273
String rawBlockId = String.format(BLOCK_ID_FORMAT, streamId, blockIndex);

hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsBlobClient.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ public AbfsRestOperation appendBlock(final String path,
984984
requestHeaders.add(new AbfsHttpHeader(X_MS_LEASE_ID, requestParameters.getLeaseId()));
985985
}
986986
if (isChecksumValidationEnabled()) {
987-
addCheckSumHeaderForWrite(requestHeaders, requestParameters);
987+
addCheckSumHeaderForWrite(requestHeaders, requestParameters);
988988
}
989989
final AbfsUriQueryBuilder abfsUriQueryBuilder = createDefaultUriQueryBuilder();
990990
abfsUriQueryBuilder.addQuery(QUERY_PARAM_COMP, APPEND_BLOCK);
@@ -1025,6 +1025,7 @@ public AbfsRestOperation appendBlock(final String path,
10251025
* @param leaseId if there is an active lease on the path.
10261026
* @param contextEncryptionAdapter to provide encryption context.
10271027
* @param tracingContext for tracing the server calls.
1028+
* @param blobMd5 the MD5 hash of the blob for integrity verification.
10281029
* @return exception as this operation is not supported on Blob Endpoint.
10291030
* @throws UnsupportedOperationException always.
10301031
*/
@@ -1053,6 +1054,7 @@ public AbfsRestOperation flush(final String path,
10531054
* @param eTag The etag of the blob.
10541055
* @param contextEncryptionAdapter to provide encryption context.
10551056
* @param tracingContext for tracing the service call.
1057+
* @param blobMd5 the MD5 hash of the blob for integrity verification.
10561058
* @return executed rest operation containing response from server.
10571059
* @throws AzureBlobFileSystemException if rest operation fails.
10581060
*/

hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsClient.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -890,16 +890,18 @@ public abstract AbfsRestOperation flush(String path, long position,
890890

891891
/**
892892
* Flushes previously uploaded data to the specified path.
893-
* @param buffer The buffer containing block IDs to be flushed.
894-
* @param path The file path to which data should be flushed.
895-
* @param isClose True if this is the final flush (i.e., the file is being closed).
896-
* @param cachedSasToken SAS token used for authentication (if applicable).
897-
* @param leaseId Lease ID, if a lease is active on the file.
898-
* @param eTag ETag used for conditional request headers (e.g., If-Match).
893+
*
894+
* @param buffer The buffer containing block IDs to be flushed.
895+
* @param path The file path to which data should be flushed.
896+
* @param isClose True if this is the final flush (i.e., the file is being closed).
897+
* @param cachedSasToken SAS token used for authentication (if applicable).
898+
* @param leaseId Lease ID, if a lease is active on the file.
899+
* @param eTag ETag used for conditional request headers (e.g., If-Match).
899900
* @param contextEncryptionAdapter Adapter to provide encryption context, if encryption is enabled.
900-
* @param tracingContext Context for tracing the server calls.
901-
* @param blobMd5 The Base64-encoded MD5 hash of the blob for data integrity validation.
902-
* @return The executed {@link AbfsRestOperation} containing the server response.
901+
* @param tracingContext Context for tracing the server calls.
902+
* @param blobMd5 The Base64-encoded MD5 hash of the blob for data integrity validation.
903+
* @return The executed {@link AbfsRestOperation} containing the server response.
904+
*
903905
* @throws AzureBlobFileSystemException if the flush operation fails.
904906
*/
905907
public abstract AbfsRestOperation flush(byte[] buffer,

hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsDfsClient.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,7 @@ && appendSuccessCheckOp(op, path,
846846
* @param leaseId if there is an active lease on the path.
847847
* @param contextEncryptionAdapter to provide encryption context.
848848
* @param tracingContext for tracing the server calls.
849+
* @param blobMd5 the MD5 hash of the blob for integrity verification.
849850
* @return executed rest operation containing response from server.
850851
* @throws AzureBlobFileSystemException if rest operation fails.
851852
*/
@@ -891,6 +892,21 @@ public AbfsRestOperation flush(final String path,
891892
return op;
892893
}
893894

895+
/**
896+
* Flushes data to a file at the specified path, using the provided buffer and other parameters.
897+
* This operation is not supported on the DFS endpoint and will throw an {@link UnsupportedOperationException}.
898+
*
899+
* @param buffer the byte array containing the data to be flushed to the file.
900+
* @param path the path where the data has to be flushed.
901+
* @param isClose whether this is the last flush operation to the file.
902+
* @param cachedSasToken the SAS token to authenticate the operation.
903+
* @param leaseId the lease ID, if an active lease exists on the path.
904+
* @param eTag the ETag for concurrency control to ensure the flush is applied to the correct file version.
905+
* @param contextEncryptionAdapter the adapter providing the encryption context.
906+
* @param tracingContext the tracing context for tracking server calls.
907+
* @param blobMd5 the MD5 hash of the blob for integrity verification.
908+
* @throws UnsupportedOperationException if flush with blockIds is called on a DFS endpoint.
909+
*/
894910
@Override
895911
public AbfsRestOperation flush(byte[] buffer,
896912
final String path,

hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AzureBlobIngressHandler.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020

2121
import java.io.IOException;
2222
import java.nio.charset.StandardCharsets;
23-
import java.security.MessageDigest;
24-
import java.util.Base64;
2523

2624
import org.slf4j.Logger;
2725
import org.slf4j.LoggerFactory;

hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AzureDFSIngressHandler.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
package org.apache.hadoop.fs.azurebfs.services;
2020

2121
import java.io.IOException;
22-
import java.security.MessageDigest;
23-
import java.util.Base64;
2422

2523
import org.slf4j.Logger;
2624
import org.slf4j.LoggerFactory;

0 commit comments

Comments
 (0)