[Monetdb-developers] [Monetdb-pf-checkins] pathfinder/modules/pftijah serialize_pftijah.mx, Feb2009, 1.68.2.1, 1.68.2.2

Stefan Manegold Stefan.Manegold at cwi.nl
Mon Mar 30 18:37:33 CEST 2009


On Mon, Mar 30, 2009 at 04:04:10PM +0000, Wouter Alink wrote:
> Update of /cvsroot/monetdb/pathfinder/modules/pftijah
> In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv16148
> 
> Modified Files:
>       Tag: Feb2009
> 	serialize_pftijah.mx 
> Log Message:
> -- step 1 in crossing trhe oid32 boundary with PF/TIJAH: remove some casts to int.
> This commit will (partially) fix bug "2722117 PF/TIJAH: dbat_finalize fails".

Cetero senseo: never (down-)cast unless it is strictly required and you have
strictly ensured/asserted that the actual value of the (larger) source type
at all times fits into the range of the (smaller) target type.

In fact, I made the experiences that avoiding casts as far as possible
(e.g.) by consistently using the "proper" types, keeps the code much
cleaner, more maintainable and less error prone, giving the compilers a
chance to warn us about potential over/underflows in case we accidently
assign/use non-matching types ...

;-)

Stefan

ps: Just sharing my experiences and lessons I learned, no "blame" at all! ;-)

> The fix was suggested by Henning/JanF, and seems to at least partially fix the indexing of a 30GB XML document. A new bug "2722117 PF/TIJAH: dbat_finalize fails" has been filed with the next issue. Bug "2722117" can be closed. No test can be created as the data is simply too large.
> 
> 
> 
> U serialize_pftijah.mx
> Index: serialize_pftijah.mx
> ===================================================================
> RCS file: /cvsroot/monetdb/pathfinder/modules/pftijah/serialize_pftijah.mx,v
> retrieving revision 1.68.2.1
> retrieving revision 1.68.2.2
> diff -u -d -r1.68.2.1 -r1.68.2.2
> --- serialize_pftijah.mx	25 Mar 2009 13:17:56 -0000	1.68.2.1
> +++ serialize_pftijah.mx	30 Mar 2009 16:04:08 -0000	1.68.2.2
> @@ -982,7 +982,7 @@
>      --tjctx->doc_height;
>      oid start = tj_popTag(tjctx); /* oid of the first node of the element */
>      int size  = tjctx->tijahPre - start - 1; /* the Tijah document size */
> -    dbat_set_int(&tjctx->dbat_collSize,(int)start,size);
> +    dbat_set_int(&tjctx->dbat_collSize,start,size);
>  #else
>      (void) ctx;
>  #endif
> @@ -1136,7 +1136,7 @@
>      if ( DOEMIT(tjctx) ) {
>          oid start = tj_popTag(tjctx); /* oid of the first node of the element */
>          int size  = tjctx->tijahPre - start - 1; /* the Tijah element size */
> -        dbat_set_int(&tjctx->dbat_collSize,(int)start,size);
> +        dbat_set_int(&tjctx->dbat_collSize,start,size);
>      };
>  #ifdef TJ_TRACE
>      if ( TJ_TRACE ) stream_printf(GDKout,"C[%s]:empty_endElement: \"%s\"\n", tjctx->name,"");
> @@ -1167,7 +1167,7 @@
>      if ( DOEMIT(tjctx) ) {
>          oid start = tj_popTag(tjctx); /* oid of the first node of the element */
>          int size  = tjctx->tijahPre - start - 1; /* the Tijah element size */
> -	dbat_set_int(&tjctx->dbat_collSize,(int)start,size);
> +	dbat_set_int(&tjctx->dbat_collSize,start,size);
>  #ifdef TJ_TRACE
>          if ( TJ_TRACE ) stream_printf(GDKout,"C[%s]:endElement: \"%s\"\n", tjctx->name,name);
>  #endif
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Monetdb-pf-checkins mailing list
> Monetdb-pf-checkins at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins
> 
> 

-- 
| Dr. Stefan Manegold | mailto:Stefan.Manegold at cwi.nl |
| CWI,  P.O.Box 94079 | http://www.cwi.nl/~manegold/  |
| 1090 GB Amsterdam   | Tel.: +31 (20) 592-4212       |
| The Netherlands     | Fax : +31 (20) 592-4312       |




More information about the developers-list mailing list