Last active
January 11, 2022 00:11
-
-
Save itn3000/5cbfd41d166ae41173a45d5d4792c03e to your computer and use it in GitHub Desktop.
old file did not deleted in FasterLog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using FASTER.core; | |
| // all old files are deleted after truncating in same session | |
| { | |
| using var device = Devices.CreateLogDevice("test.log", recoverDevice: true); | |
| using var log = new FasterLog(new FasterLogSettings() | |
| { | |
| LogDevice = device, | |
| SegmentSizeBits = 20, | |
| MemorySizeBits = 15, | |
| PageSizeBits = 10, | |
| }); | |
| Console.WriteLine($"{log.BeginAddress}, {log.TailAddress}"); | |
| var data = new byte[512]; | |
| // inserting data | |
| for (int i = 0; i < 10000; i++) | |
| { | |
| log.Enqueue(data); | |
| } | |
| log.Commit(true); | |
| log.TruncateUntil(log.TailAddress); | |
| log.Commit(true); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // expected: after running this, There is only last log segment. | |
| // actual: after running this, old file is not deleted. | |
| using FASTER.core; | |
| { | |
| using var device = Devices.CreateLogDevice("test.log", recoverDevice: true); | |
| using var log = new FasterLog(new FasterLogSettings() | |
| { | |
| LogDevice = device, | |
| SegmentSizeBits = 20, | |
| MemorySizeBits = 15, | |
| PageSizeBits = 10, | |
| }); | |
| Console.WriteLine($"{log.BeginAddress}, {log.TailAddress}"); | |
| var data = new byte[512]; | |
| // inserting data | |
| for (int i = 0; i < 10000; i++) | |
| { | |
| log.Enqueue(data); | |
| } | |
| log.Commit(true); | |
| } | |
| { | |
| using var device = Devices.CreateLogDevice("test.log", recoverDevice: true); | |
| using var log = new FasterLog(new FasterLogSettings() | |
| { | |
| LogDevice = device, | |
| SegmentSizeBits = 20, | |
| MemorySizeBits = 15, | |
| PageSizeBits = 10, | |
| }); | |
| Console.WriteLine($"{log.BeginAddress}, {log.TailAddress}"); | |
| log.TruncateUntil(log.TailAddress); | |
| log.Commit(true); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is fixed in microsoft/FASTER#627