Skip to content

Commit

Permalink
In mongotcl_appendBsonFromObject, after a type conversion error repor…
Browse files Browse the repository at this point in the history
…t the name of the field associated with the error. Update the README part about memory leaks to reflect our successful insertion of lots of rows without client-side memory footprint growth.

BUGZID:
  • Loading branch information
lehenbauer committed Feb 26, 2014
1 parent 68931cc commit e385e96
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -500,3 +500,6 @@ The code is currently early beta quality so there could be quite a few bugs incl

There are almost for sure some memory leaks so until those are all tracked down expect long-running jobs' memory footprint to grow and plan accordingly.

Update: We have now inserted hundreds of millions of rows without appreciable client memory footprint growth, so that process seems pretty solid.


15 changes: 11 additions & 4 deletions generic/bson.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,12 @@ mongotcl_appendBsonFromObject(Tcl_Interp *interp, bson *bs, bson_type bsonType,
int num;

if (Tcl_GetIntFromObj (interp, valueObj, &num) == TCL_ERROR) {

conversion_error:
Tcl_AddErrorInfo(interp, " while processing field '");
Tcl_AddErrorInfo(interp, key);
Tcl_AddErrorInfo(interp, "'");

return TCL_ERROR;
}

Expand All @@ -501,7 +507,7 @@ mongotcl_appendBsonFromObject(Tcl_Interp *interp, bson *bs, bson_type bsonType,
long num;

if (Tcl_GetLongFromObj (interp, valueObj, &num) == TCL_ERROR) {
return TCL_ERROR;
goto conversion_error;
}

if (bson_append_long (bs, key, num) != BSON_OK) {
Expand All @@ -514,7 +520,7 @@ mongotcl_appendBsonFromObject(Tcl_Interp *interp, bson *bs, bson_type bsonType,
double num;

if (Tcl_GetDoubleFromObj (interp, valueObj, &num) == TCL_ERROR) {
return TCL_ERROR;
goto conversion_error;
}

if (bson_append_double (bs, key, num) != BSON_OK) {
Expand All @@ -527,7 +533,7 @@ mongotcl_appendBsonFromObject(Tcl_Interp *interp, bson *bs, bson_type bsonType,
int bool;

if (Tcl_GetBooleanFromObj (interp, valueObj, &bool) == TCL_ERROR) {
return TCL_ERROR;
goto conversion_error;
}

if (bson_append_bool (bs, key, bool) != BSON_OK) {
Expand All @@ -538,8 +544,9 @@ mongotcl_appendBsonFromObject(Tcl_Interp *interp, bson *bs, bson_type bsonType,

case BSON_DATE: {
long clock;

if (Tcl_GetLongFromObj (interp, valueObj, &clock) == TCL_ERROR) {
return TCL_ERROR;
goto conversion_error;
}

if (bson_append_time_t (bs, key, (time_t)clock) != BSON_OK) {
Expand Down

0 comments on commit e385e96

Please sign in to comment.