Changeset: dfe3ddc36d56 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=dfe3ddc36d56
Modified Files:
        clients/mapiclient/stethoscope.c
        monetdb5/mal/mal_dataflow.c
        
sql/test/BugTracker-2009/Tests/insert_into_done_by_procedure.SF-2607293.sql
        sql/test/BugTracker-2019/Tests/All
Branch: Nov2019
Log Message:

Merge with Apr2019 branch.


diffs (69 lines):

diff --git a/clients/mapiclient/stethoscope.c b/clients/mapiclient/stethoscope.c
--- a/clients/mapiclient/stethoscope.c
+++ b/clients/mapiclient/stethoscope.c
@@ -110,7 +110,7 @@ renderEvent(EventRecord *ev){
                return;
        fprintf(s, "[ ");
        fprintf(s, "%"PRId64",  ", ev->eventnr);
-       printf("\"%s\", ", ev->time);
+       fprintf(s, "\"%s\",     ", ev->time);
        if( ev->function && *ev->function)
                fprintf(s, "\"%s[%d]%d\",       ", ev->function, ev->pc, 
ev->tag);
        else
diff --git a/monetdb5/mal/mal_dataflow.c b/monetdb5/mal/mal_dataflow.c
--- a/monetdb5/mal/mal_dataflow.c
+++ b/monetdb5/mal/mal_dataflow.c
@@ -234,26 +234,30 @@ q_dequeue(Queue *q, Client cntxt)
 
                for (i = q->last - 1; i >= 0; i--) {
                        if (q->data[i]->flow->cntxt == cntxt) {
-                               if(minpc < 0){
+                               if (q->last > 1024) {
+                                       /* for long "queues", just grab the 
first eligible
+                                        * entry we encounter */
+                                       minpc = i;
+                                       break;
+                               }
+                               /* for shorter "queues", find the oldest 
eligible entry */
+                               if (minpc < 0) {
                                        minpc = i;
                                        s = q->data[i];
                                }
                                r = q->data[i];
-                               if( s && r && s->pc > r->pc){
+                               if (s && r && s->pc > r->pc) {
                                        minpc = i;
                                        s = r;
                                }
                        }
                }
-               if( minpc >= 0){
+               if (minpc >= 0) {
                        r = q->data[minpc];
                        i = minpc;
                        q->last--;
-                       while (i < q->last) {
-                               q->data[i] = q->data[i + 1];
-                               i++;
-                       }
-               } else r = NULL;
+                       memmove(q->data + i, q->data + i + 1, (q->last - i) * 
sizeof(q->data[0]));
+               }
 
                MT_lock_unset(&q->l);
                return r;
diff --git 
a/sql/test/BugTracker-2009/Tests/insert_into_done_by_procedure.SF-2607293.sql 
b/sql/test/BugTracker-2009/Tests/insert_into_done_by_procedure.SF-2607293.sql
--- 
a/sql/test/BugTracker-2009/Tests/insert_into_done_by_procedure.SF-2607293.sql
+++ 
b/sql/test/BugTracker-2009/Tests/insert_into_done_by_procedure.SF-2607293.sql
@@ -1,3 +1,5 @@
+start transaction;
+
 create table get_results (schem string, clust string, real_time bigint);
 create procedure save_times (schem string, clust string)
 BEGIN
@@ -14,3 +16,5 @@ select * from get_results;
 
 drop ALL procedure save_times;
 drop table get_results;
+
+rollback;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to