Another Step Forward

This week my task involved working with databases. I am going to summarise here a few important points.

A transaction is a group of operations that are performed as a single unit of work.

While working with transactions, we should follow a few rules that will help us in accessing and working with database safely i.e maintain consistency in database.

ACID Properties

Atomicity-This means that either the complete transaction will get commited or none of it will get committed i.e ‘all or nothing’. If there is any failure in the middle of a transaction all the changes are rolled back.

Consistency- This property means that the database should be in a consistent state before and after a transaction.

Isolation- This property ensures that multiple transactions can occur consurrently without interfering. The changes done by transaction T1 will be visible in transaction T2 only after it is commited.

Durability- This rule ensures that all the updates done by the transaction should persist even if there is a system failure.

try {
$db->query("execute query 1");
$db->query("execute query 2");
//if there are no exceptions
} catch( Exception $e) {
// if there is any exception, transaction
// is rolled back.

MySQL does not support nested transactions. Since wikimedia-slimapp already uses transactions internally, we had to implement our own transaction methods. My mentor suggested two possible approaches of this problem. One approach is to use counting semaphores. The other is to use SAVEPOINT feature of MySQL innoDB.

Another important thing that I have learned is the importance of clear communication. While working remote, communication plays an important role. It matters to me a lot since I aspire to become a mentor too. So, I have decided to follow these rules-

  1. Do not assume anything about the problem

2. Provide as much details as possible for any solution

3. Include references if any

In the coming weeks, I hope to increase my productivity and communicate more clearly.

Like what you read? Give Neha Jha a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.