-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Distributed Table-Based Lock to support MySQL Database Cluster #9955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
f965118
9830bbe
ee33748
a08d205
5b8c24e
4eef494
b9e2846
c5733d3
3e39c50
b3c5bd4
61ffbcf
d15c672
4b0d0fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ | |
import javax.net.ssl.SSLContext; | ||
import javax.net.ssl.SSLEngine; | ||
|
||
import com.cloud.utils.db.GlobalLock; | ||
import org.apache.cloudstack.api.ApiErrorCode; | ||
import org.apache.cloudstack.api.ServerApiException; | ||
import org.apache.cloudstack.api.command.admin.ca.IssueCertificateCmd; | ||
|
@@ -295,6 +296,42 @@ | |
/////////////// CA Manager Setup /////////////////// | ||
//////////////////////////////////////////////////// | ||
|
||
public static final class DummyBGTask extends ManagedContextRunnable implements BackgroundPollTask { | ||
|
||
public DummyBGTask() { | ||
} | ||
|
||
@Override | ||
protected void runInContext() { | ||
final GlobalLock lock = GlobalLock.getInternLock("DummyBGTask"); | ||
try { | ||
logger.info("DummyBGTask: Trying to get lock at " + DateTime.now(DateTimeZone.UTC)); | ||
if (lock.lock(50)) { | ||
try { | ||
logger.info("DummyBGTask: Lock acquired, now sleeping for 5 seconds"); | ||
try { | ||
Thread.sleep(10 * 1000L); | ||
} catch (InterruptedException ignore) { | ||
} | ||
} finally { | ||
logger.info("DummyBGTask: Unlocking now"); | ||
lock.unlock(); | ||
} | ||
} else { | ||
logger.info("DummyBGTask: Could not get lock, retrying..."); | ||
} | ||
logger.info("DummyBGTask: One round of lock-grab over at " + DateTime.now(DateTimeZone.UTC)); | ||
} finally { | ||
lock.releaseRef(); | ||
} | ||
} | ||
|
||
@Override | ||
public Long getDelay() { | ||
return 5000L; | ||
} | ||
} | ||
|
||
public static final class CABackgroundTask extends ManagedContextRunnable implements BackgroundPollTask { | ||
private CAManager caManager; | ||
private HostDao hostDao; | ||
|
@@ -405,6 +442,7 @@ | |
|
||
@Override | ||
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException { | ||
backgroundPollManager.submitTask(new DummyBGTask()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rohityadavcloud There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, see the commit: d15c672 I wanted to create some code where operationally both devs & QA can see deadlocks etc via logs. |
||
backgroundPollManager.submitTask(new CABackgroundTask(this, hostDao)); | ||
return true; | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.