Skip to content

[8.0] Add Windows native method to retrieve the number of allocated bytes on disk for file (#79698)#80426

Merged
elasticsearchmachine merged 3 commits intoelastic:8.0from
tlrx:backport/8.0/pr-79698
Nov 5, 2021
Merged

[8.0] Add Windows native method to retrieve the number of allocated bytes on disk for file (#79698)#80426
elasticsearchmachine merged 3 commits intoelastic:8.0from
tlrx:backport/8.0/pr-79698

Conversation

@tlrx
Copy link
Copy Markdown
Member

@tlrx tlrx commented Nov 5, 2021

Backports the following commits to 8.0:

…n disk for file (elastic#79698)

In elastic#79371 we fixed a bug where cache files were not created 
as sparse files on Windows platforms because the wrong 
options were used when creating the files for the first time. 
This bug got unnoticed as we were lacking a way to retrieve 
the exact number of bytes allocated for a given file on disk.

This commit adds a FileSystemNatives.allocatedSizeInBytes(Path) 
method for that exact purpose (only implemented for Windows 
for now) and a test in CacheFileTests that would fail on 
Windows if the cache file is not sparse.

Relates elastic#79371
@tlrx tlrx added auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport labels Nov 5, 2021
@tlrx tlrx added test-windows Trigger CI checks on Windows and removed auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) labels Nov 5, 2021
@tlrx
Copy link
Copy Markdown
Member Author

tlrx commented Nov 5, 2021

@elasticmachine test this please

@tlrx
Copy link
Copy Markdown
Member Author

tlrx commented Nov 5, 2021

@elasticmachine update branch

@tlrx tlrx added auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) and removed test-windows Trigger CI checks on Windows labels Nov 5, 2021
@tlrx
Copy link
Copy Markdown
Member Author

tlrx commented Nov 5, 2021

@elasticmachine update branch

@elasticsearchmachine elasticsearchmachine merged commit b0950b6 into elastic:8.0 Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport v8.0.0-rc2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants