Suman
Suman

Reputation: 9561

Troubleshooting HBase batch puts

Is it possible to troubleshoot HBase batch puts? I'm using HBase batch puts of 5000 records at a time, and I would like to, on put failure, find out which row or rows is causing a problem and to log it.

Upvotes: 1

Views: 393

Answers (1)

Asaf Mesika
Asaf Mesika

Reputation: 1670

The method HTable.batch(List actions) receives a list of Puts and returns an array in the same size of actions list (your puts list you gave to the function). If actions(i) failed, then the result[i] will be null.

Please note that when the failure inside batch() is due to maximum number of attempts to write, you need to catch RetriesExhaustedWithDetailsException, and call getExceptions(), to get the array which contains the mapping of the error to the put causing it.

See code here

Upvotes: 1

Related Questions