AWS Certified Data Engineer Associate DEA-C01 Practice Question
An AWS Lambda function that runs every hour recalculates summary tables in an Amazon RDS for MySQL 8.0 database. Occasionally, two invocations overlap, resulting in duplicate updates and deadlocks. You need to guarantee that only one invocation performs the recalculation at any given time while ordinary read traffic to the tables continues uninterrupted. Which solution meets the requirement with the least code and configuration changes?
Call the MySQL functions GET_LOCK('recalc', timeout) at the start of the job and RELEASE_LOCK('recalc') when it finishes.
Enable Multi-AZ for the RDS instance so the standby blocks concurrent write attempts during the recalculation window.
Set the innodb_table_locks parameter to ON in the DB parameter group so InnoDB automatically applies a global table lock during the transaction.
Change the summary table to the MyISAM engine and issue LOCK TABLES WRITE before updates and UNLOCK TABLES afterward.
The built-in MySQL function GET_LOCK obtains a user-defined named lock that is held by the current session until it explicitly calls RELEASE_LOCK or the session ends. If another Lambda invocation tries to acquire the same named lock, it blocks (or times out) until the lock is free, preventing concurrent execution of the recalculation code. Because the lock is advisory and scoped only to sessions requesting it, other client sessions can continue to read from the tables without waiting. Simply adding GET_LOCK at the start of the job and RELEASE_LOCK at the end meets the requirement with minimal changes.
Enabling innodb_table_locks does not serialize application-level tasks; it only affects how metadata locks are recorded. Converting the table to MyISAM and issuing LOCK TABLES would block all reads during the job and requires an engine change that is not recommended for RDS MySQL 8.0. Multi-AZ deployment improves availability but does nothing to prevent concurrent Lambda invocations from running against the primary instance.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
How does the GET_LOCK() function work in MySQL?
Open an interactive chat with Bash
Why is using GET_LOCK() better than enabling innodb_table_locks or changing the table engine to MyISAM?
Open an interactive chat with Bash
What happens if the Lambda function times out while holding the GET_LOCK()?
Open an interactive chat with Bash
What is the purpose of the GET_LOCK and RELEASE_LOCK functions in MySQL?
Open an interactive chat with Bash
Why is innodb_table_locks not sufficient for this use case?
Open an interactive chat with Bash
What are the drawbacks of using MyISAM with LOCK TABLES for this problem?
Open an interactive chat with Bash
AWS Certified Data Engineer Associate DEA-C01
Data Store Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .