My use case is a very basic SQL Select:

try (ODatabaseDocumentTx db = connect(profile)) {
 String queryString = "select from " + query.getClazz() + " where " + query.
getFieldName() + " = ?";
 List<ODocument> res = db.command(new OSQLSynchQuery<ODocument>(queryString
)).execute(query.getFieldValue());
}

private static ODatabaseDocumentTx connect(DatabaseProfile dbProfile) {
 return new ODatabaseDocumentTx(dbProfile.getFullDBLocation()).open(
dbProfile.getDbSettings().getUser(), dbProfile.getDbSettings().getPassword
());
}

I have an embedded server in my app started before that. The problem is 
this select only looks at the local node and does not distributed it to 
other nodes. This is because OCommandExecutorSQLSelect which executes SQL 
selects does not implement OCommandDistributedReplicateRequest which is 
required to be replicated to other nodes in ODistributedStorage#command():

if (OScenarioThreadLocal.INSTANCE.get() != RUN_MODE.RUNNING_DISTRIBUTED) {
    if (exec instanceof OCommandDistributedReplicateRequest)
        replicated = ((OCommandDistributedReplicateRequest) exec).
isReplicated();
 }

The result is that I sometimes get a null response even though "save()" on 
other node returned "OK". After I wait some time or ping other nodes I 
finally get the record. The thing is I have read and write quorums for 
everything set to N/2 + 1 so this should not happen.

Distribution seems to work because first of all after some time data gets 
replicated, secondly I do get conflicts from time to time on save() but 
they get resolved since the quorum has been met.

Am I missing some other parts of the code where the results are aggregated?

Am I opening the DB properly? Or should I get it from my embedded server 
instance like:

server.openDatabase(dbType, dbUrl, user, pass);

Mateusz 

On Monday, June 16, 2014 2:35:38 AM UTC+9, Lvc@ wrote:
>
> Hi,
> query are executed on all the involved servers. If you've sharding the 
> query is split against all the servers and the result is aggregated back on 
> the main node.
>
> Read-Quorum is used on "record read" operation, so after the query is 
> executed, the record read operations should be called against all the 
> results.
>
> May you explain better your use case?
>
> Lvc@
>
>
>
> On 13 June 2014 02:35, Mateusz Dymczyk <[email protected] <javascript:>> 
> wrote:
>
>> Correct me if I'm wrong but, even when running in distributed mode, SQL 
>> Select commands are not considered as distributed (since 
>> OCommandExecutorSQLSelect does not implement 
>> OCommandDistributedReplicateRequest). This is quite problematic if I want a 
>> readQuorum bigger than 1. Is there any way to fix this?
>>
>> Mateusz  
>>
>> -- 
>>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "OrientDB" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to