{"push_id":1197653823,"size":1,"distinct_size":1,"ref":"refs/heads/develop","head":"f258ae5ac12a0394c8c8559fe6aeefff06092266","before":"1c67c4e0f011f2a7f7ca582b4c2e6f6154ac3b20","commits":[{"sha":"f258ae5ac12a0394c8c8559fe6aeefff06092266","author":{"name":"Keith Bostic","email":"881fc09a1e3586540be71f631289f4f890f56cde@mongodb.com"},"message":"WT-2693 Check open_cursor error paths for consistent handling (#2859)\n\n* WT-2693 Check open_cursor error paths for consistent handling\r\n\r\nThere's a problem with cursor functions which don't call their typed\r\nclose functions, relying instead on a simple free of the base cursor\r\ntype because the __wt_cursor_init() function is the last function called\r\nbefore successful return. The problem is __wt_cursor_init() doesn't\r\nclean up after itself: for example, it allocates memory to hold the URI\r\nin WT_CURSOR.internal_uri, then has a number of subsequent potential\r\nerror returns, and WT_CURSOR.internal_uri won't be free'd unless\r\n__wt_cursor_close() is called. In other words, we should always call\r\nthe typed closed function (which in turn calls __wt_cursor_close()).\r\n\r\nSpecific additional concerns:\r\n\r\ncursor/cur_backup.c: __wt_curbackup_open() doesn't turn off backups or\r\nclear the hot-backup flag if __wt_cursor_init() fails, which will hang\r\nthe process. Remove the cleanup-on-error code from the __backup_start()\r\nfunction and rely instead on the backup cursor's close function to do\r\nthe work. There's a problem if we fail the initial backup cursor test,\r\nin which case we don't want to do cleanup other than discarding the\r\ncursors themselves. Add the WT_CURBACKUP_LOCKER flag to the\r\nWT_CURSOR_BACKUP structure, which isn't set until we're holding the hot\r\nbackup cursor flag, and use it to figure out how much cleanup needs to\r\nbe done.\r\n\r\ncursor/cur_file.c: the change to call the __curfile_close() function has\r\na problem with __wt_bulk_wrapup(), which assumes WT_CURSOR_BULK.reconcile\r\nhas been initialized, change it to check for NULL.\r\n\r\ncursor/cur_file.c: the change to call the __curfile_close() function has\r\na problem with incrementing the data-source's in-use counter. Instead\r\nof incrementing the counter in __wt_curfile_open() before calling\r\n__curfile_create(), increment it in __curfile_create() after the point\r\nwhere all failure paths close the cursor.\r\n\r\ncursor/cur_log.c: the change to call the __curlog_close() function means\r\nwe may be required to clean up a cursor that has not yet acquired the\r\nlog archive lock. Add the WT_CURLOG_ARCHIVE_LOCK flag to the WT_CURSOR_LOG\r\nstructure so the close function knows if the log archive lock needs to be\r\nreleased.\r\n\r\ncursor/cur_log.c: remove the __curlog_reset() call from __curlog_close(),\r\nwe're closing the cursor, resetting it doesn't do anything useful.\r\n\r\ncursor/cur_metadata.c: the change to call the __curmetadata_close()\r\nfunction is slightly tricky, be cautious about closing the underlying\r\nWT_CURSOR_METADATA.file_cursor field, it may not be set when we call\r\n__curmetadata_close().\r\n\r\n* comment typo\r\n\r\n* fix a comment\r\n\r\n* Add explicit comment on the life-cycle of the WT_CURBACKUP_LOCKER flag.\r\n\r\n* Review comment, set a specific size on the flags field. Generally, the\r\ncursors all use uint8_t for flags, and I don't think it matters much\r\nwhat we use, use the same thing everywhere.","distinct":true,"url":"https://api.github.com/repos/wiredtiger/wiredtiger/commits/f258ae5ac12a0394c8c8559fe6aeefff06092266"}]}
{"actor":{"display_login":"keithbostic"}}