Changeset: 40da30ad86f1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=40da30ad86f1
Modified Files:
        common/stream/stream.h
        common/utils/mcrypt.c
        monetdb5/modules/mal/mal_mapi.c
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql_result.c
Branch: default
Log Message:

Remove protocol 10.


diffs (truncated from 717 to 300 lines):

diff --git a/common/stream/stream.h b/common/stream/stream.h
--- a/common/stream/stream.h
+++ b/common/stream/stream.h
@@ -232,7 +232,6 @@ stream_export stream *bs_stream(stream *
 typedef enum {
        PROTOCOL_AUTO = 0, // unused
        PROTOCOL_9 = 1, // mal_mapi.c, mal_client.c;
-       PROTOCOL_10 = 2, // mal_mapi.c, sql_result.c
        PROTOCOL_COLUMNAR = 3 // sql_result.c
 } protocol_version;
 
diff --git a/common/utils/mcrypt.c b/common/utils/mcrypt.c
--- a/common/utils/mcrypt.c
+++ b/common/utils/mcrypt.c
@@ -45,7 +45,6 @@ mcrypt_getHashAlgorithms(void)
         * desire.
         */
        static const char *algorithms =
-               "PROT10"
 #ifdef HAVE_RIPEMD160_UPDATE
                ",RIPEMD160"
 #endif
diff --git a/monetdb5/modules/mal/mal_mapi.c b/monetdb5/modules/mal/mal_mapi.c
--- a/monetdb5/modules/mal/mal_mapi.c
+++ b/monetdb5/modules/mal/mal_mapi.c
@@ -182,79 +182,6 @@ doChallenge(void *data)
        }
        buf[len] = 0;
 
