Skip to content

Commit

Permalink
Don't fsync() in checksum
Browse files Browse the repository at this point in the history
This gives a major boost in librepo performance. For a reposync of an
Amazon Linux 2023 x86-64 repository on a m5n.16xlarge EC2 instance with
a 500MB/sec 3000IOP EBS volume, this alone reduces run time by 30
seconds of wall time, and gets reposync nearly using a whole core rather
than only two thirds of one.
  • Loading branch information
stewartsmith committed Feb 9, 2024
1 parent ae727d9 commit 7a919b8
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions librepo/checksum.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,17 +266,6 @@ lr_checksum_fd_compare(LrChecksumType type,

*matches = (strcmp(expected, checksum)) ? FALSE : TRUE;

if (fsync(fd) != 0) {
if (errno == EROFS || errno == EINVAL) {
g_debug("fsync failed: %s", strerror(errno));
} else {
g_set_error(err, LR_CHECKSUM_ERROR, LRE_FILE,
"fsync failed: %s", strerror(errno));
lr_free(checksum);
return FALSE;
}
}

if (caching && *matches && timestamp != -1) {
// Store timestamp and checksum as extended file attribute if caching is enabled
FSETXATTR(fd, timestamp_key, timestamp_str, strlen(timestamp_str), 0);
Expand Down

0 comments on commit 7a919b8

Please sign in to comment.