* Acquires a SessionState entry for the specified sessionid. If an existing entry * is found, this method reuses that entry */
| 76 | * is found, this method reuses that entry |
| 77 | */ |
| 78 | static SessionState * |
| 79 | AcquireSessionState(int sessionId, int vmem, int activeProcessCount) |
| 80 | { |
| 81 | will_be_called_count(LWLockAcquire, 1); |
| 82 | will_be_called_count(LWLockRelease, 1); |
| 83 | expect_any_count(LWLockAcquire, lock, 1); |
| 84 | expect_any_count(LWLockAcquire, mode, 1); |
| 85 | expect_any_count(LWLockRelease, lock, 1); |
| 86 | |
| 87 | /* Keep the assertions happy */ |
| 88 | gp_session_id = sessionId; |
| 89 | sessionStateInited = false; |
| 90 | MySessionState = NULL; |
| 91 | |
| 92 | EXPECT_EREPORT(gp_sessionstate_loglevel); |
| 93 | SessionState_Init(); |
| 94 | |
| 95 | if (vmem >= 0) |
| 96 | { |
| 97 | MySessionState->sessionVmem = vmem; |
| 98 | } |
| 99 | |
| 100 | if (activeProcessCount >= 0) |
| 101 | { |
| 102 | MySessionState->activeProcessCount = activeProcessCount; |
| 103 | } |
| 104 | |
| 105 | return (SessionState *) MySessionState; |
| 106 | } |
| 107 | /* |
| 108 | * Checks if RedZoneHandler_ShmemInit() properly initializes the global variables |
| 109 | * as the postmaster |
no test coverage detected