HappyBase and Atomic Batch Inserts for HBase
Question: With the HappyBase API for HBase in Python, a batch insert can be performed by
the following:

    
    
    import happybase
    connection = happybase.Connection()
    table = connection.table('table-name')
    batch = table.batch()
    # put several rows to this batch via batch.put()
    batch.send()
    

What would happen in the event this batch failed half way through? Would the
rows that had been saved remain saved and those that didn't not be saved?

I noted in the HappyBase github that the `table.batch()` method takes
`transaction` and `wal` as parameters. Could these be configured in such a way
as to rollback the successfully saved rows in the event the batch fails
halfway through?

Will happybase throw an exception here, which would permit me to take note of
the row keys and perform a batch delete?


Answer: I did not know about python or happybase. I understand that transaction is
implemented in library as a fallback strategy. Since Hbase does not have any
transaction support besides in-row mutations, a library can only simulate
transaction by rolling back the operation it just did. I think this Batch
class in code does this.

    
    
        The `transaction` argument specifies whether the returned
        :py:class:`Batch` instance should act in a transaction-like manner when
        used as context manager in a ``with`` block of code. The `transaction`
        flag cannot be used in combination with `batch_size`.
        The `wal` argument determines whether mutations should be
        written to the HBase Write Ahead Log (WAL). This flag can only
        be used with recent HBase versions. If specified, it provides
        a default for all the put and delete operations on this batch.
    

<https://github.com/wbolster/happybase/blob/master/happybase/table.py> line
460-480

Also wal is a kind of performance parameter. It is faster if an operation is
not written to WAL. From hbase doc ;

> Turning this off means that the RegionServer will not write the Put to the
> Write Ahead Log, only into the memstore, HOWEVER the consequence is that if
> there is a RegionServer failure there will be data loss.

<http://hbase.apache.org/0.94/book/perf.writing.html> section 11.7.5

