From: Scott Cantor Date: Wed, 8 Jul 2015 23:16:52 +0000 (+0000) Subject: SSPCPP-656 - NameID insert logic appears wrong for ODBC Session store X-Git-Tag: 2.5.5~8 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fcpp-sp.git;a=commitdiff_plain;h=4d62ccd06801a5261b1b84e6758bfef641db1e33 SSPCPP-656 - NameID insert logic appears wrong for ODBC Session store https://issues.shibboleth.net/jira/browse/SSPCPP-656 Interject an expired record reap when a duplicate insert occurs. --- diff --git a/odbc-store/odbc-store.cpp b/odbc-store/odbc-store.cpp index f751271..9fea872 100644 --- a/odbc-store/odbc-store.cpp +++ b/odbc-store/odbc-store.cpp @@ -513,8 +513,15 @@ bool ODBCStorageService::createRow(const char* table, const char* context, const } m_log.error("insert record failed (t=%s, c=%s, k=%s)", table, context, key); logres = log_error(stmt, SQL_HANDLE_STMT, "23000"); - if (logres.second) - return false; // supposedly integrity violation? + if (logres.second) { + // Supposedly integrity violation. + // Try and delete any expired record still hanging around until the final attempt. + if (attempts > 0) { + reap(table, context); + continue; + } + return false; + } } while (attempts && logres.first); throw IOException("ODBC StorageService failed to insert record.");