()
| 726 | } |
| 727 | |
| 728 | func (mctx *MigrationContext) IsThrottled() (bool, string, ThrottleReasonHint) { |
| 729 | mctx.throttleMutex.Lock() |
| 730 | defer mctx.throttleMutex.Unlock() |
| 731 | |
| 732 | // we don't throttle when cutting over. We _do_ throttle: |
| 733 | // - during copy phase |
| 734 | // - just before cut-over |
| 735 | // - in between cut-over retries |
| 736 | // When cutting over, we need to be aggressive. Cut-over holds table locks. |
| 737 | // We need to release those asap. |
| 738 | if atomic.LoadInt64(&mctx.InCutOverCriticalSectionFlag) > 0 { |
| 739 | return false, "critical section", NoThrottleReasonHint |
| 740 | } |
| 741 | return mctx.isThrottled, mctx.throttleReason, mctx.throttleReasonHint |
| 742 | } |
| 743 | |
| 744 | func (mctx *MigrationContext) GetThrottleQuery() string { |
| 745 | mctx.throttleMutex.Lock() |
no outgoing calls
no test coverage detected