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

Support read-only mode #21

Closed
broneill opened this issue Sep 11, 2013 · 6 comments
Closed

Support read-only mode #21

broneill opened this issue Sep 11, 2013 · 6 comments

Comments

@broneill
Copy link
Member

No description provided.

@broneill
Copy link
Member Author

This involves more than opening the db file(s) in read-only mode. Log files cannot be deleted/created, the info file cannot be overwritten, the lock file cannot be created. Checkpoints are disabled and recovery must not checkpoint either. Snapshots don't create a temp database.

Should in-memory changes be allowed, but just not be writable? This isn't a true read-only mode, but instead, a non-persistable mode. Like a non-durable database, the cache can become exhausted.

@tylaar
Copy link

tylaar commented Aug 1, 2015

for Supporting ReadOnly mode, is it necessary to create a new PagedDB subClass which provides the functionality of reading values from DB, but disable all the writing functions inside ? Or we reuse the DurablePageDb class and check the readOnly mode inside to perform the operations ?

@tylaar
Copy link

tylaar commented Aug 1, 2015

If we use the NoPagedBd class, then I think it's the same as allowing in-memory changes.

@broneill
Copy link
Member Author

broneill commented Aug 1, 2015

I think the mode should be "fileReadOnly(true)", and allow changes to made in-memory. The PageArray is opened in read-only mode, preventing writes. New checks are required for providing better exceptions.

@tylaar
Copy link

tylaar commented Aug 2, 2015

I've been modifying in my fork for readOnly in a lot fields, I found that multiple choices are available for supporting readOnly. For instance, RedoWriter, in my perspective, since ReadOnly mode will not allow RedoLog/UndoLog creation, one possible way to do it is to create a DummyRedoWriter, which inside, write. checkpoint functions will just pass and do nothing. Another way is to throw ReadOnlyModeException during certain API call, like someone wants to call checkpoint on Database class. Are these two ways all acceptable ?

@tylaar
Copy link

tylaar commented Aug 2, 2015

Another question is for Snapshot function. If snapshot isn't allowed to create TempDatabase, then how can we do it ? Directly snapshot to memory only ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants