[ 
https://issues.apache.org/jira/browse/SOLR-3173?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13220062#comment-13220062
 ] 

Per Steffensen commented on SOLR-3173:
--------------------------------------

Believe we will be able to use _version_ if:
a) There is a "realtime" way of getting the _version_ corresponding to a given 
id (or whatever you use as uniqueKey). Lets call this getRealtimeVersion(id)
b) The _version_ for a given id returned by getRealtimeVersion(id) never 
changes unless changes has been made to the document with that id (created, 
updated or deleted)
c) That getRealtimeVersion(id) will immediately return that new _version_ as 
soon a change has been made - no soft- or hard-commit necessary. Well that is 
the realtime part :-)
d) I will always get a negative number (hopefully always -1) from 
getRealtimeVersion(id) when calling with an id, where there is no corresponding 
document in the solr-core. No matter if there has never been such a document or 
if it has been there but has been deleted.

Can you please confirm or correct me on the above bullets, Yonik. It would also 
be very helpfull if you would provide the code for getRealtimeVersion(id), 
assuming that I am in the DirectUpdateHandler2. Thanks alot!

Guess this version-checking stuff is only necessary on primary (or master or 
whatever you call it) shards and not on replica (or slave). How do I know in 
DirectUpdateHandler2 if I am primary/master- or replica/slave-shard?

Regret a little bit the idea about different URLs stated in comment above. 
Guess I would just like to state info about the wanted semantics in the query 
in some other way. I guess it would be nice with a "semantics" URL-param with 
the possible values "db-insert", "db-update", "db-update-version-checked" and 
"classic-solr-update":
- semantics=db-insert: Index document doc if and only if 
getRealtimeVersion(doc.id) returns -1. Else return DocumentAlreadyExist error
- semantics=db-update: Replace existing document if it exists, else return 
DocumentDoesNotExist error
- semantics=db-update-version-checked: As db-update but if _version_ on the 
provided document does not correspond to existing getRealtimeVersion(doc.id) 
return VersionConflict error
- semantics=classic-solr-update: Do exactly as update does today in Solr
"classic-solr-update" will be used if "semantics" is not specified in update 
request - it is the default. In solrconfig.xml you will be able to change 
default semantics plus provide a list of semantics that are not allowed. 

Regards, Per Steffensen
                
> Database semantics - insert and update
> --------------------------------------
>
>                 Key: SOLR-3173
>                 URL: https://issues.apache.org/jira/browse/SOLR-3173
>             Project: Solr
>          Issue Type: New Feature
>          Components: update
>    Affects Versions: 3.5
>         Environment: All
>            Reporter: Per Steffensen
>            Assignee: Per Steffensen
>              Labels: RDBMS, insert, nosql, uniqueKey, update
>             Fix For: 4.0
>
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> In order increase the ability of Solr to be used as a NoSql database (lots of 
> concurrent inserts, updates, deletes and queries in the entire lifetime of 
> the index) instead of just a search index (first: everything indexed (in one 
> thread), after: only queries), I would like Solr to support the following 
> features inspired by RDBMSs and other NoSql databases.
> * Given a solr-core with a schema containing a uniqueKey-field "uniqueField" 
> and a document Dold, when trying to INSERT a new document Dnew where 
> Dold.uniqueField is equal to Dnew.uniqueField, then I want a 
> DocumentAlredyExists error. If no such document Dold exists I want Dnew 
> indexed into the solr-core.
> * Given a solr-core with a schema containing a uniqueKey-field "uniqueField" 
> and a document Dold, when trying to UPDATE a document Dnew where 
> Dold.uniqueField is equal to Dnew.uniqueField I want Dold deleted from and 
> Dnew added to the index (just as it is today).If no such document Dold exists 
> I want nothing to happen (Dnew is not added to the index)
> The essence of this issue is to be able to state your intent (insert or 
> update) and have slightly different semantics (from each other and the 
> existing update) depending on you intent.
> The functionality provided by this issue is only really meaningfull when you 
> run with "updateLog" activated.
> This issue might be solved more or less at the same time as SOLR-3178, and 
> only one single SVN patch might be given to cover both issues.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to