[BUG] The function in aws-node-express-dynamodb-api is not idempotent
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- aws, javascript
Direzione di ricerca
Inizia da aws-node-express-dynamodb-api/index.js e analizza la chiamata put di DynamoDB nella funzione che scrive il nome utente. Leggi la documentazione collegata sui retry di Lambda e sulle transazioni DynamoDB, quindi verifica il comportamento con aggiornamenti e retry concorrenti. Il lavoro è completato quando una scrittura ritentata viene riconosciuta come la stessa richiesta e non modifica ripetutamente il nome utente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The function of writing username in index.js under aws-node-express-dynamodb-api is not idempotent and may cause data inconsistency.
try {
await dynamoDbClient.put(params).promise();
res.json({ userId, name });
}
Assuming two concurrent functions want to change the user name with the same userId. When one of them fails after executing dynamodb_client.put, AWS Lambda will retry it and change the user name again. Then the client will see the username is changed between two different names repeatedly even if there are only two functions changing the name. This should not happen if every function is executed only once and causes data inconsistency.
This can be fixed by making the function idempotent. DynamoDB has provided an idempotent write operation called TransactWriteItems. Replacing dynamodb_client.put with it can fix the idempotence bug. Users need to provide a unique client token to be the parameter of TransactWriteItems API. which helps DynamoDB to determine whether the incoming write is a retry.
- Lingua principale
- JavaScript
- Stelle
- 11.5k
- Fork
- 4.4k
- Merge medio
- 2h 55m
- PR unite (30g)
- 3
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di serverless/examples
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
serverless/examples#404 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
serverless/examples#809 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 30/100
serverless/examples#793 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
serverless/examples#784 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
serverless/examples#782 ·
Tutte le issue di serverless/examples
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
mksglu/context-mode#1200 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
neondatabase/website#5944 ·
-
module: core
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
bigbluebutton/bigbluebutton#25849 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
jaegertracing/jaeger-ui#4506 ·