Tell me about replication in PostgreSQL: master-slave, what happens when a replica fails?
Kotlin
Tell me about database sharding.
// book(seat_id, user_id) PostgreSQL Begin Transaction(read_commited) seat = select * from seats where id = seat_id for update if(seat == null seat.status == "booked") rollback return error("Seat isnt available") insert into bookings (user_id, seat_id, status, created_at) values (used_id, ...) update seats set status = 'booked' where id = seat_id commit return success()
Do you know what Service Mesh is in Kubernetes?
Why is the closing bracket the key in the Map, and the opening bracket the value? What will change if you do the opposite? What is the complexity of containsValue vs get by key?
Tell me about transaction isolation levels
How does the Dirty Checking mechanism work in Hibernate?
Have Kafka transactions (exactly-once semantics) been used?
How to control load on handles (rate limiting)?
What does VACUUM do in PostgreSQL and why do dead tuples appear?
Why can the Postgres query optimizer use Seq Scan in production but Index Scan in dev/ft with the same indexes?
Tell about partitioning in PostgreSQL.
/*Given a string, implement a function to check the correctness of bracket notation. Each opening bracket must have a corresponding closing bracket. Opening and closing brackets must be in the correct order. Types of brackets: "{", "}", "(", ")", "[", "]". Input: "([]){}[(()())()]" Result: true Input: "[(])" Result: false Because brackets 2 and 3 are incorrect, the closing ']' appears before the closing '('.*/ public boolean check(String s){ Deque<Character> stack = new ArrayDeque<>(); Map<Character, Character> map = Map.of( ')', '(', ']', '[', '}', '{' ); // ((( for( char c : s.toCharArray()){ if(map.containsValue(c)){ stack.push(c); } else if(map.containsKey(c)){ if( stack.isEmpty() || stack.pop() != map.get(c)){ return false; } } } return stack.isEmpty(); }
Tell about optimistic and pessimistic locking, when to apply them?
/* SELECT left.K, left.V1, right.V2 FROM left JOIN right ON left.K = right.K; */ public <K extends Comparable<K>, V1, V2> List<Triple<K, V1, V2>> join(List<Pair<K, V1>> left, List<Pair<K, V2>> right) { return null; } private static class Pair<A, B> { private A first; private B second; Pair(A first, B second) { this.first = first; this.second = second; } } private static class Triple<A, B, C> { private A first; private B second; private C third; Triple(A first, B second, C third) { this.first = first; this.second = second; this.third = third; } }
Tell me about yourself and your work experience
Tell about monitoring and metrics in the project (Prometheus, Grafana)
How to solve the problem of concurrent updates of one entity from two Kafka topics (one topic overwrites changes from the other)?
What was the load on the services? What optimizations were applied?