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

Create shadow and audit with auatovacuum default #97

Merged
merged 1 commit into from
Jul 4, 2023
Merged

Conversation

shayonj
Copy link
Owner

@shayonj shayonj commented Jul 2, 2023

Calling an ALTER with a transaction open during serializable while we copy data onto the audit table could potentially lead to lock queues. This avoids doing so by removing the disable_vaccum function and taking advantage of WITH directive when setting up the shadow and audit table in the first place. Thus avoiding the need to perform an ALTER on audit table or shadow table and avoid locking.

After some good findings from #94
h/t @yash-toddleapp

@@ -81,7 +81,6 @@ def run(connection, query, reuse_trasaction = false, &block)
connection.block
logger.info("Exception raised, rolling back query", { rollback: true, query: query })
connection.async_exec("ROLLBACK;")
connection.async_exec("COMMIT;")
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

COMMIT isn't needed if a query is being rolled back. Just cleaning up.

Calling an `ALTER` with a transaction open during serializable while we copy data onto the audit
table could potentially lead to lock queues. This avoids doing so by removing the `disable_vaccum`
function and taking advantage of `WITH` directive when setting up the shadow and audit table in the
first place. Thus avoiding the need to perform an `ALTER` on audit table or shadow table and avoid locking.
Copy link
Collaborator

@jfrost jfrost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smart!

@shayonj shayonj merged commit b70ff3d into main Jul 4, 2023
@shayonj shayonj deleted the s/disable branch July 4, 2023 02:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants