Sunday, November 10, 2019

Can you correct my name please ?

At the end of last year - 2018, I joined a tech company that allowed me to reimburse all food bills as long as the bill had my name on it. For the first few days, I started gathering food bills from all around me. All my friends knew that food bill have to be in my name. 

I am still a loyal zomato user, however, for the first time, I tried using swiggy to order my daily lunches so I can claim the same from the company. Hence I went ahead and created an account on swiggy. The only mistake I made was an incorrect typing of my name. A simple misspelled letter. I thought a simple email to swiggy should rectify the misspelled name.

So on 3rd Jan 2019, I dropped an email to swiggy to rectify the spelling of my name. I received a reply on 4th Jan that due to tech issues, they are unable to fix my name. 

Greetings from Swiggy.

I am sorry for the inconvenience caused to you regarding this issue.

I would like to inform you that due to some technical issues we are not able to update the name. Hence, I would request you to please wait for sometimes that we might provide an option to change the name on your app itself.

Thanking you for your patience and understanding


I waited for a month, and followed up. And on the same day, I was told that the best minds are working to fix my the spelling of my name. I was impressed. 

Please accept our sincere apology for the inconvenience caused.

I'd like to inform you that we have highlighted this issue with the concerned team and our best minds are working on the issue to come up with a resolution as early as possible.
 
We are sorry that it is taking longer than expected time to help with the resolution for this query. Hence, we request you to allow us some more time that we might provide an option to change the name on your app itself.
We appreciate your patience and understanding.

Next I shot an email marking all the VP & above people in swiggy and explained my problem. 

However, still nothing happened. I was surprised that such senior folks ignored a customer. I have been startups & e-commerce & I know how important it is to communicate to the customer. Ignoring a customer is not something that I would do or even allow anyone from my team to do. 

After a long chain of emails, I was told that there is no visible timeframe for them to fix their technical glitch. 

​Thank you for reverting us.

We understand that you would want to update the profile name in your Swiggy account.

We would like to offer our deepest apologies for the trouble you had to experience with Swiggy. We understand how disappointing this must have been as this is not the service we want our valuable customer to experience. 

We regret to inform you that we are unable to update the profile name due to technical glitch. However, our concerned team is working on this issue and it will be resolved soon, but we do not have a time frame.

We appreciate your kind understand here.

I am writing my rant today almost after 11 months of the initial email. And surprisingly Swiggy does not have a solution yet. 

In hindsight, when I think what could have gone wrong? Was the database design so poor that the team was unable to fix it? Are the tables not properly normalised? Are they not using micro services? Is their micro service design flawed? Is there no ROI in profile updation feature? 

I have built a few products in my career & for me insert & update is a single micro service with an endpoint that supports multiple http verbs. 

This is a use case of why it is important to engineer the database & application in a loosely coupled fashion. And use design patterns which enables easy addition of new features & fixing of bugs.

Wednesday, November 06, 2019

Should I take a car loan ?

l got my first car at the age of 27. I "had" money. I got a car worth 7 lakh INR in 2007. I took a huge loan of 5 lakh INR (1 Lakh = 100,000). And paid an emi of around 10,800/- for the next 5 years. The interest itself costed me 150,000/- extra. Which means for the car which I got for 700,000, I paid 850,000. 

And a car is a depreciating asset. Which means, as the car grows old, its value decreases. And 7 years later, when I sold my car, I got mere 150,000 INR for the car. Which means I lost more than 700,000 INR in owning & maintaining the car.

Instead if I had invested those 200,000 that I paid as down payment in large cap mutual funds, I would have received at least 400,000 after 7 years. However, I do not feel sorry about the fact that I blew 700,000 INR on the car, instead I repent the fact that I paid 150,000 in interest for a depreciating asset.

The question is - do you want to spend that much on the car you love? Keeping in mind that the life of a car is around 3 years max. After which its maintenance & old age becomes visible. And no matter how expensive the car is, you cannot run if for more than 10 years. 

The answer is for you to decide. If I ask myself the same question, in hindsight, I may reply that instead of spending lavishly and getting an expensive car on EMI, I should have got a smaller car on downpayment. And created a SIP of the EMI fund which will help me getting an expensive car in future.

Saturday, January 05, 2019

My struggle with Dominos - again

I did not learn any lession from my earlier experience http://jayant7k.blogspot.com/2011/03/encounter-with-dominos.html

Let us see how frustrating is it to get a duplicate invoice from Dominos. Question - is Dominos fudging its records to avoid Tax.
I ordered a lot of pizzas for my kids party. It was a bulk order placed on phone and the payment was by cash.
I called back the next day to get a duplicate invoice, which i can use for corporate reimbursements - my organization has this policy and I still had some budget pending. I was told that Dominos cannot generate a duplicate invoice on the next day. So, i raised a support ticket at with an email to GuestCareDominos@jublfood.com .I was given a reference no 7897434. And i got a call where i was connected to the restaurant to get the invoice. The restaurant again denied giving a invoice. And my call was disconnected.

This was my first call.

My second call went like this:
Dominos - Would you like to place an order.
Me - I have a concern for which the ticket no is 7897434.
Dominos - Can i get your phone no ?
Me - 9XXXXXXXXX
Dominos - Order no
Me - 33
Dominos - Sir, when was the order placed
Me - XX-XX-2018
Dominos - Sir, we can generate duplicate invoice for orders placed on that day only.
Me - But, i need the invoice.
Dominos - Sir, but we do not have it.
Me - Connect me to your manager
Dominos - Connects me to the restaurant. The manager Mr Anil from park plaza restaurant, indirapuram comes on the phone.
Anil - Sir, we can give you an invoice on an A4 sheet paper - come any time in afternoon & collect it from Mr. Gyan in the restaurant.
Me - Great.

Next day, I went to the restaurant to collect the invoice.
And i see Mr. Gyan - who again refuses to generate the invoice. I ask him to call Mr Anil, and Mr Gyan is reluctant to do so. Maybe he was thinking about his appraisal. BTW, I call up dominos at 1860-210-0000 and it was at this time the ordeal got rougher.

3rd call
Dominos - Would you like to place an order.
Me - I have a concern for which the ticket no is 7897434.
Dominos - Can i get your phone no ?
Me - 9XXXXXXXXX
Dominos - Order no
Me - 33
Dominos - Sir, when was the order placed
Me - XX-XX-2018
Dominos - Let me put you on hold while I connect you to the restaurant
Me - I am standing at the restaurant.
Dominos - Sir, let me connect you to the restaurant. [It seems the guy has hearing or understanding problems]

While i wait for the "tune" and they connect me to the restaurant, my mind starts thinking...

Why do i have to keep repeating my complete history everytime i call. Dont they have a CRM? Where they know what is happening with their customer. What f***ed up organization runs their IT. I looked it up later and it seems they do not have a face for their technology team. http://www.jubilantfoodworks.com/wp-content/uploads/2018/11/Leadership_Dec.jpg I can see a Mr Anand Thakur. Maybe he should think about having a CRM
The phone behind me Rings. The lady at the phone picks up. While I am standing just behind her - she talks to me on the phone. When I tell her, that she is talking to me - she disconnects. And i am again redirected to Mr. Gyan to get my invoice. Mr Gyan again denies from generating the invoice. My brain is now on fire. A very simple task as to generating a duplicate invoice is such a hassle for Dominos. Why cant they generate duplicate invoice ?

4th call
I again call up their central help-desk no. Again play the 10 stupid questions game.

In the mean time i somehow convince the "Appraisal Man" - Mr Gyan to call up his Boss.
Reluctantly Mr Gyan calls up his manager Mr Anil - who is not available. He is enjoying his holiday without giving any instructions regarding his promise to a customer.That is how little these guys think about a customer.

Somehow the 10 questions get over and I ask for the supervisor. Now comes this super busy lady Ms Upmeet. She is also unable to connect to the Manager Mr Anil. It seems the manager Mr Anil, purposely gave me an afternoon slot for a visit to the restaurant. He would get his portion of sick pleasure to see a customer bang his head while he sleeps at home. Mr Upmeet connects to the restaurant and talks to someone about giving me the invoice and then abruptly disconnects.

5th call
Thanks to jio, we now have unlimited talk time at very cheap rates.
Mr Gyan is conveniently ignoring me.
As soon as the call is picked up - i ask for Ms Upmeet. But Ms Upmeet  [I will call her Ms Busy] has moved into a meeting.
I again play the 10 stupid questions game - [ Mr Anand Thakur - I will help you to get a CRM for free - i think ]
Just then the shift manager Mr Pankaj arrives. He somehow convinces Mr Gyan [ who is still ignoring me ]  to copy paste the order on an A4 sheet and give me a hand made invoice.
The game of 10 questions is now over and the call is again disconnected.

6th call
I again thank Jio and make my 6th call.
Mr pankaj [My saviour] has finally been able to create a hand made invoice with his sign and company stamp. I think this should work.
The call is again picked up by someone - and I ask for Ms Busy.
Me - I want to talk to Ms Busy
Dominos  - Sir, can i know your concern.
Me - This is my 6th call - I have played your game 6 times now. I cannot play anymore. I was talking to Ms Busy, and the call got disconnected.
Dominos - Sir, let me check with Ms Busy.
Me - okay
Dominos - Sir, Ms Busy has moved into a meeting and will not be able to attend the call.
I know Madam Umeet that you saw a frustrated customer and ran into a meeting to avoid talking to the customer.
Dominos,if you have such managers who are either unavailable or hiding from customers, your organization life span is very short.
Dominos - Sir, I will arrange a callback from Ms Busy.
Me - I know that I will not be getting the call. Ms Busy has fled the battle of words.
I thank Mr Pankaj for the handmade invoice and return.

All this for generating a duplicate invoice.
My afterthought is that If I order online, my invoice is emailed, smsed to me - since I am making the payment online. The question here is whether Dominos stops generating invoice for cash orders - that will help them avoid tax on cash transactios.
Food for thought for all of us who still make cash transactions.

Thursday, September 13, 2018

Toastmaster P10 : Be happy



Do you ever wonder why we exist? What is the purpose of life? What would be my contribution to the big picture? Or in fact, what is the big picture? There are many contradictory views on this subject - mostly religious and some scientific.

Some people say that their goal in life is to be successful. But do they know the definition of success? Is it money, family, position or simply peace? If you ask them they would be unsure and their definition of success will keep on changing as they move ahead in life.

The question is how do you figure out what you want in life? There is a well known model known as the PERMA model founded by a psychologist Martin Seligman. This model states that there are 5 attributes that human beings require to find personal happiness. The first element of the model is positive feeling - which is felt when the basic needs of life are met - like food, drink and sleep. The second element is engagement - which is about being involved in activities you like with passion and commitment. The third element is relations - which is how closely are you related with people around you. The fourth element is meaning - which is defined as what you value in life and how you contribute to improve what you value. And the last element is achievement - which is a sense of success that you get out of challenging yourself repeatedly and improving yourself.

Whenever you feel lost or demotivated, step back and have a look at these 5 parameters in relation with your life. This will help you figure out what is missing and what you can improve upon. When i evaluated my PERMA model, i figured out that I should be engaged in travelling and challenge myself to visiting remote natural wonders.

I have my own perception regarding the purpose of life. For me, life is a journey. Like in any trip, there should be a lot of planning done for life. And it is important to figure out what your values in life are. It is like figuring out the places you want to see in a trip. Most of my trips do not have a specific destination. My most memorable trip was the trip to leh. If you search for images of leh, you will see that leh is actually a small town in the mountains. The landscape is mostly like a desert - barren with lack of vegetation.

When I was planning the trip to leh, my better half told me to go via air. But I planned it as a road trip. We travelled through roads with huge walls of ice on both sides. I am still curious as to how the roads were dug out of so much ice. We saw a huge plateau called moore plains which is 40 km long and wide flat plain with mountains on all sides at the altitude of 15400 feet. We got stuck at the highest motorable road in the world and spent the night with a bottle of old monk. We saw the huge pangong lake which is surrounded by mountains and has crystal clear water at the height of 14300 feet. On our way back, we spent a scary night in kargil and stayed in a beautiful houseboat at kashmir. It still is one of the best trips. We saw beauty, had adventure, experienced new food and culture, met interesting people and completed a must do trip.

The point to note here is that the trip did not have any destination. Though we say that we went to leh, but ideally we saw a lot many places in addition to leh. And I would like to say that out of all the places we saw, leh was the least interesting of all.

It is the journey and not the destination that matters. And this line is applied to all our lives. We have a journey of 80-100 years from the time we are born. There is nothing in the destination of life. In fact we all know the destination. So, evaluate your PERMA model and figure out what gives you happiness. It can be having more friends or photography or travelling or maybe even getting married. Take your time while you are on the journey of life. Stop at all interesting spots to click pics. Live each moment. Aim for your aspirations. Those are the challenges in the game of life, that keep the game interesting.

Strive to make memories that make you happy and peaceful. Remember, life is a journey and not a destination. And you are here to enjoy the journey. Aim for the sky, but move slowly, enjoying every step along the way. It is all those little steps that make the journey complete.

Wednesday, September 05, 2018

Toastmaster P9 : Hair today gone tomorrow



Opening (1M)

    Yes, I am going to talk about hair loss and the alternatives that we to-be-bald people have. Good morning fellow toastmasters and guests. Today I am going to derive the best hairstyle for most of us.

Body (4M)

    Let me tell you my story. How i came to have this hairstyle.

    Once upon a time, that was me with hair.


Not long ago, i realized that the number of hairs on my head is not as many as i would want it to be. As the number of days increased in my age, the number of hairs decreased on my head. And on a particular day, not long ago, i saw the deadly bald patch on the top of my head. In order to hide the patch, i grew my hair longer, but the patch would peek from under the long hair and it made me look older than I am.

I did a lot of research to regrow my hair. The most effective medicine that is available in the market is Minoxidil which has a success rate of around 60%. But it has some unwanted side effects. Another popular option is hair transplant. I have a friend who went through hair transplant, and according to him it is a pain to maintain. Each haircut costs him more than a 1000 Rs.

Why do we keep long hair? So that we can have some hair style. Do you know that style is defined as something distinctively unique to a person. Something that makes you stand out. A bald person obviously stands out from a crowd of people with hair. Being bald is a bold style to have.

So, after a lot of thinking, i went bald.


Do you think that this looks sexy ? Yes, it does. But believe me when i say, it is not practical. The first thing that i realized on becoming bald is that my scalp is exposed to sunlight, dust, heat and cold. Specially cold. Imagine sitting in a meeting, with normal AC. While everyone else is comfortable, I was feeling cold on the top of my head as i did not have any protection. That was the time when I concluded that hair is important. But I should be able to decide the density in a fashion such that my bald patch is hidden in plain sight.


Can you see my bald patch in this? And it is somewhat close to the bald sexy photo we saw earlier.

Conclusion (1M)
 
There are a lot of benefits of short hair. I can drive with my car windows down without resulting in this.

I also dont need excessive amount of shampoo and conditioner. In fact, even soap works well.

With short hair, i dont feel hot headed even in this weather. There is enough ventilation to cool down my head.



Even women look good in short hair. You can say bye-bye to bad hair days.

As it is said, everything that has a beginning has an end. 
Most of us begin as bald babies and so, we are bound to lose our hair as we age. 
And we should embrace the maturity that the look with short hair gives us.

Monday, September 03, 2018

Toastmaster P8 speech : Are we machines ?





Opening :

Do we believe we are human beings? Yes we do. Because we are able to identify and differentiate between different faces, voice tones and expressions. And most importantly we are have feelings and we are self aware. Let us see what a machine is capable of ?

Body :
   
We can see 2 numbers here. If you put these numbers in a machine - say a calculator or a computer, it will be able to identify the first number as 6 and the 2nd number as 9. For a machine these numbers are different and so, if you ask the machine whether 6 is equal to 9, it will give a false answer.

Did you notice something here ? Yes, the fonts of both numbers are different. But, irrespective of the font, a machine will be able to differentiate between the 2 numbers.

   
What do we have here? The left image is? And the right image is?

What will happen when i put these two images in a computer? Will it be able to idenfity the left image as a woman and the right image as a man? Probably No. That is because the computer does not have the inbuilt logic to differentiate between these faces. How do we as human beings identify the faces as different? Shape of the nose. Eyebrows. Lips. Forehead. Hair style. What if the machine can be taught to differentiate between these two images using these data points.

Lets take a step back. Have you heard of machine learning ? For those who do not know, machine learning is a concept where we provide sample data to train a machine. Once the machine is trained, it identifies data points to differentiate between input data.

This shows a segregation of gender based on height and weight.

So, if we train a machine by providing a large number of faces both of men and women, it will eventually have data points which we unconsciously process. And later if we feed it a face, it should be able to tell us whether it is the face of a man or a woman.

The question here is how does the human brain differentiate between the faces ?

Human brain is built up of neurons or brain cells. Each neuron is connected to upto 10,000 other neurons via synapses. When we are born, do we not know the difference between the face of man or woman? No. But, we come across these faces and we are told repeatedly which is the face of a man and which is the face of a woman. The neurons and synapses store these data points training our brain to differentiate between man and woman faces.

But, then you would ask, what about emotions and feelings? Are these also trained into our brain? Do you know how powerful our brain is ? As per some article on the internet, it would take approximately 83000 super computers to work for 40 minutes to simulate what human brain can simulate in 1 second. And imagine that if I am 30 years old, my brain has been training, learning and accumulating data points for 30 years.

Conclusion :

Does it mean that with a lot of processing power and a lot of training, computers should be able to simulate feelings and emotions like human beings. As per some articles on the internet, by 2045, the intelligence of computer will exceed the intelligence of a human being. Then maybe machines will have feelings and emotions. Are we still sure that we are not advanced  machines ?



Monday, August 20, 2018

Toastmaster P7 speech : How much is enough ?

Opening
    Jack daniels, black label, double black, royal stag, blenders pride, baccardi, bira, sula. Most of us have heard these brands. And some of us have memories associated with them. Some good and some bad. Some which we keep on trying to deny.

    Good morning toastmasters and fellow guests, today I am not going to talk about the bad effects of alcohol. I am not going to tell you that alcohol may destroy your liver. You all know the ill effects of alcohol. What I am going to talk about is how to control your drinks.

Body

    As per wikipedia, a blood alcohol concentration of 0.03% to 0.06% is enough to get you happy. Whereas a blood alcohol content of 0.2% to 0.3% can lead to nausea and blackout. The permissible legal limit in india for driving is 0.03% which is around 1 drink for someone weighing 73 Kg. And it would take 10 drinks for him to black out.

    I have blacked out multiple times during office parties. I still thank my friends who dropped me home during those difficult times. And I have paid my dues by dropping them home during their difficult times. I still recall a very rare moment when I was drunk and so was my friend. Only difference was that I was standing and he was lying on the footpath. While I was trying to figure out ways to get him home, a sardarji came and said "It is better to not have friends like these". Mind works in miraculous ways when you are drunk. That got me thinking - how much is enough to keep me tipsy and happy and still get me home.
   
    Keeping wikipedia aside, it is important to know your limit. How many drinks can you take before you black out. As some of us know, limits change with age and location. Still, it is important to have a rough idea. Now divide that limit by half. This is how how much is enough for you at an office party. 2/3rd of that limit is enough for you when you are drinking at a friend's place. Because, you know that if you are not dropped home, you can crash at his place. But, if you are at home, you can drink way past that limit.

    Another important tip is to time your drinks. First few drinks are generally fast because you are in a hurry to get high. But later drinks should be spaced out at increasing intervals. If the mathematics turns to be too complex, a simple rule of thumb is to spend 30 minutes or more per drink.

    As per National Institute on Alcohol Abuse and Alcoholism - moderate consumption of alcohol is good for health. Moderate consumption means single drink for women and upto 2 drinks for men per day is said to decrease the risk for heart disease and diabetes.

Conclusion
    The statistics that we looked at say that 1-2 drinks every day is enough to keep us happy and improve our health. How much do you think is enough is for you to decide. After all, it is your liver and your health. But most important is to avoid those memories which you cannot remember. Drink responsibly, don’t spill it and reach your home on your own two feet.

Thursday, May 17, 2018

Toastmaster P6 Speech : Google Aunty

Opening : 1M  
    Most of us use google maps to help us to find directions to our destination.  
    [[Demo of google voice assistant : directions to home]]
    Google maps works. But have you ever been (assert) misrouted by google maps. Can you recall that experience ?

