Mastering Atomic Counters in Distributed Databases