Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C#] FasterLog.Commit() doesn't save progress of persisted iterators #221

Closed
mito-csod opened this issue Dec 23, 2019 · 0 comments · Fixed by #222
Closed

[C#] FasterLog.Commit() doesn't save progress of persisted iterators #221

mito-csod opened this issue Dec 23, 2019 · 0 comments · Fixed by #222

Comments

@mito-csod
Copy link
Contributor

FasterLogScanIterator.CompleteUntil() updates requestedCompletedUntilAddress. However, FasterLogRecoveryInfo.SnapshotIterators() looks at CompletedUntilAddress, not requestedCompletedUntilAddress, so the value never makes its way to persistence. Repro below:

byte[] testBytes1 = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 };
byte[] testBytes2 = new byte[] { 8, 9, 10, 11, 12, 13, 14, 15 };           
const string iterName = "snowflake";

var settings = new FasterLogSettings
{
	LogDevice = Devices.CreateLogDevice(Environment.CurrentDirectory + "/abc.lf"),
	LogCommitFile = Environment.CurrentDirectory + "/abc.cf"
};

using (var log = new FasterLog(settings))
using (var iter = log.Scan(0, long.MaxValue, iterName))
{
	byte[] readBuf = new byte[128];
	log.Enqueue(testBytes1);
	log.Enqueue(testBytes2);
	log.Commit();
	iter.GetNext(out readBuf, out int len, out long addr);
	iter.CompleteUntil(addr);
	log.Commit();
}

using (var recoveredLog = new FasterLog(settings))
using (var iter = recoveredLog.Scan(0, long.MaxValue, iterName))
{
	byte[] readBuf = new byte[128];
	iter.GetNext(out readBuf, out int len, out long addr);
	/* you would expect readBuf to have {8, 9, 10...} but it has {0, 1, 2...} */
}
@mito-csod mito-csod changed the title FasterLog.Commit() doesn't save progress of persisted iterators [C#] FasterLog.Commit() doesn't save progress of persisted iterators Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant