Skip to content

Commit f030c4d

Browse files
committed
Bugfixes for re-calculation from testing.
1 parent 3422d7c commit f030c4d

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/gridftp_hdfs_cksm.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,7 @@ hdfs_calculate_checksum(hdfs_handle_t *hdfs_handle, hdfsFS fs, const char *type)
342342

343343
GlobusGFSName(hdfs_calculate_checksum);
344344

345-
hdfs_parse_checksum_types(hdfs_handle, type);
346-
hdfs_initialize_checksum(hdfs_handle);
345+
hdfs_initialize_checksums(hdfs_handle);
347346

348347
hdfsFile fd = hdfsOpenFile(fs, hdfs_handle->pathname, O_RDONLY, 0, 1, 0);
349348
if (fd == NULL) {
@@ -359,11 +358,13 @@ hdfs_calculate_checksum(hdfs_handle_t *hdfs_handle, hdfsFS fs, const char *type)
359358
return rc;
360359
}
361360
ssize_t retval = 0;
361+
globus_off_t offset = 0;
362362
do {
363-
hdfs_udpate_checksums(hdfs_handle, buffer, retval);
363+
hdfs_update_checksums(hdfs_handle, buffer, retval);
364364
errno = 0; // older versions of libhdfs sometimes fails to reset errno.
365365
retval = hdfsRead(fs, fd, buffer, cksum_buffer_size);
366366
if ((retval == -1) && (errno == EINTR)) {continue;}
367+
offset += retval;
367368
} while (retval > 0);
368369
if (retval == -1) {
369370
SystemError(hdfs_handle, "Failed to read from file for checksumming", rc);
@@ -372,6 +373,8 @@ hdfs_calculate_checksum(hdfs_handle_t *hdfs_handle, hdfsFS fs, const char *type)
372373
hdfsCloseFile(fs, fd);
373374

374375
if (rc == GLOBUS_SUCCESS) {
376+
hdfs_handle->offset = offset;
377+
hdfs_finalize_checksums(hdfs_handle);
375378
rc = hdfs_save_checksum(hdfs_handle);
376379
}
377380
return rc;
@@ -388,7 +391,7 @@ globus_result_t hdfs_get_checksum(hdfs_handle_t *hdfs_handle, const char * pathn
388391

389392
hdfsFS fs = hdfsConnectAsUser("default", 0, "root");
390393
if (fs == NULL) {
391-
SystemError(hdfs_handle, "Failure in connecting to HDFS for checksum upload", rc);
394+
SystemError(hdfs_handle, "Failure in connecting to HDFS for checksumming.", rc);
392395
return rc;
393396
}
394397

0 commit comments

Comments
 (0)