Apache Kafka Brokers Clusters
Brokers and Clusters Brokers are nothing but a Kafka service running node in a cluster. Brokers are can act as incharge of the cluster and make sure data is replicated across the cluster to provide resiliency to Kafka Cluster. Upon Kafka cluster created ( Kafka with multiple brokers ), a broker will be marked as controller node Controller is like a master node, responsible for all the client interactions, cluster administration.…
Read more ⟶
Apache Producers Consumers
Producers are clients usually applications which produces messages of several formats like activity tracking, events, log messages, transactions etc. Consumers are Applications read messages from topics. consumers track offset to know how many messages they read. data written to kafka is replicated in the disk for fault tolerance Acks: property for number of acknowledgement for producer to make sure message sent to cluster Key: producers specify a key, indicating that a message will go to the same partition every time Consumer Group To ensure multiple consumers aren’t reading the same message, consumer groups map reads to consumers.…
Read more ⟶
Apache Kafka Topic
Another name for a stream of messages is called Topics. Topics are like database tables. One topic for one specific type of messages. Topics are divided into partitions.
In Partition, each message stored receives an ID called offset. For a new partition, the offset would start from zero and never another message gets zero offset again in this partition in the future.
Every topic will have a key, and messages are written to specific topics using the key.…
Read more ⟶
Java Check for Null References
In Java we can check for null pointer references using below approaches. If you ask me why we have to do this, is to avoid NullPointerException.
Traditional way public static List<Integer> getPrices (List<Integer> allPrices) { if (allPrices == null) { return Collections.EMPTY_LIST; } } Use declarative approach Before directly jumping into this, I want to share the methods we have to check for null referencs
Objects.isNull() Objects.nonNull() These methods we use in functional approach.…
Read more ⟶
Troubleshooting Unable to Convert Binlog Coordinate
At work I got assigned to a bug, the MySQL Replication setup failing with error Unable to convert binlog coordinate (mysql-binlog.000002:430106631) to GTID when we tried to fetch the GTID using below command.
MariaDB [(none)]> SELECT BINLOG_GTID_POS('mysql-binlog.000002', 430106631) AS gtid; +------+ | gtid | +------+ | NULL | +------+ 1 row in set (0.002 sec) MariaDB [(none)]> After investing time and effort, I thought like, what’s the gaurentee that 430106631 is presented in the mysql-binlog.…
Read more ⟶
Install Suckless Dwm in Debian
I was trying to install dwm in Debian 12 which is already having XFCE Desktop. From the suckless website I cloned the dwm repo
git clone git://git.suckless.org/dwm And the changed to dwm to compile
Fixing missing Xlib.h error raja@debian ~/s/dwm (master)> make cp config.def.h config.h cc -c -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os -I/usr/X11R6/include -I/usr/include/freetype2 -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"6.5\" -DXINERAMA drw.c drw.c:5:10: fatal error: X11/Xlib.h: No such file or directory 5 | #include <X11/Xlib.…
Read more ⟶
Fix_LC_ALL_cannot_change_locale
I started seeing error bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) in my terminal.
Upon searching I came across below solution which resolved my issue
sudo su - apt-get update apt-get install locales echo "LC_ALL=en_US.UTF-8" >> /etc/environment echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen echo "LANG=en_US.UTF-8" > /etc/locale.conf locale-gen en_US.UTF-8 Hope it helps.…
Read more ⟶
Fix Bluetooth Headset Voice Chop in Linux
I am using Debian bookworm as my daily driver. As I connected my Sony Bluetooth headset, the voice started chopping or skipping the continuity. Upon searching/googling came across this fix via stackoverflow. In simple words, I need to increase buffer interval from 0 to 50ms and the audio will be buffered a bit early to avoid this lagging.
Find out your bluetooth MAC and respective probe name via which the output coming out of your bluetooth headset.…
Read more ⟶
Behavior Parameterization
This programming pattern preferred when requirements of your project tends to change frequently. As name states, here you build a function and you pass that function as an argument. This way, as main logic not tightly coupled with functionality, when ever changes required, you update the defined behavior. As an example, you are told to process an order transaction with below steps - fetch order transaction - get the payment status - send to the vendor for further processing with order tracking as callback Now assume, you are told to a payment transaction - receive the payment details - user account has balance or not.…
Read more ⟶
Manage Binglog retention in Maria/MySQL
In Maria DB or MySQL DB we can manage update Binlog retention by updating the global property named expire_logs_days
What is binlog ? binlog is a file where all the sql statements that were executed against the data in the database were record. using this binlog file, you can see what are the SQL queries executed against your database. And this binlog file can be used for replication or to perform PITR(point in time restore.…
Read more ⟶