Skip to content

Commit

Permalink
Fix lfc_ensure_function which now disables LFC (#5294)
Browse files Browse the repository at this point in the history
## Problem

There was a bug in lfc_ensure_opened which actually disables LFC

## Summary of changes

Return true ifLFC file is normally opened

## Checklist before requesting a review

- [ ] I have performed a self-review of my code.
- [ ] If it is a core feature, I have added thorough tests.
- [ ] Do we need to implement analytics? if so did you add the relevant
metrics to the dashboard?
- [ ] If this PR requires public announcement, mark it with
/release-notes label and add several sentences in this section.

## Checklist before merging

- [ ] Do not forget to reformat commit message to not include the above
checklist

Co-authored-by: Konstantin Knizhnik <[email protected]>
  • Loading branch information
knizhnik and Konstantin Knizhnik authored Sep 13, 2023
1 parent 8556d94 commit 1697e7b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pgxn/neon/file_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ lfc_ensure_opened(void)
return false;
}
}
return false;
return true;
}

static void
Expand Down Expand Up @@ -640,6 +640,7 @@ lfc_write(NRelFileInfo rinfo, ForkNumber forkNum, BlockNumber blkno,
rc = pwrite(lfc_desc, buffer, BLCKSZ, ((off_t)entry->offset*BLOCKS_PER_CHUNK + chunk_offs)*BLCKSZ);
if (rc != BLCKSZ)
{
LWLockRelease(lfc_lock);
lfc_disable("write");
}
else
Expand All @@ -650,9 +651,8 @@ lfc_write(NRelFileInfo rinfo, ForkNumber forkNum, BlockNumber blkno,
dlist_push_tail(&lfc_ctl->lru, &entry->lru_node);

entry->bitmap[chunk_offs >> 5] |= (1 << (chunk_offs & 31));
LWLockRelease(lfc_lock);
}

LWLockRelease(lfc_lock);
}

/*
Expand Down

1 comment on commit 1697e7b

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2540 tests run: 2415 passed, 0 failed, 125 skipped (full report)


Flaky tests (1)

Postgres 16

  • test_partial_evict_tenant: release

Code coverage (full report)

  • functions: 53.1% (7669 of 14453 functions)
  • lines: 81.0% (44783 of 55281 lines)

The comment gets automatically updated with the latest test results
1697e7b at 2023-09-13T06:42:26.367Z :recycle:

Please sign in to comment.