Body : 4M
    I have been misled few times. One incident, I remember vividly that reconfirmed one of the truths about travelling. We were three families going to landsdowne and we had hired a tempo traveller for the journey. My family, the family of a very polite sardarji and another family of a very close friend who is generally recognized by his frog eyes.

    The tempo traveller picked us up at around lunch time. I asked the driver "i hope you know the way". The driver gave me a blank look and said “No Sir”. We consult google aunty for the route. (robot voice) It will take 6 hours and 47 minutes to reach your destination.

    By sundown, the kids were out of patience. "Papa, uncle, when will we reach the mountains?". And sardarji was like "Beta, we are about to reach. Count to 100". And then we reached (assert) that fork in the road. This is a very important fork. The driver says "Sir, we should take the left road. It is the highway". But google aunty said "Use the right lane to slide right". And since we trusted google aunty, we took right. In some time, we were almost inside a village. My friend's eyes have become even more froggy. Google aunty says "In 100 meters take left". We took the left and in 1 kilometer, we are actually inside a village. It is very dark outside and the road kept getting narrower and narrower. Suddenly, we see a villager, and we stop near him. We ask him the way to landsdown and he looks at us with his sleepy eyes and says "Sir, i dont know". The driver wanted to take a u turn, but the road was so narrow that it was not possible.

    And then we were no more on proper road. There were potholes everywhere. And we were in a farm with tall grass on both sides. By this time our wives were giving us the "eye". All of us are peeking out of the windows, nervous and sweating. And suddenly there was a big bump and we are on the main highway. There was a police barricate with police men standing. They stop us. "Where are you going?" the inspector goes. We push forward our polite sardarji who says "Sir, we are going to landsdowns with family. And we got lost." The inspector gives us directions and we drive on.

Conclusion : 1M
    And then i realised that during the whole time, while we were lost, the kids were very quiet. No one was counting to 100. No one was nagging us. They were sitting relaxed. Staring outside. Enjoying the night, the stars, the farms, the village houses. They were the ones enjoying the drive. It made me realize that "It is the journey and not the destination that matters".

Tuesday, April 03, 2018

Toastmaster P5 speech : Fraudalert

Opening : 1M

    Have you ever had your wallet stolen ? Where ?

    I had my wallet stolen was around 4-5 years back, when I was in the metro heading to the railway station. I still remember that I felt the hand slip into my pocket and take out my wallet in the crowded metro and when I looked around, there were a lot of people and I could not figure out who took my wallet.

    Fellow toastmasters, today, I will tell you how to save yourself from fraud.

Body : 4M

    That day, when my wallet was stolen, I had everything in my wallet - id, all my money, credit and debit cards and even my metro card. And that made me realize that you should never keep all your eggs in the same basket. It is better to have multiple baskets. So, since that day, my wallet only has a small amount. Bank cards and id cards go into my backpack. I was so paranoid after that incident, that for some time, I had started keeping some money in my socks as well.

    Another type of fraud that is very rampant now is the paytm fraud. You get a call from an unknown number and the call would go like this.

    Caller : hello beta, this is sharmaji.

    You : (thinking) which sharma ji? Why is he calling from an unknown number?

    You : (Aloud) yes sharmaji, why are you calling from unknown number ?

    Caller : Beta, I am in mathura. My wallet and phone has been stolen, and i need money urgently. I am calling from the mobile of my hotel owner where I am staying. I have to make some payment here. Can you paytm me money on this number?

    Now, you are in doubt, whether you should paytm money or not? This can be a genuine case or can be a fraud. The best way to handle this is to call up the sharmaji that you know and verify.

    Have anyone of you ever fallen for credit card or debit card fraud by sharing your otp ? I was almost duped. Around an year back, I got a call from an unknown number asking me about an insurance policy for which i had recently paid the premium. I was told that there was some problem with the payment and it is not reflecting properly. And to verify the same, I would need to share the credit card no through which I had made the payment. So, I shared the credit card no. Next, they asked me to share the OTP. That got me thinking. Why would they need the OTP to verify. So, I told them that I have not received the OTP yet and asked them to call me back in 5 minutes. In those 5 minutes, I called up the insurance company and verified whether the call was from them or not. The learning is that never share your OTP or your PIN with anyone - no matter what.

  

Conclusion : 1M

    Recently, there has been a drive to link your adhaar card with almost everything - your bank account, your credit cards, mobile no. The question that you have to ask yourself is how secure is the adhaar system. Can someone who has your adhaar number extract all the details linked to it ? What happens when an unknown person has all your information ? I will leave you now with this thought. Thanks

Monday, March 19, 2018

Toastmaster P4 Speech : Ijen Crater

Opening : 1M

    Have you ever smelled burnt sulphur ? It has this sharp choking smell that hits your nose and scratches your throat and makes you want to stop breathing. Imagine breathing that smell for a long time. Dear toastmasters, I visited a volcanic sulphur mine at ijen crater during my trip to indonesia. It was a trek which I will never forget.

Body : 4M

    We got up at 12 in the night to start our drive to the base of the volcanic crater. It was a steep drive and I could feel my ears popping due to loss of air pressure. The temperature dropped drastically and it was very cold by 1pm, when we reached the base. We had a round of hot tea and started to climb the 4 km long route at 2 am. It was a very steep climb and we were soon out of breath. We were huffing and puffing like the wolf in the 3 pigs story. There were no lights and we could see only upto 2-3 steps before us.

    After climbing for almost 2 hours, suddenly I could smell the sharp acidic smell of sulphur. On looking around, i could see that I was at the peak and the path now led down into the mountain that we were climbing. The path was made of  steps cut into the mountain and was broken. And in spite of the darkness, I could see the sharp drop to my right. It was scary and smelly. My throat was raw and scratchy. I had a gas mask, but putting it on the face made me feel suffocated and clouded my spectacles.

    After climbing down, we reached the base of the crater. Where we saw the main attraction. We could see electric blue fire coming out of the mine at certain places. We were told that it happens due to sulphur gas catching fire at high temperatures. I tried a lot, but could not get a clear photo of the fire.

    We climbed back the scary path holding and helping each other. All this time, we could see miners going to and fro carrying heavy buckets full of sulphur. We trekked further on the rim of the crater and came to the sunrise point. As the sun came up, I saw the beauty of the crater. I was at the edge of the crater with the sun in front of me and the beautiful sulphur lake behind me. I stood staring at the lake, mesmerised by the view.  The lake is in the form of a huge circle 1 km wide. I could see the complete lake inside the crater. The lake is turquoise in colour. Some part of the lake was covered in yellow smoke of burning sulphur and another small part was covered in floating white fog. As the sun rose, the fog started clearing and we could see thick yellow smoke coming out of the mine.

Conclusion : 1M

    The lake is said to be very toxic. We also saw the path we took to visit the mine. It was then we realized why we were taken in the dark. The way was so twisted and dangerous, that we would not have dared to climbed down to the mine, if we had seen the complete picture. Overall the view was worth the effort. It is rightly said that the best view comes after the hardest climb.

Wednesday, March 14, 2018

Toastmaster P3 : Why travel ?

Do you think it is a pain to travel ? First getting bus, train or plane tickets to your desired destination. Then packing your bags and moving from one location to another. All this to see the same earth, sky and water which you can see anywhere. Let me explain the benefits of travelling, which should persuade and inspire you to travel more.

Travelling improves your social and communication skills. When we travel, we meet different types of people, who speak different languages and have different cultural background. Their way to greet can vary from a handshake to namaste to something else. Interesting "conversations" happen when you are in a foreign country where you do not understand the language and are forced to use sign language for as simple as asking directions. When i went to indonesia recently it was very difficult for me to understand their food menu. So, i pointed out a dish labelled "nasi goreng" and the waiter explained to me via sign language that it has something to do with rice. I generally do not have any reservations with food, but uncooked or partially cooked food is not something that I can have. I ordered "nasi goreng" and was surprised to find that it was simple (pause) "fried rice". It became my favourite dish through out my stay and travel. The excitement and joy of communicating with someone without using speech(pause) is something that cannot be explained in words.

Travelling also enhances your tolerance for uncertainty. Have you ever been in a situation where you have missed a bus or a train or a flight? During my trip to leh laddakh, our group was stuck at the second highest motorable pass in the world called TAGLANGLA at the height of 17582 feet. It was extremely cold outside and we did not have any food or water. All we had was a bottle of (pause) old monk . That night we saw truck drivers cooking within their trucks. It was so cold at night, that we did not have the courage to go out, even to ask for food. We survived on the single bottle of old monk. I learned that I should always carry some chips and peanuts to go along with the bottle. When we face uncertain situations, our mind is forced to think differently to find the way out.  That joy of finding your way out of uncertain situations(pause) is something that cannot be explained in words.

And finally, you get lifelong memories. That night(pause) at TAGLANGLA is something that all of us will remember. On our way to leh, we travelled on a road with a wall of ice on both sides. I can never forget that drive. And I still cannot figure out the effort it took to dig that road from under so much ice. Nor can I forget the thrill of watching a live volcano from its crater. Or the time spent with my kids building a sand castle on the beach. These memories get imprinted in your brain and come back sharp and clear. The joy of remembering and recalling those moments(pause) is something that cannot be explained in words.

Inspite of the trouble that we go through in making arrangements and moving ourselves from one location to another, the experiences that we gain far outweight the trouble that we take. We can not only improve our communication and social skills, but also improve our capacity to overcome uncertain situations. And the memories that we get last for eternity. To conclude, the joy of travelling(pause) is something that cannot be explained in words.

Monday, March 05, 2018

Toastmaster P2 : E-commerce vs Brick & Mortar Stores

    Can I have a show of hands on how many of us prefer to shop online?
    And how many of us prefer to go out to a store to shop?
    Would huge brands like amazon or flipkart let the brick & mortar shops survive ?
    Or would these huge brands eventually run out of investor funds and shut down ?
   
Good morning fellow toastmasters, let us try to foresee who would survive in a war of E-commerce vs Brick and Mortar stores.
   
Let me tell you a story   

        During my wedding, my better half wanted to get a lehenga of my choice. I was surprised because for me there are only 6 colors - red, yellow, orange, pink, blue and green, whereas her eyes can see multiple colors in each of these color.) For example she could see multiple shades of red - light red, dark red, blood red, maroon. Similarly for green there is light green, grass green, dark green, lime green, etc. I think i spent at least 2 weekends roaming with her in chandani bazaar and karol bagh. I cannot even count the number of shops we visited. And i know that i was of little or no help to her. Now, if we had flipkart or amazon in those days, it would have been a lot easier for me.
       
    There are people who want to see, touch and feel a product before purchasing. Also there are people who want to take the product home immediately. These are the two downfalls of shopping online. You cannot know how the cloth will feel. So online shopping for electronics and electricals is easier. Because you do not need to touch and feel the product. You know that all products that belong to a model will be similar. Shopping online for footwear is a bit dicey. You know the size you wear, but different brands may have different sizes and there are cases in which for one brand you would be wearing a size 7 whereas for another brand it would be size 8.
   
    What prompts us to shop online is the large amount of inventory and the discounts that are available online. And the luxury of having a product delivered home without stepping out of the house. Now-a-days, returns are also easier. It takes time, but then there are some benefits as well.
   
    The question that comes to our mind is what is required to run these online or offline stores?
    Both require rent and electricity. Offline store would pay rent and electricity for their shop where they put their products on display. Whereas e-commerce sites pay rent where they have their offices. They also pay a lot of rent on warehouses where they hold their inventory, whereas offline stores do not require such large warehouses. But then they have limited variety, whereas online sites have huge variety. Offline stores pay small salaries to the sales team they have, whereas online stores have to maintain a highly paid technical team and computers - servers. Offline stores do marketing locally so the marketing expenses are low  as compared to online stores which have to do marketing at a countrywide scale which is very expensive.
   
    If we look at the sales figures, online stores have a conversion rate of 2-3%. That is out of 100 people visiting the site only 2 make a purchase. This can go up to 8% with proper marketing, discounts and intelligent listing of products. On the other hand,  offline stores have a conversion rate of 15-30% which depends mainly on the season and discounts. So out of 100 people walking into the store, at least 15 make a purchase.
   
    If we look at both of them, ecommerce stores have made it easier for people to shop. But if you have time and want to feel the product before you buy, you can still walk into a store and purchase it. Which tells us that both online and offline stores would co-exist. E-commerce sites have realized that it takes huge effort to maintain a huge inventory. And in order to cut costs, they are moving to marketplace model. Where they would compliment the sales of offline stores. In a marketplace model, the online stores will eventually get product from an offline store and deliver it to the customer. Nobody can predict the future. We can only speculate it.

Toastmaster PI Speech : Story of love

I still remember the day when I was small boy and I saw it for the first time. It was love at first sight. It had blinking eyes and all 10 numbers. Yes it was the casio calculator watch which did addition, subtraction, multiplication and division on your wrist. I wanted it so badly. But it was very expensive and also not allowed in school. The casio calculator watch was my first love. And also my first heart break after my parents did not allow it to be a part of my life.

Good morning fellow toast masters. Today I will be telling you the story of my love.

Some time during my childhood, i realized that I understood machines better than I understand humans.

I remember my first interaction with computers during my 8th standard in my School in Baroda, Gujarat. Our lab had the latest intel 286 machines. Now these machines came without hard drives. To boot the machines, we used to insert a 5 inch floppy into their floppy drive. And on booting, we used to get a black screen with the DOS prompt. There was no windows in those days. My favourite games were paratrooper and chess. I remember that in chess, for each move I made the computer used to take 15-30 minutes to calculate its next move. And since the computer period was of 1 hour only, I never completed a game of chess in school.

I got my first computer when I joined Engineering in Computer Science branch. It was the latest 166 MHz intel pentium processor with 2 MB of RAM and 1 GB of hard drive. Almost 1000 times slower than what we have on our mobiles these days. But then those were the days when Bill Gates had said that 640 kb should be enough for any one. And, having such a machine, I was on cloud 9. So, during college days, I spent my nights playing Age of empires instead of studying. And as a result, when I passed out in 2001, I was one of the very few graduates, who were not placed during campus placements. Thanks to my seniors, I was able to join as a software engineer in a small company in Delhi. Here I was exposed to the world of online gaming. I used to spend a lot of time in office - around 10-12 hours daily. Working a lot during the first 8 hours and spending time playing online games after my manager went home. I was very happy.

But then, the greatest tragedy of my life happened - I got married in 2007. It was difficult for me to grasp that talking to my wife is more important than playing video games. One year later, i could not take it any more and got my first custom built desktop with a very expensive graphics card to play high end games. But all good times come to an end. My first kid was born in 2010 and I had to spend time feeding her, changing diapers and with multiple trips to doctor for vaccinations. I did not learn from my mistake and got my second kid in 2012. They are 7 and 4 years old now. My passion for games came alive last year when my 2nd kid started going to school. I had to rebuild my computer last year to play the latest games. Imagine falling in love again.

In addition to computer games, I love travelling. I hope to travel to all the different corners of this world some day.

To conclude, I am a very passionate computer gamer and a traveller. In addition to this, I am a father, a husband and currently a toast master.

Saturday, August 19, 2017

A rant on Uber and Ola

Uber and ola have been in India for a long time now. Why do I want to rant about them now ? Read on. I promise it is interesting.

What happened with Uber ?

Uber keeps on sending me promo codes, but whenever I try to use them, i am told that the code is not valid for me. I used to ignore it in the past. But last week, when I was planning my ride, i thought of asking uber - why do they send me promo codes which are useless to me. Maybe they have a bug and I since I point it out to them, I may get some goodies from them. On asking about the same, I was told that promos have been deactivated on my account due to suspicious activities. Now, if i had done some "suspicious activities", i would have been ok with this response. But, being flagged without doing anything is not something I would look forward to.

After multiple to and fro, I realized, that it is some customer support typing the same message with different word combinations - as he is not capable of doing anything else. Here is a the complete dialogue - with jumbled words conveying the same meaning repeatedly.

Hi XXXX,

We understand the disappointment this may have caused. Unfortunately, since the promotions on your account have been disabled by the system, we would not be able to honor any promotions on your account going forward.

Though you may receive notifications regarding the on-going promotions, please know that will not be able to apply them on your account.

Rest assured, you will still be able to request for rides from your account as usual.

Hope this clarifies.

Sent by SB on Saturday, August 12, 2017 at 2:34:36 PM
Continue this conversation by replying to this email or going to help in your Uber app.
PREVIOUS MESSAGES
My earlier query still remains unanswered
Sent by XXXX K. on Saturday, August 12, 2017 at 2:30:58 PM
Hi XXXX,

Happy to explain. Uber reserves the right to adjudge and verify the eligibility criteria of any rider receiving a promotion discount.

Unfortunately, since your account has been flagged for violation of Uber's Terms of Service we will not be able to honor any promotions on your account.

Though you might have received a notification regarding the on-going promotion, it would only apply on the account when the usage is within these Terms and Conditions.

Appreciate your understanding!
Sent by madapana a. on Saturday, August 12, 2017 at 2:27:44 PM
My query still remains unresolved
Sent by XXXX K. on Saturday, August 12, 2017 at 2:16:53 PM
Hi XXXX

I am afraid I do not have further info as this is a system generated flag with no manual intervention in the process.

Our system is the same across the 300+ cities that we operate in. It flags suspicious accounts and disables the application of promotions on these accounts and in some cases even cuts off access to these accounts.

You will appreciate that these security features need to be built in to prevent misuse of our services and to prevent users from creating accounts for the sole purpose of taking free rides. You might not have had that intention, however, the system cannot differentiate between the two situations and frankly, there really is no way for anyone else to distinguish the two either.

I am afraid I really cannot be of any more help with this than I already have.
Sent by PS on Saturday, August 12, 2017 at 2:15:19 PM
So, what can I do so that your highly advanced system can allow me to use promos that your another advanced system is sending across? I have been using uber regularly. But this irritating attitude will force me to use other better services which will not have such advanced systems creating chaos with the end user.
Sent by XXXX K. on Saturday, August 12, 2017 at 2:13:53 PM
Hi XXXX,

Thanks for letting us know. Happy to help.

I am afraid I do not have further information, as this is a system generated flag with no manual intervention in the process.

Our system is the same across the 300+ cities that we operate in. It flags suspicious accounts and disables the application of promotions on these accounts and in some cases even cuts off access to these accounts.

You will appreciate that these security features need to be built to prevent misuse of our services and to prevent users from creating accounts for the sole purpose of taking free rides. You might not have had that intention, however, the system cannot differentiate between the two situations and frankly, there really is no way for anyone else to distinguish the two either.

I am afraid I really cannot be any more help with this than I already have.
Sent by Bhavana S. on Saturday, August 12, 2017 at 11:45:40 AM
Can you elaborate on this? If the system has disabled promotions, why do I still get offers? Why has the system disabled promotions on my account?
Sent by XXXX K. on Saturday, August 12, 2017 at 11:44:00 AM
Hi XXXX,

I sincerely apologize for the inconvenience caused. I checked your account and it appears that the use of promotions on your account does not comply with Uber's terms and condition. Consequently, the system has disabled promotions on your account.

However, please note that only the use of promotions has been disabled and your account continues to remain in good standing. This means you will be able to request rides as usual.

Appreciate your understanding in this regard.
Sent by Ajaj K. on Saturday, August 12, 2017 at 11:21:30 AM
Share Details : I am unable to use this promo code sent to me. Dear Rider, use code: OCCASIONS if you haven't already & get Rs. 50 off 10 rides on uberGO. Valid only for you, in NCR till Sun, 13 Aug. I get an error that the promo code is invalid.

What happened with ola ?

The above incident got me thinking. Maybe i should give ola a fair chance. So, after being with uber for a long time, I installed ola. And since, i wanted to use the cashless riding promo, I loaded some cash in my ola money. I still don't understand why Ola uses ola money. Why cant they simply integrate with already available wallets like Paytm or Mobikwik or something else.

Upon getting down at the airport, I booked an ola share. Surprisingly, at airport surcharge is always applicable, so you would get uber/ola at 2-3 times the original fare. And I was waiting at the specified pillar hoping that the car will arrive. After 5 minutes, when, i saw that the car is still not moving, I called up the driver and he told me that he is waiting in departures dropoff while I am downstairs at the arrival pickup. And since it may take him a lot of time and money (re-issue of entry ticket) I should come up to him.

