Many faces of the “Consistency”

The word “consistency” is widely used in IT nowadays, especially regarding databases, but what does that really mean? Let’s find out!

Formal definition

In database systems, consistency refers to the requirement that any given database transaction must change affected data only in allowed ways.

Wikipedia (https://en.wikipedia.org/wiki/Consistency_(database_systems))

So basically this concept describes that if you have specific rules about your data (invariants), then every database transaction should preserve those rules – e.g. in a cinema ticket booking system, by creating every successful booking, the number of available tickets should be decremented, but can not drop below zero. Suppose a database transaction starts with valid data according to these rules (invariants) so any changes during the transaction should preserve the validity. Seems to be straightforward, right? Nevertheless, there are a few super confusing, but extremely important acronyms that contain “C” (as consistency) but have very little in common with the formal statement above.

A C I D

The first, but probably the biggest (and oldest) acronym is ACID, which refers to properties of database transactions:

  • A – Atomicity
  • C – Consistency
  • I – Isolation
  • D – Durability

I would rather change that to realistic AI (atomic and isolation), but let’s keep the Durability concept for the next post and focus on C (consistency) here.

So due to Wiki –

Consistency in ACID transactions ensures that a transaction can only bring the database from one consistent state to another, preserving database invariants

The problem with that statement lies in the fact, that the idea of consistency is mostly related to application business logic. That’s the application code’s responsibility to correctly construct the database transaction to preserve invariants. Basically, the database is unable to guarantee consistency (yes, there are some very simple database constraint checks like uniqueness), so if you write bad data (e.g. create a cinema booking but will not reduce the number of available seats), the database will not hold you back! That is up to the application what data is valid, and what is not. So the “C” letter should not belong to the “ACID” acronym.

CL A P

Another example of a misleading acronym is CAP, which refers to a theorem about guarantees in distributed data stores:

  • C – Consistency
  • A – Availability
  • P – Partition tolerance

Yet another example of too many letters in the acronym, as in fact, the network partition is a part of the problem, that will happen without your allowance whether you like it or not. So it rather should be something like “Choose Consistency or Availability in case of Partition”.

So due to Wiki –

Consistency in CAP theorem means that every read receives the most recent write or an error.

That description directly references the concept of Linearizability.

The strict definition of linearizability is quite fuzzy, but the basic idea is that as soon as one client successfully completes a write operation, all clients reading from the database should be able to see the value just written as it was only a single register (even if reality there are multiple replicas/nodes/partitions).

Example of a non-linearizable system

So after John has booked the last seat for the “Men in Black” movie, both Jane and Mike tried to check availability, but both of them saw different results, due to async replication and network delay during the master db change population.

Example of a linearizable system behavior

In the example above, as there is a point in time when Mike’s delete change became visible to John’s read operation, after that all readers should see the same version as John.

Other consistency examples

The word consistency is terribly overloaded across the whole broad IT domains, apart from the example above, you also can find that word in such areas:

Final thoughts

That article was an attempt to underline the problem of people using just the word “consistency” without a clear statement about what exactly they mean, which actually introduces inconsistency into the discussion πŸ™‚

If you are interested to know more about described above, and other faces of consistency, I highly recommend you the book “Designing Data-Intensive Applications” by Martin Kleppmann.

2022 Recap. 2023 Plan.

`Year recap has already become a good tradition for me (check 2020 and 2021 recap posts). This habit allows for summarising the last 365 days and creating a solid plan for next year. Additionally, last year a received a few quite complementary feedbacks (undeserved but very appreciated ☺️) from people who said my recap/plans posts helped them to create their own to-do list.

Well, before I go into details about progress and plans, it is worth underlining, that my whole blueprint for the current year was deprioritized on Feb 24, when russia started its terroristic and occupational war against my homeland – Ukraine (you can read more about that in one of my recent posts). I would never forget that day and how it changed my world perception. Since then, the main priorities are to ensure my family in Ukraine has everything it needs to endure this tough time and provide Ukrainian defenders as much aid as I can to increase their safety and ability to protect my homeland against russian occupational army. If you would like to join me in this crucial aim, you could find a list of the biggest Ukrainian Fundations for different purposes here – saveukraine.org. Every penny matters!

2022’s plans progress

Health

  • Do 48 gym sessions (~1 per week)πŸ‹οΈβ€β™‚οΈ – 100%due to Strava, I’ve done about 16 workouts + 32 swims.
  • Run at least 100 runs with a minimum of 600km distance and take part in a race πŸƒβ€β™‚οΈ – 100%due to Strava, I’ve done 100 runs with a total distance of 645 km + 3 races.

Professional & Personal Development

  • Receive AWS Certified Solutions Architect certificate πŸ”– – 100% (cert link)
  • Receive a Professional Scrum Product Owner certificate πŸ”– – 0% – I rescheduled that 10+ times since January, but just a few days ago, it became so clear to me, that if you postpone something so many times, then maybe it is not a really what you want to achieve.
  • Solve 48 HackerRank problems (~ 1 per week) πŸ‘¨β€πŸ’» – 100% (in fact more than 100%, as some of the problems have been solved multiple times in different ways)
  • Learn at least 1 new programming language or fundamental framework πŸ’» – 0% – I improved by Java a bit, but that improvement is far from my minimum “learn” threshold.
  • Have at least 100 β€œactive days” in my GitHub account πŸ‘Ύ89% – at some point, I focused less on committing something “finished” to my Github account and more just creating tiny proof of concepts.

Leisure

  • Hike to Gerlach peak β›° – didn’t have a chance to do that this year, but hopefully the next year will be more conducive.
  • Do glider flight ✈️ 100% – that was one of the most positive and emotional moments in a whole year. I highly recommend that to everyone who likes a feeling of freedom and a tiny dose of adrenaline.
  • Visit 1 new country πŸ™100% (visited 1 new country I’ve never been to before –Greece)
  • Complete First Aid Course β›‘ – 100%this course has been finished at the beginning of February, and at that point, I didn’t know how handy those skills could be in a future reality.
  • Add a 1 new board game to the home collection 🎲100% – new game “Teotihuacan: City of Gods” added to my collection.

Miscellaneous

  1. Post at least 12 new posts in the blog (~ 1 per month) πŸ“„ – 16% – I added only 2 posts. Also, it became clear to me that adding a target of post amount per year does not work for me, as it just creates redundant pressure, which was not the essential idea of this blog.
  2. Donate at least 1.5 liters of blood (3 times) 🩸 – 133% – 1.8 liters of blood (4 times) have been donated in 2022.

Summarise:

  • 67% (10/15) – Fully completed targets
  • 6% (1/15) – Progressed well, but not completed
  • 27% (4/15) – Have not been started or progress is negligible

So, looks like last year’s baseline of 60% has been met, which is a good thing. What is even more strange, is that I’m really happy that I have not fulfilled 100% of my goals for this year, as otherwise, it would mean sacrificing flexibility over just marking something as done without recap if this goal is still relevant.

Nevertheless, my baseline for next year will remain at a level of 60%, I also would consider something as “done” if it has >= 80% completing progress.

β€œOut of targets achievements of 2022”

In addition to the planned achievements described above, there are a few things I’ve managed to do and am happy to share with you:

  1. In addition to regular foundation donations, with the priceless support of my friends, we’ve managed to raise funds, buy and send a few parcels to Ukrainian defenders on the frontline.

2. Finished 2 motorcycle courses: “Precision Motorcycle Riding L1” and “ADV Basic”. Both of them helped me as a newbie rider to create a bit less danger on public roads for myself and other people.

3. I’ve managed to pass the IELTS English exam for level 7.0 (C1), so hopefully, communication with me in English became a bit less painful this year 😁

Plans for 2023

I’m certain that next year will be challenging for me in a few different ways, but I’m also absolutely sure it will also bring a lot of happy moments and unforgettable memories. Life is always looking for balance and looking back at 2022, damn, next year has to be so freaking exceptionally good!

My list for next year contains a few fixed points, and a few new things:

Health

  1. Do 48 workout (or other non-running activity) sessions (~1 per week)πŸ‹οΈβ€β™‚οΈ
  2. Run at least 100 runs with a minimum of 600km distance and take part in at least 1 race πŸƒβ€β™‚οΈ

Professional & Personal Development

  1. Receive Microsoft Certified: Azure Developer Associate certificate as min and Microsoft Certified: Azure Solutions Architect Expert certificate as max πŸ”–
  2. Improve soft skills (completing a course or attending communication/leadership community meetups) πŸ—£οΈ
  3. Solve 48 LeetCode problems (~ 1 per week) πŸ‘¨β€πŸ’»
  4. Read at least 8 books πŸ“š
  5. Visit at least 1 tech conference or tech meetup πŸ’»
  6. Have at least 48 β€œactive days” in my GitHub account πŸ‘Ύ
  7. Invest 20% more money than in 2022 πŸ’°
  8. Meaningful work-related change (hard to set any specifics upfront, but definitely will be easy to identify as the success/fail in the 2023 retrospective) πŸ’Ό
  9. Create small regular fortnight tracking reports summarising progress and main events. πŸ“ˆ
  10. Improve my finance and investment awareness (read min 1 investment-related book) 🏦

Leisure

  1. Hike to Gerlach peak β›°
  2. Do at least 1 “adrenaline rush activity” 🀿
  3. Travel outside of Poland on a motorcycle adventure trip 🏍️
  4. Complete Winter Mountain Tourist course πŸ§—
  5. Add a 1 new board game to the home collection 🎲

Miscellaneous

  1. Make at least 12 contributions to nonprofit orgs (~ 1 per month) β€οΈβ€πŸ©Ή
  2. Donate at least 1.5 liters of blood (3 times) 🩸

Final thoughts

My last year’s “Final thoughts” section was dedicated to COVID and my hope to “get back to normality”. Today, a year later, the word “normality” means something completely different from what it used to mean. Nevertheless, I wish you all the best in the New Year, good physical and mental health, fulfillment of your own plans for next year, and a lot of smiles! P.S. Don’t forget to support each other, it is absolutely vital in a current tough and complex world!

Happy New 2023 Year!

P.P.S. A few highlight photos from 2022.

The day that changed everything

There were a few days during my conscious life which I remember and most probably never forget, most of them are similar to yours, like the 18th birthday party or the day when you met your love. Usually, the human brain tends to reinforce good memories and neglect those not-so-happy moments, but this year, February 24 has been started for me and approx 40 million other Ukrainians at 00:01 AM, and today, six months later, on August 24 it has not ended yet. This day started with a Russian attempt to invade the independent state of Ukraine.

The first few hours were so surrealistic, after I read the title of the news article “RUSSIA ATTACKED UKRAINE”, my first thought was that it was not possible, am I dreaming? What CAN and what SHOULD I do now? Almost immediately I called my family to ask if they are safe and 2 hours later my fiancee and myself were standing in a mall queue buying “everything which could be handy” and looking for a way to send it to Ukraine as quickly as we can. It was very chaotic, we didn’t know what to do, I guess no one knew at that time.

Few next days were almost sleepless and at some point, I was getting scared to read online news or listen to the radio in a car, because the situation was very unpredictable and russian occupants tried to land in Kyiv, every hour there was news about invaders attacks in big cities like Kharkiv, Chernihiv or Sumy. That internal anxiousness mixed with personal helplessness will stay for long years in my memory.

As time was passing two things became to be clear:

  1. Vladimir Putin’s plan is to completely destroy Ukraine as an independent state in a political, economical, military, and cultural sense.
  2. Ukraine will not surrender. With the support of close and distant friends – artists, politicians, athletes, and ordinary people over the world, Ukraine has been resisting unprovoked invasion.

This is true, that russia was preparing for this invasion for a long time, in a military sense, but what is more important – in a geopolitical sense, in a way, when many European economies became dependent on russian fossil fuel, which limited them to act more decisively. But now, everyone wants to get rid of and be distant from everything “russian”. Today, no one in Ukraine or the rest of the “west” (in a broad sense) world believe in the nonsense of russian propaganda about Neo-Nazism or defending russian language and minorities from infringement.

Every day Ukraine becomes stronger, because of the bravery of the Ukrainian Armed Forces, because of the unity of the people inside the country, because of new friends far beyond the Ukrainian borders, because of support of the world, because Good Conquers Evil.

Last, but definitely not least – unfortunately, it is impossible to mention in this post everyone who is helping Ukraine on its way to defending democracy and basic human rights. Nevertheless, I’m so grateful to the people in Poland, Lithuania, Latvia, Estonia, Czech Republic, Slovakia, Romania, Moldova, and all other countries which opened their doors and hearts to refugees from Ukraine. Also, I want to thank the governments of the United Kingdom, the United States, Canada, and even Australia, who despite of geographical distance between our countries, helps us to protect ourselves and “west” values, by providing financial and military aid. We will not forget any penny of donating, yellow-blue lighted skyscraper, dedicated song, or even support Twitter post. Thank you for that!

Happy Independence Day!

Glory To Ukraine, Slava Ukraini! πŸ‡ΊπŸ‡¦

P.S. Below you could find a few links if you would like to make donations to support Ukraine. Every penny matters! ❀️