Golang
Where do you specify recover in the application structure (main.go, repository, service, controller)?
Are you afraid of a time tracker? Why?
How actively are you looking for new tools and techniques for development, and what are you considering?
Why did you use the defer keyword?
What are the rules for working with interfaces in Go?
What is a nuance when working with sync.Pool related to persistence?
Have you had experience mentoring or training junior colleagues?
The test for uniform distribution is failing: backend[0] expected 5 calls, received 10; backend[1] expected 5 calls, received 0.
Why are transactions needed in databases?
When will an index not be used during query execution?
When are you ready to start working?
Have you always worked as outsourcing/outsourcing?
Are you familiar with partitioning and sharding? What is the difference?
/* We need to transfer data from a certain source to a consumer. The source provides data in small batches (~tens of records), while the consumer works more efficiently with larger batches (~thousands of records). A real-world example is transferring data from Kafka queues to a Clickhouse database. Source: - Conditionally infinite. - The source never returns more than MaxItems records per call to Next. - During a single "session" (one call to the Pipe function), the source returns new data on each Next call. - However, after a restart, the source resumes from the last "confirmed" position, set by a cookie. Therefore, *each* cookie value returned by Next, after data is saved in the receiver, must be fixed with a Commit call, strictly in the same order they were returned by Next. Receiver: - Cannot process more than MaxItems at once. The task is to implement the function func Pipe(p Producer, c Consumer) error which reads data from the source, groups it into a buffer of size not more than MaxItems, and saves it to the receiver, then commits the progress in the source. */ const MaxItems = 9999 // Producer interface // Next returns: // - batch of items to be processed // - cookie to be committed when processing is done // - error // Commit is used to mark data batch as processed // type Producer interface { Next() (items []any, cookie int, err error) Commit(cookie int) error } type Consumer interface { Process(items []any) error } func Pipe(p Producer, c Consumer) error { // TODO }
Was there a proxy before Redis, or did you shard it yourself?
In Go language, there are goroutines — lightweight threads. Can you tell when you should use a goroutine and when not?
Add pagination to the SELECT query from the books table (50 records per page).
Have you used CTE? Tell me what it is.
Can you describe a situation where using a Mutex is more appropriate than channels?
Given a function that takes two non-decreasing sorted sequences of integers, return all elements from the first sequence that are not in the second. How would you approach the solution and what is its complexity?