Status WiredTigerUtil::setTableLogging(OperationContext* opCtx, const std::string& uri, bool on) { // Try to close as much as possible to avoid EBUSY errors. WiredTigerRecoveryUnit::get(opCtx)->getSession()->closeAllCursors(uri); WiredTigerSessionCache* sessionCache = WiredTigerRecoveryUnit::get(opCtx)->getSessionCache(); sessionCache->closeAllCursors(uri); // Use a dedicated session for alter operations to avoid transaction issues. WiredTigerSession session(sessionCache->conn()); return setTableLogging(session.getSession(), uri, on); }
int WiredTigerUtil::verifyTable(OperationContext* opCtx, const std::string& uri, std::vector<std::string>* errors) { ErrorAccumulator eventHandler(errors); // Try to close as much as possible to avoid EBUSY errors. WiredTigerRecoveryUnit::get(opCtx)->getSession()->closeAllCursors(uri); WiredTigerSessionCache* sessionCache = WiredTigerRecoveryUnit::get(opCtx)->getSessionCache(); sessionCache->closeAllCursors(uri); // Open a new session with custom error handlers. WT_CONNECTION* conn = WiredTigerRecoveryUnit::get(opCtx)->getSessionCache()->conn(); WT_SESSION* session; invariantWTOK(conn->open_session(conn, &eventHandler, NULL, &session)); ON_BLOCK_EXIT([&] { session->close(session, ""); }); // Do the verify. Weird parens prevent treating "verify" as a macro. return (session->verify)(session, uri.c_str(), NULL); }