So, I climbed up a very long flight for stairs and reached the departure. And sat inside the car. He requested OTP from me and I gave it to him. And he started the ride. Since my majority of my payment was via olamoney, only a very small amount (Rs 70) was coming as cash payment. Here is how the dialogue went.

Driver : You will pay me only 70 for a ride to indirapuram (my destination)
Me : Yes, rest of the payment is cashless via ola money
Driver : I cannot go to indirapuram in only 70 rs
Me : But, I am not paying you. I am paying ola and they have already deducted 700 from my ola money.
Driver : Please get down, I will not go in 70 rs.
Me : Ok.


I got down and called up ola customer care and narrated the incident.

Me : (Narrating the incident)
Customer care : Sir, we are really sorry for the incident. We will talk to the driver partner.
Me : But, why my ola money was deducted at the beginning of the ride ?
Customer care : Sir, I am sending a link via sms. Please click on the link and the money will be credited back instantly.
Me : Ok


I waited for the SMS for 5 minutes and called again. Again repeating the above conversation.

Me : But the last person i spoke to told me that the sms has been sent. I have not received it. Can you resend it ?
Customer care : Sir, i have just resent the SMS. You will receive it shortly.
Me : Ok


Now, I started cursing myself for using cashless mode. And thought of trying airport metro. Always try to avoid metro as it is very crowded. And carrying a backpack into a crowded metro is not very easy. Did not get any SMS, so called again after 10 minutes.

Me : SMS has been sent to me twice, but i have not received it.
Customer care : Sir, i can see that there is a problem with your account which is why the SMS has not gone from our system.
Me (thinking) : Today is a bad day. Even my newly created account is getting flagged. Maybe there is some problem with my name.
Customer care : sir, you will have to wait for 48 hours for the amount to be credited back to your ola money.
Me : Ok. What should I do for 48 hours ? Should I use uber ?
customer care : Sir, you can again load money into your ola money account
Me (thinking) : Do I look like a fool ? What if you do not refund my money even after 48 hours ?
Me : But I do not have any more money to give to ola.
Customer care : Sir, as per the terms and conditions, your money will be credited back in 48 hours ?
Me : Ok


After being stranded for 30 minutes, I am left without any cab or any money. And i am being shown the terms and conditions - which no-one ever reads. To hell with ola. I get out of the airport metro, book an uber and go home. Wrote a strong mail to ola to refund me the money from olamoney to my original account.

But, uber is not perfect

I have had many rides with Uber, and there are 2 instances where I faced major issues. One of which was handled well by Uber.

In the first incident, I was to travel to Gurgaon from Noida. It was raining and the uber driver simply refused to go to such a distant place. Also, he refused to cancel the ride and asked me to do the same. When I cancelled the ride, I was shown a cancellation charge. On talking with Uber, the same was refunded.

Second incident happened when I was in Indonesia. Indonesia has another uber competitor - grab - which surprisingly is a lot better than uber. Prices are extremely low and grab taxis are very easily available. Since, I have been using Uber in India, I thought of using the same in Indonesia. Some driver accepted the ride and called me up. Due to language issues, we were not able to talk and asked the hotel valet to convey our location to the person. After waiting for 10 minutes, the driver cancelled the ride. And i was charged the cancellation fare. Which I came to know a long time later. Though Uber waived off the fare later.

Another issue with Uber is the outstanding fare. Uber would prompt you to pay your previous due when you are at the final stage of booking. This is very inconvenient. An alert about outstanding fares and an easier way to pay it is something I would look forward to.

Verdict
  • Use uber for cashless integration with paytm. If you are unable to use your promo code, Uber thinks you can misuse their system and has flagged you for suspicious activity.
  • Use ola but only via cash. Do not try cashless with ola.
  • Haggle with auto and taxi drivers, if you do not find uber or ola nearby.

Tuesday, January 26, 2016

Build your own in house weather station

We all use a smartphone and most of the smart phones generally have a weather app. Which shows the weather for your city. But do you wonder what would be the weather like inside your house or inside your room? The "in house weather station" monitors the weather inside your house. With its help, you can get a report of what the weather is outside and compare it with the weather inside. Here we are monitoring only two parameters - temerature and humidity. After all the hard work, you would get an output similar to this

Tools :
  • Raspberry pi 2 with raspbian installed
  • DHT22 sensor
  • 10k resistor
  • Male to female jumper wires
  • Breadboard
  • Wires for making breadboard connections
I would not go in depth on how to setup the DHT22 sensor. Here are the instructions that I followed.

http://www.rototron.info/dht22-tutorial-for-raspberry-pi/

I was stuck with the resistor piece as I did not have a 10K resistor. So I added two 6k resistors in series, taking the total resistance to 12k (6k+6k).

Here is how my setup looks

W.r.t the software, I tried using the Adafruit code, but it felt more comfortable using the pigpio code after running the pigpiod daemon. I am still getting some errors when i call the s.cancel() and pi.stop() functions. But the rest of the code works.

To get the external temperature and humidity, I signed up with openweather and got their api. There is a python library pyowm which provides an implementation for openweather. So, I got the humidity and temperature of my city from openweather. And i pushed the data - external humidity & temperature and internal humidity & temperature into elasticsearch which I was running on my raspberry pi.

Looking at the limited resources available on the pi, both in terms of disk and memory, I did some tweaking in elasticsearch, so that It did not hog down my raspberry pi.

I restricted the heap size of elasticsearch to 256MB by adding the following options in the ./bin/elasticsearch script.

ES_HEAP_SIZE=256m
ES_JAVA_OPTS=-server

Since, I had to access my elasicsearch via the raspberry pi's ip address, i changed the host to bind to the ip address instead of localhost. Also, looking at the disk constraints, I limited the number of shards & replicas to 1. Here are the configuration lines in ./config/elasticsearch.yml

network.host: 192.168.1.51
index.number_of_shards: 1
index.number_of_replicas: 1

Here is the script which pulls data from openweather and gets data from my DHT22 sensor and pushes it into elasticsearch.



The interesting thing to note in the graph is that though there is change in the external temperature and humidity, the internal temperature and humidity does not change much.

Saturday, November 28, 2015

Use your smartphone as a GUI display for your pi

With a very simple hack, we can use our smartphone as a GUI display for your raspberry pi. This can work over remotely and there is not HDMI or any other connector required to connect your smartphone to your pi.

There are a few apps that you would require on your smartphone. Download and install

Xserver XSDL
Connectbot

Xserver XSDL is a xserver which can be run on your smartphone. Whereas connectbot is a simple ssh client for connecting to your raspberry pi via ssh. The trick here is to run the Xserver on your smartphone. Ssh to your pi and tell your pi to forward the display to the Xserver running on your smartphone.

Let us see the configurations that need to be verified on the pi. Ssh to your raspberry pi over the network and check the following configuration options in these files.

/etc/ssh/sshd_config

AllowTcpForwarding yes
X11Forwarding yes
X11DisplayOffset 10



/etc/ssh/ssh_config

ForwardX11 yes
ForwardX11Trusted yes

If these configuration options are commented out, simply uncomment them. Else add them and restart your ssh server on your pi.

$ sudo service ssh restart

Now start the app Xserver XSDL on your smart phone. It may download a set of fonts and will then ask you to run some commands on your linux PC. The Xserver starts running on port 6000. Now, we need to forward the display of pi to our smartphone.

Go back to the ssh connection on your smartphone and run these commands.

$ export DISPLAY=192.168.1.37:0           
$ export PULSE_SERVER=tcp:192.168.1.37:6000


My smartphone is running on the ip 192.168.1.37. And i am forwarding the display directly to the Xserver running on port 6000.
This is insecure as the port forwarding is not happening over ssh but directly from the pi to the smartphone. But if you are on a local network, it should not matter.

Now simply start your lxde desktop environment on the ssh connection. Execute the following command on the ssh connection.

$ startlxde

And bingo...


It is not very comfortable for working as the mouse pointer is difficult to catch and click. But if you have an old smartphone or tablet lying around, you can use it as a display - running a smart photo frame or a hanging smart calendar.

Monday, November 09, 2015

Script to update godaddy dns A record

Recently, I have setup my raspberry pi as a download machine. The aim was to be able to access the machine from anywhere and be able to add files to download. Now, since the machine is connected via airtel broadband, it is bound to go down and come up as and when the electricity in my location does.

Everytime, when the machine came up, i would be having a different public ip address to access the machine as my ADSL modem+router would also go down.

At first, i setup a cron to be run at boot time which would give me the public ip address.

The corresponding cron entry is
@reboot /home/pi/progs/godaddy.py

I also created a dns entry to access the machine. And then wrote a script to update the dns record in godaddy whenever the machine reboots. Here is the script.

Now whenever my pi reboots, it checks and updates the corresponding DNS record at godaddy. And i can ssh my machine from anywhere.

Tuesday, January 20, 2015

Ecommerce review : Amazon.in shopping experience

I use ecommerce extensively. All my stuff - from clothes to shoes to electronics to groceries are delivered to my doorstep. The good point about ecommerce is that it saves you from the headache of driving down to the store, parking, standing in a queue to pay for your purchase, and hauling the stuff back to your place. And I use multiple shopping sites for getting my stuff:
Flipkart for books & electronics
Firstcry for diapers & other stuff for kids
Zovi, jabong, myntra in order of preference for clothes and shoes
Peopleeasy for groceries.

I try to avoid shopping on amazon. Reason being that the delivery times are too long. Also there is no quality control from amazon. My last order from amazon was a pair of school shoes for my kid which were defective. Since it was not "fulfilled by amazon" the only option I had was to send it back by a courier and wait for 15-30 days for a refund or go to a nearby cobbler and get the defect fixed. I chose the later. It costed me an additional amount, but saved me from the hassles of refund and re-order.

After that experience, I decided that the only option why I would order from amazon was when the product will be "amazon fulfilled".

I was looking for a coffee maker and found one on flipkart. But flipkart will not deliver it to my pin code. I have never tried snapdeal or paytm but have heard first hand horror stories from people who have used it. The only option was amazon which had the exact model that I was looking for and that too with the "amazon fulfilled" label. The delivery time was 10 days, but still I went ahead and ordered. I still cannot figure out why it takes 10 days for amazon to deliver while flipkart delivers in 3-4 days. And zovi & jabong deliver in 1-2 days. Zovi delivers from bangalore and that too in 2 days max.

