Mastercard has used an array of database technologies, including Oracle, MySQL, Microsoft SQL Server, Cassandra, Hadoop, DB2 and PostgreSQL, for years. In my role as Lead BizOps Engineer, I support the payment gateway, which Mastercard acquired in 2014. With it came PostgreSQL, a pleasant coincidence for the company.
Already actively using PostgreSQL helped to quickly enhance Mastercard’s disaster recovery strategy. At that time, PostgreSQL binary streaming replication was the major tool behind it. While this worked well, there was always the question of, “How can we make this better?”
How to Claim Zero Downtime
Mastercard was facing two big problems: the amount of time it was taking to switch processing to the disaster recovery site, and the method to perform maintenance tasks on servers—such as vacuum full, reindex, etc. 99.999% uptime was a minimum company requirement, so these issues were not acceptable.
With PostgreSQL 9.4 came logical replication, and with logical replication came multi master replication. That is when Mastercard chose to evaluate and then implement xDB MMR replication, the offering from EDB.
PostgreSQL: An Economic Necessity
Once xDB MMR was established, the benefits were very quickly realized. In particular, switching to the DR site got not just quicker, but got reliably quicker.
But, xDB MMR delivered more than just an improved DR solution. It also delivered a data migration tool that proved invaluable when Mastercard had to ship data between continents to remain compliant with the ever changing regulations and mandates concerning where personally identifiable data can be stored.
One of the big advantages of logical replication over binary streaming replication is its ability to filter data. Another is that the target PostgreSQL server can be configured with functions and triggers to further manipulate the data as it is written to the target database tables.
Mastercard found that very useful when using xDB to migrate subsets of data across continents to remain compliant with the changing mandates of governing bodies.
The xDB filtering prevented data from leaving the source continent that was domiciled there. In addition, PostgreSQL triggers allowed additional business logic to be applied seamlessly to the data as it was written to the target server. xDB was used as a real-time data migration tool and that data migration strategy was very successful.
"Postgres Just Works."
Looking forward, Mastercard will be exploiting the ability to perform concurrent processing of payments at multiple data centers with xDB MMR, keeping the sites in sync. Some minor app changes will be required and a lot of testing particularly around the area of data conflicts will be necessary.
These updates and fixes really proved that migrating to PostgreSQL was an economic necessity. Mastercard needed to reduce failover time, with so many credit card transactions per second occurring. With PostgreSQL, we were able to truly offer "zero downtime." It just works!
Mastercard is excited to be speaking at EDB's virtual conference next week, Postgres Vision 2020! Registration is free; join us!
Gordon Platt is a Lead BizOps Engineer at Mastercard.