| 100 | } |
| 101 | |
| 102 | void NBackupStateLock::blockingAstHandler(thread_db* tdbb) |
| 103 | { |
| 104 | // master instance should not try to acquire localStateLock or enter "flush" mode |
| 105 | if (backup_manager->isMaster()) |
| 106 | { |
| 107 | GlobalRWLock::blockingAstHandler(tdbb); |
| 108 | return; |
| 109 | } |
| 110 | |
| 111 | // Ensure we have no dirty pages in local cache before releasing |
| 112 | // of state lock |
| 113 | if (!backup_manager->databaseFlushInProgress()) |
| 114 | { |
| 115 | backup_manager->beginFlush(); |
| 116 | NBAK_TRACE_AST( ("backup_manager->beginFlush()") ); |
| 117 | |
| 118 | Firebird::MutexUnlockGuard counterGuard(counterMutex, FB_FUNCTION); |
| 119 | CCH_flush_ast(tdbb); |
| 120 | NBAK_TRACE_AST(("database FLUSHED")); |
| 121 | } |
| 122 | |
| 123 | { // scope |
| 124 | backup_manager->stateBlocking = true; |
| 125 | Firebird::MutexUnlockGuard counterGuard(counterMutex, FB_FUNCTION); |
| 126 | backup_manager->stateBlocking = !backup_manager->localStateLock.tryBeginWrite(FB_FUNCTION); |
| 127 | if (backup_manager->stateBlocking) |
| 128 | return; |
| 129 | } |
| 130 | |
| 131 | GlobalRWLock::blockingAstHandler(tdbb); |
| 132 | |
| 133 | if (cachedLock->lck_physical == LCK_read) |
| 134 | backup_manager->endFlush(); |
| 135 | |
| 136 | backup_manager->localStateLock.endWrite(); |
| 137 | } |
| 138 | |
| 139 | |
| 140 | /******************************** NBackupAllocLock ******************************/ |
nothing calls this directly
no test coverage detected