When I got a mail that my package has been dispatched by india post, I was a bit astonished. What role does india post play in amazon fulfilled orders. I believe it is the cheapest option. But has service and reliability issues. I kept a track of the package on india post web site as amazon did not update the tracking details on its website frequently.

Finally after 7 days the package arrived in the post office nearest to me. I was hoping that I will get the order the next day. But what happened the next day shook my perception of e-commerce.

I got a call from the post office asking me to pick up the package from there. I was like - what??? And the person on the other end said that it is too big for him to deliver and cut off the phone. I connected up with amazon customer support and was given the assurance that I will get the package on my doorstep next day. Here is the actual conversation:

10:00 AM IST Amazon(Amazon): Thanks for contacting Amazon.in customer service. 
My name is Vijay. 
10:00 AM IST Jayant kumar : hi Vijay, 
10:00 AM IST Amazon(Amazon): Hi! Jayant 
10:01 AM IST Jayant kumar : i got a call from india post telling me that my package is at their facility and i have to pick it up ...
If i have to go out pick up a package, then why order online, wait for 15 days and then pick it up
i can simply go out and buy it from a store
10:02 AM IST Jayant kumar : is this what you call e-shopping ?
10:02 AM IST Amazon(Amazon): I really do apologize for the inconvenience this may have caused you.
10:02 AM IST Jayant kumar : Also, please let me know why this order is being delivered by india post, instead of amazon ?
10:02 AM IST Amazon(Amazon): Let me check what best I can do for you.
10:03 AM IST Amazon(Amazon): I will surely let you know about the same.
10:03 AM IST Jayant kumar : i ordered it because it said that this will be fulfilled by amazon
10:04 AM IST Amazon(Amazon): Jayant, I really appreciate for doing business with us.
10:04 AM IST Jayant kumar : and not india post - the worst courier service in the country
10:05 AM IST Amazon(Amazon): I have contacted the courier partner and have instructed them to deliver to your door step.
10:05 AM IST Jayant kumar : I was told that since the package is "big" it may be broken if delivered to my door step
in case the package is broken, i hope amazon will take it back...
10:06 AM IST Amazon(Amazon): And regarding the courier partner, it is automatically selected by the system and we do not have the option to select the same. 
But we try to dispatch through Amazon service as much as we can.
10:07 AM IST Jayant kumar : Since this package is fulfilled by amazon, please explain how?
10:07 AM IST Amazon(Amazon): Related to broken item, we assure you it will be taken back in such scenarios and will issue a full refund.
10:08 AM IST Jayant kumar : so, fulfilled by amazon does not mean amazon delivery service ?
10:09 AM IST Amazon(Amazon): Amazon Fulfilled guarantees the product to be in a perfect condition and also assures if any defects found customer can return it back within the return window and we will issue a full refund.
10:10 AM IST Amazon(Amazon): But, as I have stated earlier the courier does get selected automatically by the system.
10:10 AM IST Jayant kumar : ok
so, will this be delivered today ?
10:11 AM IST Jayant kumar : since it is at the hub nearest to my place?
10:11 AM IST Amazon(Amazon): I have contacted the courier for the delivery as soon as possible.
10:12 AM IST Jayant kumar : thanks
10:12 AM IST Amazon(Amazon): You are most welcome Jayant.
Is there anything else I may assist you with?
10:13 AM IST Jayant kumar : no
10:13 AM IST Amazon(Amazon): It was a pleasure assisting a valued customer as you.
Hope to see you soon.
10:13 AM IST Jayant kumar : looking forward to ordering more with confidence from amazon
10:13 AM IST Amazon(Amazon): Thank you for contacting Amazon Customer Service.
Have a Wonderful time and day ahead.
10:14 AM IST Amazon(Amazon): I assure, you will not face any such issue in the future. 

Note the final line - I was hoping that this problem is now resolved and was looking forward to the package.

What happened the next day is that in the morning, I got a call from the postman. Again asking me to come and collect the package. It seems that amazon customer service did not take any action on the issue raised by me and has given me false assurance. The two options available to me were to either cancel the order and wait for refund and go out and purchase from the market or go ahead and pick the package from india post. I chose the later - being the easier option of the two. The reason given by the postman was genuine that he cannot deliver a big package on his cycle to which I could not come up with a counter argument.

I was told that the post office opens from 10 am to 5 pm and knowing how government officials work - allowing them their tea, lunch and other breaks, I planned to visit the post office around 3 pm. When they would be done with their lunch and after lunch chit chat. When I reached there, I had to enquire around 4-5 people but was not able to trace where my package was. Everyone was busy doing their own work. So, I called up the postman and told him to connect me to the person who can locate and hand over the package to me. Finally after asking everyone's name and making the person talk with the postman, I was able to take delivery of the package.

So, there is me now carrying 2 big boxes in front of me from the post office to the car and from the car to my flat. All the while people staring at the amazon.in label on the boxes I am carrying and trying to figure if I am the guy who delivers for amazon. They must be figuring the ad of amazon where the delivery guy delivers the package with a smile. I, on the other hand was only concerned if I would encounter anyone who has faced similar fate by amazon and try to engage my as an amazon employee.

By luck the products were ok. I have no idea what will happen if I had to opt for an exchange or refund. If delivery is suoh a hassle, refund / exchange can be non existent. Also I cannot figure out how amazon plans to compete with other sites. When even small sites like zovi outsmart amazon on delivery. I would not be ordering from amazon till I hear some positive reviews.

Tuesday, September 09, 2014

gitlab hooks and disabling forced push

For people who do not know much about gitlab, it is a "github" equivalent with the possibility of deployment in a local network. Which means, that if your organization is not comfortable of pushing code to an external website like github, you can get all the features that github provides in your local environment.

The installation of gitlab is not an easy process. If you have an ubuntu-type system, you can get a .deb file and simply install it. Else installation is a very tedius task.

After installation and deployment, the first task that you would think about doing is to write some hooks for putting some restrictions and sanitizing the code moving into the different git repos. The trick to enable hooks in gitlab is to modify the "gitlab-shell/hooks/update" file.

On an ubuntu installation, the file can be found in the following folder

/opt/gitlab/embedded/service/gitlab-shell/hooks

But, if you have followed the installation notes - https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md as in the documents, the update file is found in

/home/git/gitlab-shell/hooks

The "update" file is written in ruby. In order to abort a push, we need to exit with a "1" status. Let us create a very simple hook to disable all deletes. Add the following lines to the "update" after the line "require_relative"

require_relative '../lib/gitlab_update'

oldhash = ARGV[1]
newhash = ARGV[2]

cmd = "git cat-file -t #{newhash}"
action = IO.popen(cmd).read

if action == "delete"
    puts "deletes are not allowed"
    exit 1
end

For each push, gitlab's update script receives the old commit hash and the new commit hash. using the "git cat-file" command we are getting the action / method performed. And then we are comparing it with the "delete" string to identify if it is a delete. We are exiting with a "1" to disable a push.

We can also write another hook to disable forced push. But it is easier to modify the "gitlab-shell/lib/gitlab_update.rb" to disable forced push. There is a function here which identifies if this is a forced push. To check forced push simply call this function inside the "exec" function. Here is the code that i added to the "exec" function to disable forced push.

 def exec
    # reset GL_ID env since we already
    # get value from it
    ENV['GL_ID'] = nil

    if forced_push?
      puts "Forced push now allowed!"
      exit 1
    end
......
end

Tuesday, April 01, 2014

Auto failover of mysql master in mysql multi-master multi-slave cluster

This post is an extension to my earlier posts about multi master replication cluster multi master replication in mysql and mysql multi master replication act II The problem I had encountered and discussed was with automatic failover. What happens when the master goes down? How can either a slave or another master be promoted to become the master? Once the settings are done on all the mysql dbs in the cluster to identify the new master, we will also have to change our app to point to the new master.

Let us look at the auto failover part from the mysql cluster point of view. The tool that we are going to use is mysql master ha. It is a tool written by http://yoshinorimatsunobu.blogspot.com/ and has been in place for quite some time now. The tool supports failover in a master-master scenario, but the master-master setup has to be an active-passive(read only) setup. One of the master mysql servers has to be in read only mode. It does not support active-active mysql master-master setup where both masters are handling writes. In order to make a mysql slave read-only, simply enter "read_only" in its my.cnf file.

The mysql version I am using here is mysql 5.6.17. I have created a mysql cluster with 4 nodes.

M1(RW)--->S1
 |
 |
M2(RO)--->S2

M1 and M2 are 2 masters running on ports 3311 & 3312. S1 is a slave running on port 3313 and replicates from master M1. S2 is another slave running on port 3314 and replicates from master M2. Remember, in mysql 5.6, an additional variable has been incorporated known as the server-uuid. This has to be different for all mysql servers in the mysql cluster. So if you are replicating by copying the data directory, simply remove the auto.cnf file, which contains the server-uuid and mysql will create a new uuid when it starts. In order to make M2 read only slave, I have to put the following parameter in its my.cnf file.

read_only

Download the mysql-master-ha tool from https://code.google.com/p/mysql-master-ha/downloads/list. I am using the following version.

mha4mysql-manager-0.55.tar.gz
mha4mysql-node-0.54.tar.gz


untar the mha4mysql-node archive first and install it.

mha4mysql-node-0.54$ perl Makefile.PL
*** Module::AutoInstall version 1.03
*** Checking for Perl dependencies...
[Core Features]
- DBI        ...loaded. (1.63)
- DBD::mysql ...loaded. (4.025)
*** Module::AutoInstall configuration finished.
Writing Makefile for mha4mysql::node
Writing MYMETA.yml and MYMETA.json

mha4mysql-node-0.54$ make
mha4mysql-node-0.54$ sudo make install


Next install the mha4mysql-manager.

mha4mysql-manager-0.55$ perl Makefile.PL
*** Module::AutoInstall version 1.03
*** Checking for Perl dependencies...
[Core Features]
- DBI                   ...loaded. (1.63)
- DBD::mysql            ...loaded. (4.025)
- Time::HiRes           ...loaded. (1.9725)
- Config::Tiny          ...loaded. (2.20)
- Log::Dispatch         ...loaded. (2.41)
- Parallel::ForkManager ...loaded. (1.06)
- MHA::NodeConst        ...loaded. (0.54)
*** Module::AutoInstall configuration finished.
Writing Makefile for mha4mysql::manager
Writing MYMETA.yml and MYMETA.json

mha4mysql-manager-0.55$ make
mha4mysql-manager-0.55$ sudo make install


Watch out for errors. Once the tool is installed, we need to create a configuration file for the cluster. Here is the configuration file - app1.cnf.

[server default]
multi_tier_slave=1
manager_workdir=/home/jayantk/log/masterha/app1
manager_log=/home/jayantk/log/masterha/app1/manager.log

[server1]
hostname=127.0.0.1
candidate_master=1
port=3311
user=root
ssh_user=jayantk
master_binlog_dir=/home/jayantk/mysql-5.6.17/data1

[server2]
hostname=127.0.0.1
candidate_master=1
port=3312
user=root
ssh_user=jayantk
master_binlog_dir=/home/jayantk/mysql-5.6.17/data2

[server3]
hostname=127.0.0.1
port=3313
user=root
ssh_user=jayantk
master_binlog_dir=/home/jayantk/mysql-5.6.17/data3

[server4]
hostname=127.0.0.1
port=3314
user=root
ssh_user=jayantk
master_binlog_dir=/home/jayantk/mysql-5.6.17/data4



Let us go through it and understand what is happening. "multi_tier_slave" is a parameter used for specifying that the mysql cluster is a multi-master and multi-slave cluster where each master can have its own slave. If the parameter is not specified, mha will give an error. Next we specify the working directory and log file for mha manager. Then we start specifying each of our servers with the host name and port. We have to specify the root username and password for each of our mysql servers. The parameters are "user" and "password". I have not specified password for my mysql servers and so do not have that parameter in my configuration file. The parameter "candidate_master" is used to prioritize a certain mysql server as a master candidate during failover. In our case, we are prioritizing server2 (M2) as the master. Finally mha needs ssh access to the machines running our mysql servers. I have specified the ssh username to be used for ssh as "ssh_user". And have enabled ssh public key authentication without pass phrase for the machines (127.0.0.1 in my case). The parameter "master_binlog_dir" is used if the dead master mysql is reachable via ssh to copy any pending binary log events. This is required because there is no information with slave about where the binary log files are located.

Another thing to remember is to grant "replication slave" to all other mysql servers on the network from each mysql server in the cluster - irrespective of whether it is a master or a slave. In my case, I had to run the following grant statement on all my mysql servers - M1, M2, S1 and S2.

grant replication slave on *.* to  slave_user@localhost identified by 'slave_pwd';

Once all the settings are in place, run the command

masterha_check_repl --conf=app1.cnf

It will output a lot of messages ending with

"MySQL Replication Health is OK."


Which means that the configuration is a success. In case of errors, check the wiki at https://code.google.com/p/mysql-master-ha/wiki/TableOfContents for solutions and missing parameters.

To start the masterha manager, run the following command

masterha_manager --conf=app1.cnf

In order to check the status of the mha manager script, go to the log directory - in our case - /home/jayantk/log/masterha/app1. It has a file specifying the health status. You can cat the file to see the health status.

~/log/masterha/app1$ cat app1.master_status.health
9100    0:PING_OK    master:127.0.0.1


Another file is the log file - manager.log - which will give the following output as tail.

Tue Apr  1 12:20:50 2014 - [warning] master_ip_failover_script is not defined.
Tue Apr  1 12:20:50 2014 - [warning] shutdown_script is not defined.
Tue Apr  1 12:20:50 2014 - [info] Set master ping interval 3 seconds.
Tue Apr  1 12:20:50 2014 - [warning] secondary_check_script is not defined. It is highly recommended setting it to check master reachability from two or more routes.
Tue Apr  1 12:20:50 2014 - [info] Starting ping health check on 127.0.0.1(127.0.0.1:3311)..
Tue Apr  1 12:20:50 2014 - [info] Ping(SELECT) succeeded, waiting until MySQL doesn't respond..


The mha manager will keep on pinging the master every 3 seconds to see if it is alive or not. The ping interval time can be changed by specifying the parameter "ping_interval" in the application configuration. Failover is triggered after missing 3 pings to the master. So if ping_interval is 3 seconds, the maximum time to discover that the master mysql is down is 12 seconds.

Now, lets kill the master and see what happens. Find out the pid of the mysqld process and kill it. It is automatically restarted by the parent process "mysqld_safe". Here is what we get in out manager.log file.

140401 12:34:12 mysqld_safe Number of processes running now: 0
140401 12:34:12 mysqld_safe mysqld restarted
Tue Apr  1 12:34:14 2014 - [warning] Got error on MySQL select ping: 2006 (MySQL server has gone away)
Tue Apr  1 12:34:14 2014 - [info] Executing SSH check script: save_binary_logs --command=test --start_pos=4 --binlog_dir=/home/jayantk/mysql-5.6.17/data1 --output_file=/var/tmp/save_binary_logs_test --manager_version=0.55 --binlog_prefix=zdev-bin
Tue Apr  1 12:34:15 2014 - [info] HealthCheck: SSH to 127.0.0.1 is reachable.
Tue Apr  1 12:34:17 2014 - [info] Ping(SELECT) succeeded, waiting until MySQL doesn't respond..


It tires to do an ssh and check if the machine is reachable. But in the meantime the machine is back up an ping is available, so nothing happens. As a next step, lets kill both parent "mysqld_safe" and "mysqld" processes associated with the master mysql server in that sequence. Let us see what happens in the manager.log file. There are a lot of log entires here.


Tue Apr  1 12:44:23 2014 - [warning] Got error on MySQL select ping: 2006 (MySQL server has gone away)
...
Tue Apr  1 12:44:26 2014 - [warning] Got error on MySQL connect: 2003 (Can't connect to MySQL server on '127.0.0.1' (111))
Tue Apr  1 12:44:26 2014 - [warning] Connection failed 1 time(s)..
Tue Apr  1 12:44:29 2014 - [warning] Got error on MySQL connect: 2003 (Can't connect to MySQL server on '127.0.0.1' (111))
Tue Apr  1 12:44:29 2014 - [warning] Connection failed 2 time(s)..
Tue Apr  1 12:44:32 2014 - [warning] Got error on MySQL connect: 2003 (Can't connect to MySQL server on '127.0.0.1' (111))
Tue Apr  1 12:44:32 2014 - [warning] Connection failed 3 time(s)..
Tue Apr  1 12:44:32 2014 - [warning] Master is not reachable from health checker!
...
Tue Apr  1 12:44:32 2014 - [info] Multi-master configuration is detected. Current primary(writable) master is 127.0.0.1(127.0.0.1:3311)
Tue Apr  1 12:44:32 2014 - [info] Master configurations are as below:
Master 127.0.0.1(127.0.0.1:3312), replicating from localhost(127.0.0.1:3311), read-only
Master 127.0.0.1(127.0.0.1:3311), dead
...
...
Tue Apr  1 12:44:32 2014 - [info] * Phase 1: Configuration Check Phase..
Tue Apr  1 12:44:32 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info] Multi-master configuration is detected. Current primary(writable) master is 127.0.0.1(127.0.0.1:3311)
Tue Apr  1 12:44:33 2014 - [info] Master configurations are as below:
Master 127.0.0.1(127.0.0.1:3311), dead
Master 127.0.0.1(127.0.0.1:3312), replicating from localhost(127.0.0.1:3311), read-only

Tue Apr  1 12:44:33 2014 - [info] Dead Servers:
Tue Apr  1 12:44:33 2014 - [info]   127.0.0.1(127.0.0.1:3311)
Tue Apr  1 12:44:33 2014 - [info] Checking master reachability via mysql(double check)..
Tue Apr  1 12:44:33 2014 - [info]  ok.
Tue Apr  1 12:44:33 2014 - [info] Alive Servers:
Tue Apr  1 12:44:33 2014 - [info]   127.0.0.1(127.0.0.1:3312)
Tue Apr  1 12:44:33 2014 - [info]   127.0.0.1(127.0.0.1:3313)
Tue Apr  1 12:44:33 2014 - [info] Alive Slaves:
Tue Apr  1 12:44:33 2014 - [info]   127.0.0.1(127.0.0.1:3312)  Version=5.6.17-log (oldest major version between slaves) log-bin:enabled
Tue Apr  1 12:44:33 2014 - [info]     Replicating from localhost(127.0.0.1:3311)
Tue Apr  1 12:44:33 2014 - [info]     Primary candidate for the new Master (candidate_master is set)
Tue Apr  1 12:44:33 2014 - [info]   127.0.0.1(127.0.0.1:3313)  Version=5.6.17-log (oldest major version between slaves) log-bin:enabled
Tue Apr  1 12:44:33 2014 - [info]     Replicating from localhost(127.0.0.1:3311)
Tue Apr  1 12:44:33 2014 - [info] Unmanaged Servers:
Tue Apr  1 12:44:33 2014 - [info]   127.0.0.1(127.0.0.1:3314)  Version=5.6.17-log (oldest major version between slaves) log-bin:enabled
Tue Apr  1 12:44:33 2014 - [info]     Replicating from localhost(127.0.0.1:3312)
Tue Apr  1 12:44:33 2014 - [info] ** Phase 1: Configuration Check Phase completed.
Tue Apr  1 12:44:33 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info] * Phase 2: Dead Master Shutdown Phase..
Tue Apr  1 12:44:33 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info] Forcing shutdown so that applications never connect to the current master..
...
Tue Apr  1 12:44:33 2014 - [info] * Phase 2: Dead Master Shutdown Phase completed.
Tue Apr  1 12:44:33 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info] * Phase 3: Master Recovery Phase..
Tue Apr  1 12:44:33 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info] * Phase 3.1: Getting Latest Slaves Phase..
Tue Apr  1 12:44:33 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info] The latest binary log file/position on all slaves is zdev-bin.000009:120
Tue Apr  1 12:44:33 2014 - [info] Latest slaves (Slaves that received relay log files to the latest):
Tue Apr  1 12:44:33 2014 - [info]   127.0.0.1(127.0.0.1:3312)  Version=5.6.17-log (oldest major version between slaves) log-bin:enabled
Tue Apr  1 12:44:33 2014 - [info]     Replicating from localhost(127.0.0.1:3311)
Tue Apr  1 12:44:33 2014 - [info]     Primary candidate for the new Master (candidate_master is set)
Tue Apr  1 12:44:33 2014 - [info]   127.0.0.1(127.0.0.1:3313)  Version=5.6.17-log (oldest major version between slaves) log-bin:enabled
Tue Apr  1 12:44:33 2014 - [info]     Replicating from localhost(127.0.0.1:3311)
Tue Apr  1 12:44:33 2014 - [info] The oldest binary log file/position on all slaves is zdev-bin.000009:120
Tue Apr  1 12:44:33 2014 - [info] Oldest slaves:
Tue Apr  1 12:44:33 2014 - [info]   127.0.0.1(127.0.0.1:3312)  Version=5.6.17-log (oldest major version between slaves) log-bin:enabled
Tue Apr  1 12:44:33 2014 - [info]     Replicating from localhost(127.0.0.1:3311)
Tue Apr  1 12:44:33 2014 - [info]     Primary candidate for the new Master (candidate_master is set)
Tue Apr  1 12:44:33 2014 - [info]   127.0.0.1(127.0.0.1:3313)  Version=5.6.17-log (oldest major version between slaves) log-bin:enabled
Tue Apr  1 12:44:33 2014 - [info]     Replicating from localhost(127.0.0.1:3311)
Tue Apr  1 12:44:33 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info] * Phase 3.2: Saving Dead Master's Binlog Phase..
Tue Apr  1 12:44:33 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info] Fetching dead master's binary logs..
...
Tue Apr  1 12:44:33 2014 - [info] Additional events were not found from the orig master. No need to save.
Tue Apr  1 12:44:33 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info] * Phase 3.3: Determining New Master Phase..
Tue Apr  1 12:44:33 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info] Finding the latest slave that has all relay logs for recovering other slaves..
Tue Apr  1 12:44:33 2014 - [info] All slaves received relay logs to the same position. No need to resync each other.
Tue Apr  1 12:44:33 2014 - [info] Searching new master from slaves..
Tue Apr  1 12:44:33 2014 - [info]  Candidate masters from the configuration file:
Tue Apr  1 12:44:33 2014 - [info]   127.0.0.1(127.0.0.1:3312)  Version=5.6.17-log (oldest major version between slaves) log-bin:enabled
Tue Apr  1 12:44:33 2014 - [info]     Replicating from localhost(127.0.0.1:3311)
Tue Apr  1 12:44:33 2014 - [info]     Primary candidate for the new Master (candidate_master is set)
...
Tue Apr  1 12:44:33 2014 - [info] New master is 127.0.0.1(127.0.0.1:3312)
Tue Apr  1 12:44:33 2014 - [info] Starting master failover..
Tue Apr  1 12:44:33 2014 - [info]
From:
127.0.0.1 (current master)
 +--127.0.0.1
 +--127.0.0.1

To:
127.0.0.1 (new master)
 +--127.0.0.1
Tue Apr  1 12:44:33 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info] * Phase 3.3: New Master Diff Log Generation Phase..
Tue Apr  1 12:44:33 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info]  This server has all relay logs. No need to generate diff files from the latest slave.
Tue Apr  1 12:44:33 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info] * Phase 3.4: Master Log Apply Phase..
Tue Apr  1 12:44:33 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info] *NOTICE: If any error happens from this phase, manual recovery is needed.
Tue Apr  1 12:44:33 2014 - [info] Starting recovery on 127.0.0.1(127.0.0.1:3312)..
Tue Apr  1 12:44:33 2014 - [info]  This server has all relay logs. Waiting all logs to be applied..
Tue Apr  1 12:44:33 2014 - [info]   done.
Tue Apr  1 12:44:33 2014 - [info]  All relay logs were successfully applied.
Tue Apr  1 12:44:33 2014 - [info] Getting new master's binlog name and position..
Tue Apr  1 12:44:33 2014 - [info]  zdev-bin.000009:797
Tue Apr  1 12:44:33 2014 - [info]  All other slaves should start replication from here. Statement should be: CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=3312, MASTER_LOG_FILE='zdev-bin.000009', MASTER_LOG_POS=797, MASTER_USER='slave_user', MASTER_PASSWORD='xxx';
Tue Apr  1 12:44:33 2014 - [warning] master_ip_failover_script is not set. Skipping taking over new master ip address.
Tue Apr  1 12:44:33 2014 - [info] Setting read_only=0 on 127.0.0.1(127.0.0.1:3312)..
Tue Apr  1 12:44:33 2014 - [info]  ok.
Tue Apr  1 12:44:33 2014 - [info] ** Finished master recovery successfully.
Tue Apr  1 12:44:33 2014 - [info] * Phase 3: Master Recovery Phase completed.
Tue Apr  1 12:44:33 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info] * Phase 4: Slaves Recovery Phase..
Tue Apr  1 12:44:33 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info] * Phase 4.1: Starting Parallel Slave Diff Log Generation Phase..
Tue Apr  1 12:44:33 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info] -- Slave diff file generation on host 127.0.0.1(127.0.0.1:3313) started, pid: 10586. Check tmp log /home/jayantk/log/masterha/app1/127.0.0.1_3313_20140401124432.log if it takes time..
Tue Apr  1 12:44:33 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info] Log messages from 127.0.0.1 ...
Tue Apr  1 12:44:33 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info]  This server has all relay logs. No need to generate diff files from the latest slave.
Tue Apr  1 12:44:33 2014 - [info] End of log messages from 127.0.0.1.
Tue Apr  1 12:44:33 2014 - [info] -- 127.0.0.1(127.0.0.1:3313) has the latest relay log events.
Tue Apr  1 12:44:33 2014 - [info] Generating relay diff files from the latest slave succeeded.
Tue Apr  1 12:44:33 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info] * Phase 4.2: Starting Parallel Slave Log Apply Phase..
Tue Apr  1 12:44:33 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info] -- Slave recovery on host 127.0.0.1(127.0.0.1:3313) started, pid: 10588. Check tmp log /home/jayantk/log/masterha/app1/127.0.0.1_3313_20140401124432.log if it takes time..
Tue Apr  1 12:44:33 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info] Log messages from 127.0.0.1 ...
Tue Apr  1 12:44:33 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info] Starting recovery on 127.0.0.1(127.0.0.1:3313)..
Tue Apr  1 12:44:33 2014 - [info]  This server has all relay logs. Waiting all logs to be applied..
Tue Apr  1 12:44:33 2014 - [info]   done.
Tue Apr  1 12:44:33 2014 - [info]  All relay logs were successfully applied.
Tue Apr  1 12:44:33 2014 - [info]  Resetting slave 127.0.0.1(127.0.0.1:3313) and starting replication from the new master 127.0.0.1(127.0.0.1:3312)..
Tue Apr  1 12:44:33 2014 - [info]  Executed CHANGE MASTER.
Tue Apr  1 12:44:33 2014 - [info]  Slave started.
Tue Apr  1 12:44:33 2014 - [info] End of log messages from 127.0.0.1.
Tue Apr  1 12:44:33 2014 - [info] -- Slave recovery on host 127.0.0.1(127.0.0.1:3313) succeeded.
Tue Apr  1 12:44:33 2014 - [info] All new slave servers recovered successfully.
Tue Apr  1 12:44:33 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info] * Phase 5: New master cleanup phase..
Tue Apr  1 12:44:33 2014 - [info]
Tue Apr  1 12:44:33 2014 - [info] Resetting slave info on the new master..
Tue Apr  1 12:44:33 2014 - [info]  127.0.0.1: Resetting slave info succeeded.
Tue Apr  1 12:44:33 2014 - [info] Master failover to 127.0.0.1(127.0.0.1:3312) completed successfully.
Tue Apr  1 12:44:33 2014 - [info]

----- Failover Report -----

app1: MySQL Master failover 127.0.0.1 to 127.0.0.1 succeeded

Master 127.0.0.1 is down!

Check MHA Manager logs at zdev.net:/home/jayantk/log/masterha/app1/manager.log for details.

Started automated(non-interactive) failover.
The latest slave 127.0.0.1(127.0.0.1:3312) has all relay logs for recovery.
Selected 127.0.0.1 as a new master.
127.0.0.1: OK: Applying all logs succeeded.
127.0.0.1: This host has the latest relay log events.
Generating relay diff files from the latest slave succeeded.
127.0.0.1: OK: Applying all logs succeeded. Slave started, replicating from 127.0.0.1.
127.0.0.1: Resetting slave info succeeded.
Master failover to 127.0.0.1(127.0.0.1:3312) completed successfully.



So eventually what has happened is that the following mysql cluster is now in place

M2(RW) ---> S2
   |
   |
  V
  S1

We can log into each of the mysql servers and verify the same. So, the failover happened. There are a few problems with this solution.

  1. Now that M2 is the master, we will have to change our application to make M2 as master instead of M1. So all inserts start happening on M2. An easier way to do this is to use an HA solution known as Pacemaker which will take over the virtual ip of the master M1 and assign it to the new master M2. Another way is to change the script on all app servers and swap the ip of M1 with that of M2. This is handled by the "master_ip_failover_script" which can be configured to handle either scenario. More details on configuring the same is available here - https://code.google.com/p/mysql-master-ha/wiki/Parameters#master_ip_failover_script 
  2. The purpose of Master-Master mysql replication is lost when failover happens. Master-Master replication allows the possibility of easy switching of the app between two masters. It is even possible to write to certain databases on M1 and other databases on M2. But with this solution, firstly M2 has to be read-only, which is only acting as a slave. Secondly, after the failover, M2 loses all information which makes it a slave of M1. So, after M1 comes back up, it cannot be put into circular replication as before.
  3. The script does not handle slave failover. So it is expected that each master will have multiple slaves and the failover of slaves should be handled separately. If a mysql slave server goes down, the application should be able to identify the same and not use that particular slave server for queries. Also if mha is monitoring the mysql servers and one of the slaves goes down (undetected), and then the master mysql fails, it may not be able to make the failover.
  4. And finally, after the failover happens the script simply exits. It does not update the mha configuration file. So, multiple failovers cannot be handled. In order to start it again, we will have to manually change the configuration file and start the mha manager script again.
But, inspite of the limitations of the script, I believe it can be used in majority of the cases. And provides a good solution to mysql master failover.