-       if (strstr(buf, "PROT10")) {
-               char *errmsg = NULL;
-               char *buflenstrend, *buflenstr = strstr(buf, "PROT10");
-               compression_method comp;
-               protocol = PROTOCOL_10;
-               if ((buflenstr = strchr(buflenstr, ':')) == NULL ||
-                       (buflenstr = strchr(buflenstr + 1, ':')) == NULL) {
-                       mnstr_printf(fdout, "!buffer size needs to be set and 
bigger than %d\n", BLOCK);
-                       close_stream(fdin);
-                       close_stream(fdout);
-                       GDKfree(buf);
-                       return;
-               }
-               buflenstr++;                    /* position after ':' */
-               buflenstrend = strchr(buflenstr, ':');
-
-               if (buflenstrend) buflenstrend[0] = '\0';
-               buflen = atol(buflenstr);
-               if (buflenstrend) buflenstrend[0] = ':';
-
-               if (buflen < BLOCK) {
-                       mnstr_printf(fdout, "!buffer size needs to be set and 
bigger than %d\n", BLOCK);
-                       close_stream(fdin);
-                       close_stream(fdout);
-                       GDKfree(buf);
-                       return;
-               }
-
-               comp = COMPRESSION_NONE;
-               if (strstr(buf, "COMPRESSION_SNAPPY")) {
-#ifdef HAVE_SNAPPY
-                       comp = COMPRESSION_SNAPPY;
-#else
-                       errmsg = "!server does not support Snappy 
compression.\n";
-#endif
-               } else if (strstr(buf, "COMPRESSION_LZ4")) {
-#ifdef HAVE_LIBLZ4
-                       comp = COMPRESSION_LZ4;
-#else
-                       errmsg = "!server does not support LZ4 compression.\n";
-#endif
-               } else if (strstr(buf, "COMPRESSION_NONE")) {
-                       comp = COMPRESSION_NONE;
-               } else {
-                       errmsg = "!no compression type specified.\n";
-               }
-
-               if (errmsg) {
-                       // incorrect compression type specified
-                       mnstr_printf(fdout, "%s", errmsg);
-                       close_stream(fdin);
-                       close_stream(fdout);
-                       GDKfree(buf);
-                       return;
-               }
-
-               {
-                       // convert the block_stream into a block_stream2
-                       stream *from, *to;
-                       from = block_stream2(fdin, buflen, comp);
-                       to = block_stream2(fdout, buflen, comp);
-                       if (from == NULL || to == NULL) {
-                               GDKsyserror("SERVERlisten:"MAL_MALLOC_FAIL);
-                               close_stream(fdin);
-                               close_stream(fdout);
-                               GDKfree(buf);
-                               return;
-                       }
-                       fdin = from;
-                       fdout = to;
-               }
-       }
-
        bs = bstream_create(fdin, 128 * BLOCK);
 
        if (bs == NULL){
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -293,7 +293,6 @@ SQLset_protocol(Client cntxt, MalBlkPtr 
        if (!(
                protocol == PROTOCOL_AUTO ||
                protocol == PROTOCOL_9 ||
-               protocol == PROTOCOL_10 ||
                protocol == PROTOCOL_COLUMNAR))
        {
                return createException(SQL, "sql.set_protocol", "unknown 
protocol: %d", protocol);
diff --git a/sql/backends/monet5/sql_result.c b/sql/backends/monet5/sql_result.c
--- a/sql/backends/monet5/sql_result.c
+++ b/sql/backends/monet5/sql_result.c
@@ -44,12 +44,6 @@
                ((((hge)long_long_SWAP(h))<<64) |                               
\
                 (0xffffffffffffffff&long_long_SWAP(h>>64)))
 #endif
-
-static lng
-mnstr_swap_lng(stream *s, lng lngval) {
-       return mnstr_get_swapbytes(s) ? long_long_SWAP(lngval) : lngval;
-}
-
 #define DEC_TOSTR(TYPE)                                                        
        \
        do {                                                                    
                \
                char buf[64];                                                   
        \
@@ -1389,348 +1383,6 @@ mvc_export_row(backend *b, stream *s, re
        return (ok) ? 0 : -1;
 }
 
-static int type_supports_binary_transfer(sql_type *type) {
-       return
-               type->eclass == EC_BIT ||
-               type->eclass == EC_POS ||
-               type->eclass == EC_CHAR ||
-               type->eclass == EC_STRING ||
-               type->eclass == EC_DEC ||
-               type->eclass == EC_BLOB ||
-               type->eclass == EC_FLT ||
-               type->eclass == EC_NUM ||
-               type->eclass == EC_DATE ||
-               type->eclass == EC_TIME ||
-               type->eclass == EC_TIME_TZ ||
-               type->eclass == EC_SEC ||
-               type->eclass == EC_MONTH ||
-               type->eclass == EC_TIMESTAMP ||
-               type->eclass == EC_TIMESTAMP_TZ;
-}
-
-static int write_str_term(stream* s, const char* const val) {
-       return mnstr_writeStr(s, val) && mnstr_writeBte(s, 0);
-}
-
-// align to 8 bytes
-static char*
-eight_byte_align(char* ptr) {
-       return (char*) (((size_t) ptr + 7) & ~7);
-}
-
-static int
-mvc_export_table_prot10(backend *b, stream *s, res_table *t, BAT *order, BUN 
offset, BUN nr) {
-       lng count = 0;
-       size_t row = 0;
-       size_t srow = 0;
-       size_t varsized = 0;
-       size_t length_prefixed = 0;
-       lng fixed_lengths = 0;
-       int fres = 0;
-       size_t i = 0;
-       size_t bsize = b->client->blocksize;
-       BATiter *iterators = NULL;
-       char *result = NULL;
-       size_t length = 0;
-       int initial_transfer = 1;
-
-       (void) order; // FIXME: respect explicitly ordered output
-
-       iterators = GDKzalloc(sizeof(BATiter) * t->nr_cols);
-       if (!iterators) {
-               return -1;
-       }
-
-       // ensure the buffer is currently empty
-       assert(bs2_buffer(s).pos == 0);
-
-       // inspect all the columns to figure out how many bytes it takes to 
transfer one row
-       for (i = 0; i < (size_t) t->nr_cols; i++) {
-               res_col *c = t->cols + i;
-               BAT *b = BATdescriptor(c->b);
-               int mtype;
-               size_t typelen;
-               int convert_to_string = 
!type_supports_binary_transfer(c->type.type);
-               sql_type *type = c->type.type;
-
-               if (b == NULL) {
-                       while (i > 0) {
-                               i--;
-                               BBPunfix(iterators[i].b->batCacheid);
-                       }
-                       GDKfree(iterators);
-                       return -1;
-               }
-               mtype = b->ttype;
-               typelen = ATOMsize(mtype);
-               iterators[i] = bat_iterator(b);
-
-               if (type->eclass == EC_TIMESTAMP || type->eclass == 
EC_TIMESTAMP_TZ || type->eclass == EC_DATE) {
-                       // dates and timestamps are converted to Unix Timestamps
-                       mtype = TYPE_lng;
-                       typelen = sizeof(lng);
-               }
-               if (ATOMvarsized(mtype) || convert_to_string) {
-                       varsized++;
-                       length_prefixed++;
-               } else {
-                       fixed_lengths += typelen;
-               }
-       }
-
-       // now perform the actual transfer
-       row = srow = offset;
-       count = offset + nr;
-       while (row < (size_t) count) {
-               char* message_header;
-               char *buf = bs2_buffer(s).buf;
-               size_t crow = 0;
-               size_t bytes_left = bsize - sizeof(lng) - 2 * sizeof(char) - 1;
-               // potential padding that has to be added for each column
-               bytes_left -= t->nr_cols * 7;
-
-               // every varsized member has an 8-byte header indicating the 
length of the header in the block
-               // subtract this from the amount of bytes left
-               bytes_left -= length_prefixed * sizeof(lng);
-
-               if (varsized == 0) {
-                       // no varsized elements, so we can immediately compute 
the amount of elements
-                       if (fixed_lengths == 0) {
-                               row = (size_t) count;
-                       } else {
-                               row = (size_t) (srow + bytes_left / 
fixed_lengths);
-                               row = row > (size_t) count ? (size_t) count : 
row;
-                       }
-               } else {
-                       size_t rowsize = 0;
-                       // we have varsized elements, so we have to loop to 
determine how many rows fit into a buffer
-                       while (row < (size_t) count) {
-                               rowsize = (size_t) fixed_lengths;
-                               for (i = 0; i < (size_t) t->nr_cols; i++) {
-                                       res_col *c = t->cols + i;
-                                       int mtype = iterators[i].b->ttype;
-                                       int convert_to_string = 
!type_supports_binary_transfer(c->type.type);
-                                       if (convert_to_string || 
ATOMvarsized(mtype)) {
-                                               if (c->type.type->eclass == 
EC_BLOB) {
-                                                       blob *b = (blob*) 
BUNtvar(iterators[i], row);
-                                                       rowsize += sizeof(lng) 
+ ((b->nitems == ~(size_t) 0) ? 0 : b->nitems);
-                                               } else {
-                                                       ssize_t slen = 0;
-                                                       if (convert_to_string) {
-                                                               void *element = 
(void*) BUNtail(iterators[i], crow);
-                                                               if ((slen = 
BATatoms[mtype].atomToStr(&result, &length, element, false)) < 0) {
-                                                                       fres = 
-1;
-                                                                       goto 
cleanup;
-                                                               }
-                                                       } else {
-                                                               slen = 
(ssize_t) strlen((const char*) BUNtvar(iterators[i], row));
-                                                       }
-                                                       rowsize += slen + 1;
-                                               }
-                                       }
-                               }
-                               if (bytes_left < rowsize) {
-                                       break;
-                               }
-                               bytes_left -= rowsize;
-                               row++;
-                       }
-                       if (row == srow) {
-                               lng new_size = rowsize + 1024;
-                               if (!mnstr_writeLng(s, (lng) -1) ||
-                                       !mnstr_writeLng(s, new_size) ||
-                                       mnstr_flush(s, MNSTR_FLUSH_DATA) < 0) {
-                                       fres = -1;
-                                       goto cleanup;
-                               }
-                               row = srow + 1;
-                               if (bs2_resizebuf(s, (size_t) new_size) < 0) {
-                                       // failed to resize stream buffer
-                                       fres = -1;
-                                       goto cleanup;
-                               }
-                               buf = bs2_buffer(s).buf;
-                               bsize = (size_t) new_size;
-                       }
-               }
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to