Skip to content
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

Adding Delayed Durability #1310

Merged
merged 2 commits into from
May 1, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3333,14 +3333,33 @@ final byte[] getTransactionDescriptor() {

@Override
public void commit() throws SQLServerException {
commit(false);
}

/**
* Makes all changes made since the previous
* commit/rollback permanent and releases any database locks
* currently held by this <code>Connection</code> object.
* This method should be
* used only when auto-commit mode has been disabled.
*
* @param delayedDurability flag to indicate whether the commit will occur with delayed durability on.
* @throws SQLServerException Exception if a database access error occurs,
*/
public void commit(boolean delayedDurability) throws SQLServerException {
loggerExternal.entering(loggingClassName, "commit");
if (loggerExternal.isLoggable(Level.FINER) && Util.isActivityTraceOn()) {
loggerExternal.finer(toString() + " ActivityId: " + ActivityCorrelator.getNext().toString());
}

checkClosed();
if (!databaseAutoCommitMode)
connectionCommand("IF @@TRANCOUNT > 0 COMMIT TRAN", "Connection.commit");
{
if (!delayedDurability)
connectionCommand("IF @@TRANCOUNT > 0 COMMIT TRAN", "Connection.commit");
else
connectionCommand("IF @@TRANCOUNT > 0 COMMIT TRAN WITH ( DELAYED_DURABILITY = ON )", "Connection.commit");
}
loggerExternal.exiting(loggingClassName, "commit");
}

Expand Down