Skip to content

SparqlUpdatePatchHandler should likely not be locking? #137

Closed

Description

@RubenVerborgh

Wouldn't that be up to the PatchingStore?

Why does PatchingStore not

  • deal with source?
    • call getRepresentation
    • call setRepresentation

Then PatchHandler would just accept a representation and output one.

And perhaps it's not even PatchingStore that would operate the lock, but a LockingResourceStore that wraps it. (Although no strong opinion there, but it just seems that one LockingResourceStore over the whole thing would work fine.)

Activity

  1. added
    ❓question
    on Sep 4, 2020
  2. RubenVerborgh commented on Sep 5, 2020

    @RubenVerborgh
    MemberAuthor

    While it would certainly be easy if patchers are “representation in/out”, one drawback is that we cannot have an optimized implementation of (for example) append patches. E.g., an append patch on text/n-triples could literally just append on the filesystem, without having to re-read and re-serialize everything. However, such cases are then tied to a specific kind of storage, so are perhaps better implemented as a subclass of PatchingStore then anyway (which is also a good argument for typing those generically with regard to their source argument, so making PassthroughStore generic).

  3. jvherweg commented on Sep 7, 2020

    @jvherweg
    Member

    Yea there's no strong reason why the PatchHandler does it instead of the PatchingStore (except the "optimization" of calling the lock exactly when it is needed). Not sure if we always want the entire LockingResourceStore around, there might be ResourceStores who want to handle the locking themselves?

  4. RubenVerborgh commented on Sep 7, 2020

    @RubenVerborgh
    MemberAuthor

    there might be ResourceStores who want to handle the locking themselves?

    Sure, then it would indeed not be needed. But we have the AtomicResourceStore to tag them with then.

  5. jvherweg commented on Sep 7, 2020

    @jvherweg
    Member

    Sure, then it would indeed not be needed. But we have the AtomicResourceStore to tag them with then.

    But what I mean is that in that case the PatchingStore would want to lock when doing the modification even though we don't want to lock over the other functions like a LockingResourceStore would do.

  6. RubenVerborgh commented on Sep 7, 2020

    @RubenVerborgh
    MemberAuthor

    Right. Maybe LockingStore needs config arguments.

  7. jvherweg commented on Nov 3, 2020

    @jvherweg
    Member

    Having SparqlUpdatePatchHandler handle the store directly actually makes it possible to support PATCHing for file stores at the moment.

    With the current default config it is not possible to patch resources in a file story: the patch handler outputs Quads which are not supported by the store. We can now put a converting store in between though, which converts those quads to turtle. Except we only want to do this when the input type is internal/quads and not for any other RDF inputs (else incoming jsonld data would also be converted for example). The converting store only checks stored preferences though, so there is no way to configure it like that, except we can configure it to only use the converting store in the patch handler. (Not saying that perhaps we shouldn't think about extending the converting store instead though).

  8. RubenVerborgh commented on Nov 3, 2020

    @RubenVerborgh
    MemberAuthor

    Except we only want to do this when the input type is internal/quads and not for any other RDF inputs (else incoming jsonld data would also be converted for example).

    So we put a converting store in between that only goes from internal/quads to Turtle indeed?

    except we can configure it to only use the converting store in the patch handler.

    But nothing else can possibly give us internal/quads?

  9. jvherweg commented on Nov 4, 2020

    @jvherweg
    Member

    Except we only want to do this when the input type is internal/quads and not for any other RDF inputs (else incoming jsonld data would also be converted for example).

    So we put a converting store in between that only goes from internal/quads to Turtle indeed?

    Yes that would be a cleaner solution, but that is impossible with the current implementation of the converting store. Currently it has 2 possible modes:

    • Convert all outgoing GET requests to a new content-type based on the incoming preferences
    • Convert all incoming PUT/POST requests to a new content-type based on the stored preferences.

    What we actually would need for this case is:

    • Convert some (based on stored settings?) incoming PUT/POST requests to a new content-type based on the stored preferences.

    Because if we configured the store to want turtle for example, all incoming json-ld data would also be converted. So actually similar to what we want for #276 but going in the other direction.

  10. RubenVerborgh commented on Nov 4, 2020

    @RubenVerborgh
    MemberAuthor
    * Convert _some_ (based on stored settings?) incoming PUT/POST requests to a new content-type based on the stored preferences.
    

    Indeed, let's do this one. Essentially, we would want an internal/quads;q=0 setting for the outgoing part, which should then lead to the right conclusion.

  11. jvherweg commented on Nov 4, 2020

    @jvherweg
    Member

    Indeed, let's do this one. Essentially, we would want an internal/quads;q=0 setting for the outgoing part, which should then lead to the right conclusion.

    This will require a rework of some converting part somewhere because currently conversion is based on preferences saying what they want, not saying what they don't want.

  12. RubenVerborgh commented on Nov 4, 2020

    @RubenVerborgh
    MemberAuthor

    Makes sense; let's branch into issues.

  13. jvherweg commented on Nov 27, 2020

    @jvherweg
    Member

    Something I just thought of: we will have to make sure all links are correct once we fix #355 . Either the patching store/handler should not do any locking and simply be put behind the locking resource store (since that would also cause that resource to be locked before the modification), or the patching store needs to be put before the locking resource store and the store the handlers use needs to be one that bypasses the locking resource store. Otherwise we would end up with deadlocks since our locks are not re-entrant.

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

Metadata

Metadata

Assignees

Labels

❓question

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions