Created
March 19, 2014 18:24
-
-
Save dallasmarlow/9648034 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# invalid re-assignment strategy as the table's `AUTO_INCREMENT` isn't updated which will cause new inserts to fail | |
def invalidate_block id | |
[ | |
'set autocommit = 0', | |
'lock tables blacklist write', | |
'update blacklist set valid = 0, invalidated_at = now(), id = ((select max(blacklist.id)) + 1) where id =' + id.to_s, | |
'commit', | |
'unlock tables', | |
'set autocommit = 1', | |
].each do |statement| | |
db.run statement | |
end | |
rescue Exception => message | |
log.error ['unable to invalidate block with id: ' + id.to_s, message].join("\n") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment