Changeset: 5508f11dcab6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/5508f11dcab6
Modified Files:
        gdk/gdk_aggr.c
Branch: qcancel
Log Message:

timeout prod


diffs (64 lines):

diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -1215,6 +1215,8 @@ BATsum(void *res, int tp, BAT *b, BAT *s
                const TYPE1 *restrict vals = (const TYPE1 *) values;    \
                gid = 0;        /* doesn't change if gidincr == false */ \
                while (ncand > 0) {                                     \
+                       GDK_CHECK_TIMEOUT(timeoffset, counter,\
+                                       GOTO_LABEL_TIMEOUT_HANDLER(bailout));\
                        ncand--;                                        \
                        i = canditer_next(ci) - seqb;                   \
                        if (gids == NULL || !gidincr ||                 \
@@ -1256,6 +1258,8 @@ BATsum(void *res, int tp, BAT *b, BAT *s
                const TYPE *vals = (const TYPE *) values;               \
                gid = 0;        /* doesn't change if gidincr == false */ \
                while (ncand > 0) {                                     \
+                       GDK_CHECK_TIMEOUT(timeoffset, counter,\
+                                       GOTO_LABEL_TIMEOUT_HANDLER(bailout));\
                        ncand--;                                        \
                        i = canditer_next(ci) - seqb;                   \
                        if (gids == NULL || !gidincr ||                 \
@@ -1292,6 +1296,8 @@ BATsum(void *res, int tp, BAT *b, BAT *s
                const TYPE *restrict vals = (const TYPE *) values;      \
                gid = 0;        /* doesn't change if gidincr == false */ \
                while (ncand > 0) {                                     \
+                       GDK_CHECK_TIMEOUT(timeoffset, counter,\
+                                       GOTO_LABEL_TIMEOUT_HANDLER(bailout));\
                        ncand--;                                        \
                        i = canditer_next(ci) - seqb;                   \
                        if (gids == NULL || !gidincr ||                 \
@@ -1332,6 +1338,8 @@ BATsum(void *res, int tp, BAT *b, BAT *s
                const TYPE1 *restrict vals = (const TYPE1 *) values;    \
                gid = 0;        /* doesn't change if gidincr == false */ \
                while (ncand > 0) {                                     \
+                       GDK_CHECK_TIMEOUT(timeoffset, counter,\
+                                       GOTO_LABEL_TIMEOUT_HANDLER(bailout));\
                        ncand--;                                        \
                        i = canditer_next(ci) - seqb;                   \
                        if (gids == NULL || !gidincr ||                 \
@@ -1380,6 +1388,13 @@ doprod(const void *restrict values, oid 
        oid gid;
        unsigned int *restrict seen; /* bitmask for groups that we've seen */
 
+       size_t counter = 0;
+       lng timeoffset = 0;
+       QryCtx *qry_ctx = MT_thread_get_qry_ctx();
+       if (qry_ctx != NULL) {
+               timeoffset = (qry_ctx->starttime && qry_ctx->querytimeout) ? 
(qry_ctx->starttime + qry_ctx->querytimeout) : 0;
+       }
+
        /* allocate bitmap for seen group ids */
        seen = GDKzalloc(((ngrp + 31) / 32) * sizeof(int));
        if (seen == NULL) {
@@ -1586,6 +1601,10 @@ doprod(const void *restrict values, oid 
        GDKfree(seen);
        GDKerror("22003!overflow in product aggregate.\n");
        return BUN_NONE;
+
+  bailout:
+       GDKfree(seen);
+       return BUN_NONE;
 }
 
 /* calculate group products with optional candidates list */
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to