<br><br><div class="gmail_quote">On Sun, May 29, 2011 at 1:54 PM, Mariano Martinez Peck <span dir="ltr">&lt;<a href="mailto:marianopeck@gmail.com">marianopeck@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br><br><div class="gmail_quote"><div class="im">On Sun, May 29, 2011 at 10:55 AM, Philippe Marschall <span dir="ltr">&lt;<a href="mailto:philippe.marschall@gmail.com" target="_blank">philippe.marschall@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2011/5/28 Mariano Martinez Peck &lt;<a href="mailto:marianopeck@gmail.com" target="_blank">marianopeck@gmail.com</a>&gt;:<br>
<div>&gt;<br>
&gt;&gt;<br>
&gt;&gt; &gt; What are the errors that I must avoid making ?<br>
&gt;&gt;<br>
&gt;&gt; AFAIK SqueakDBX uses FFI which to my understanding means that it calls<br>
&gt;&gt; block the entire VM. That reduces the amount of concurrency a single<br>
&gt;&gt; image can handle. It also makes a connection pool more important.<br>
&gt;&gt;<br>
&gt;<br>
&gt; Yes, FFI blocks the whole VM while a functions is being called. However, if<br>
&gt; and only if the database client library supports asynchronous queries,<br>
&gt; SqueakDBX will work asynchronously. Basically, we do a loop where we ask the<br>
&gt; backend if the query was ready. If it was not, we do a yield (we let other<br>
&gt; process of the image to run) and then continue the loop.<br>
<br>
</div>How do you avoid turning this into busy awaiting and still manage to<br>
get woken up when data is available?<br>
<div><div></div><div><br></div></div></blockquote></div><div><br>What we do is <br></div></div></blockquote><div><br>gmail shortcuts...<br><br>What we do is:<br><br>DBXBackend &gt;&gt; processNextResultSet: aConnection querySettings: aQuerySettings<br>
    &quot;Gets the next resultSet of the query. Depending on the type of query, it will return a DBXResult or DBXResultSet.<br>    If there is a timeout, it will cicle till this is finished.&quot;<br>    | returnCode |<br>
    [self<br>        nextResultSet: aConnection<br>        querySettings: aQuerySettings<br>        onReturn: [:handle :code | <br>            returnCode := code.<br>            code = OpenDBX resultWithRows<br>                ifTrue: [ ^ self processResultWithRows: aConnection<br>
                     resultHandle: handle <br>                    querySettings: aQuerySettings].<br>            code = OpenDBX resultWithoutRows<br>                ifTrue: [ ^ self processResultWithoutRows: aConnection<br>
                     resultHandle: handle<br>                     querySettings: aQuerySettings].<br>            code = OpenDBX resultDone ifTrue: [^ nil].<br>            <br>           <span style="background-color: rgb(255, 255, 51);"> (code = OpenDBX resultTimeout) ifTrue: [ (Delay forMilliseconds: (aQuerySettings timeout asMiliseconds)) wait  ].</span><br>
            <br>            ]]     doWhileTrue: [returnCode = OpenDBX resultTimeout].<br>        <br>        OpenDBXDriverError signal: &#39;Uknown problem with executeStatement&#39;.<br> <br><br><br>so....that is the ugly part of dbx... the method #nextResultSet:querySettings:onReturn:   basically answers what the backend answers to:<br>
<br>OpenDBX current<br>                apiQueryResult: aConnection handle<br>                handle: handleArray<br>                timeout: aQuerySettings timeoutAsDBXTimeSpec<br>                chunk: aQuerySettings pageSize.<br>
<br></div><div><br>that answers what we call in the previous method &quot;code&quot;. That &quot;code&quot; can mean &quot;results wtih no row&quot; for example when it was a DDL (a create table for example), a &quot;result done&quot; when we have finishes iterating all results , and &quot;result timeout&quot; that means that the query is not yet finished. In this case we have to always loop until we have one the two previous possibilities.<br>
<br>Non of us is expert with processes and friends so we may be doing something wrong. If true, please let us know.<br><br>Mariano<br><br><br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="gmail_quote"><div> </div><div class="im"><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<div><div>
Cheers<br>
Philippe<br>
_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org" target="_blank">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
</div></div></blockquote></div></div><br><br clear="all"><div><div></div><div class="h5"><br>-- <br>Mariano<br><a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Mariano<br><a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br><br>