Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Plain View
HBase >> mail # user >> Overwrite a row


+
Kristoffer Sjögren 2013-04-19, 17:53
+
Ted Yu 2013-04-19, 18:32
+
Kristoffer Sjögren 2013-04-19, 19:44
+
Ted Yu 2013-04-19, 21:21
+
Mohamed Ibrahim 2013-04-19, 18:11
+
Mohamed Ibrahim 2013-04-19, 20:35
+
Mohamed Ibrahim 2013-04-19, 20:41
+
Ted Yu 2013-04-20, 02:47
+
Kristoffer Sjögren 2013-04-20, 07:17
+
Ted Yu 2013-04-20, 12:42
+
Kristoffer Sjögren 2013-04-20, 17:11
+
Ted Yu 2013-04-21, 00:25
Copy link to this message
-
Re: Overwrite a row
You can use MultiRowMutationEndpoint for atomic op on multiple rows (within
same region)..
On Sun, Apr 21, 2013 at 5:55 AM, Ted Yu <[EMAIL PROTECTED]> wrote:

> Here is code from 0.94 code base:
>
>   public void mutateRow(final RowMutations rm) throws IOException {
>     new ServerCallable<Void>(connection, tableName, rm.getRow(),
>         operationTimeout) {
>       public Void call() throws IOException {
>         server.mutateRow(location.getRegionInfo().getRegionName(), rm);
>         return null;
>
> where RowMutations has the following check:
>
>   private void internalAdd(Mutation m) throws IOException {
>     int res = Bytes.compareTo(this.row, m.getRow());
>     if(res != 0) {
>       throw new IOException("The row in the recently added Put/Delete " +
>           Bytes.toStringBinary(m.getRow()) + " doesn't match the original
> one " +
>           Bytes.toStringBinary(this.row));
>
> This means you need to issue multiple mutateRow() calls for different rows.
>
> I think you should consider the potential impact on performance due to this
> limitation.
>
> For advanced usage, take a look at MultiRowMutationEndpoint:
>
>  * This class demonstrates how to implement atomic multi row transactions
> using
>  * {@link HRegion#mutateRowsWithLocks(java.util.Collection,
> java.util.Collection)}
>  * and Coprocessor endpoints.
>
> Cheers
>
> On Sat, Apr 20, 2013 at 10:11 AM, Kristoffer Sjögren <[EMAIL PROTECTED]
> >wrote:
>
> > Just to absolutely be clear, is this also true for a batch that span
> > multiple rows?
> >
> >
> > On Sat, Apr 20, 2013 at 2:42 PM, Ted Yu <[EMAIL PROTECTED]> wrote:
> >
> > > Operations within each batch are atomic.
> > > They would either all succeed or all fail.
> > >
> > > Time stamps would all refer to the latest cell (KeyVal).
> > >
> > > Cheers
> > >
> > > On Apr 20, 2013, at 12:17 AM, Kristoffer Sjögren <[EMAIL PROTECTED]>
> > wrote:
> > >
> > > > The schema is known beforehand so this is exactly what I need. Great!
> > > >
> > > > One more question. What guarantees does the batch operation have? Are
> > the
> > > > operations contained within each batch atomic? I.e. all mutations
> will
> > be
> > > > given the same timestamp? If something fails, all operation fail or
> can
> > > it
> > > > fail partially?
> > > >
> > > > Thanks for your help, much appreciated.
> > > >
> > > > Cheers,
> > > > -Kristoffer
> > > >
> > > >
> > > > On Sat, Apr 20, 2013 at 4:47 AM, Ted Yu <[EMAIL PROTECTED]> wrote:
> > > >
> > > >> I don't know details about Kristoffer's schema.
> > > >> If all the column qualifiers are known a priori, mutateRow() should
> > > serve
> > > >> his needs.
> > > >>
> > > >> HBase allows arbitrary number of columns in a column family. If the
> > > schema
> > > >> is dynamic, mutateRow() wouldn't suffice.
> > > >> If the column qualifiers are known but the row is very wide (and a
> few
> > > >> columns are updated per call), performance would degrade.
> > > >>
> > > >> Just some factors to consider.
> > > >>
> > > >> Cheers
> > > >>
> > > >> On Fri, Apr 19, 2013 at 1:41 PM, Mohamed Ibrahim <
> > [EMAIL PROTECTED]
> > > >>> wrote:
> > > >>
> > > >>> Actually I do see it in the 0.94 JavaDocs (
> > > >>
> > >
> >
> http://hbase.apache.org/0.94/apidocs/org/apache/hadoop/hbase/client/HTable.html#mutateRow(org.apache.hadoop.hbase.client.RowMutations)
> > > >>> ),
> > > >>> so may be it was added in 0.94.6 even though the jira says fixed in
> > > 0.95
> > > >> .
> > > >>> I haven't used it though, but it seems that's what you're looking
> > for.
> > > >>>
> > > >>> Sorry for confusion.
> > > >>>
> > > >>> Mohamed
> > > >>>
> > > >>>
> > > >>> On Fri, Apr 19, 2013 at 4:35 PM, Mohamed Ibrahim <
> > > [EMAIL PROTECTED]
> > > >>>> wrote:
> > > >>>
> > > >>>> It seems that 0.95 is not released yet, mutateRow won't be a
> > solution
> > > >> for
> > > >>>> now. I saw it in the downloads and I thought it was released.
> > > >>>>
> > > >>>>
> > > >>>> On Fri, Apr 19, 2013 at 4:18 PM, Mohamed Ibrahim <
+
Kristoffer Sjögren 2013-04-22, 18:59
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB