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

DataRequest instance - data locking questions #13

Open
pmorrill opened this issue Nov 10, 2020 · 3 comments
Open

DataRequest instance - data locking questions #13

pmorrill opened this issue Nov 10, 2020 · 3 comments

Comments

@pmorrill
Copy link

pmorrill commented Nov 10, 2020

From Denis' email:

=============
A couple questions related to the data request from the NC R package:

  • When users create a DataRequest object, are you caching the Java instance in memory in between paging requests?
  • If this is a paging request, but the object no longer exists in your cache (e.g. following a server restart), do you then only reload the object from the database?
  • Do you need to write anything to that object after it is initially created (i.e. during paging requests)?

If we don’t need to write to the database during paging requests, I’d like to consider removing the class LockedObject on those objects stored in the cache (e.g. making them read-only, so other processes could open them for editing such as from the web site). If you are calling the update() method at every page, this is probably not worth doing (or we may want to revisit whether that is necessary to do).

The process would be something like this:

  • User creates the query parameters calls the API
  • The API creates a new DataRequest object, saves it to the database, and then calls datarequest.removeLock();
  • On paging requests, you check the cache first, and if you need to reload it again, you call the readonly = true constructor.
@pmorrill
Copy link
Author

The one issue I see is that when a DataRequest instance is finalized a call to DataRequest#upsert happens. This is where the data download statistics are written to the DataCollections records (I believe). If I remove the lock earlier, will this operation fail?

@steffilazerte
Copy link
Member

Hi @pmorrill, this slipped past me, sorry it's taken so long to respond!
Just to confirm, this is something API side only, right? Not something I need to implement in R?

@pmorrill
Copy link
Author

pmorrill commented Dec 3, 2020

Yes - this is all server-side.

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

No branches or pull requests

2 participants