Package org.apache.hadoop.hbase.client

Examples of org.apache.hadoop.hbase.client.HTableInterface.batch()


            put.add(FAMILY_NAME, f1v2, Bytes.toBytes("f1value2"));
            put.add(FAMILY_NAME2, f2v1, Bytes.toBytes("f2value1"));
            put.add(FAMILY_NAME2, f2v2, Bytes.toBytes("f2value2"));
            mutations.add(put);

            hTable.batch(mutations);

        } finally {
            hTable.close();
        }
        // Create Phoenix table after HBase table was created through the native APIs
View Full Code Here


        final WALEdit edit, final Durability durability) throws IOException {
      HTableInterface table = e.getEnvironment().getTable(otherTable, getPool());
      Put p = new Put(new byte[] { 'a' });
      p.add(family, null, new byte[] { 'a' });
      try {
        table.batch(Collections.singletonList(put));
      } catch (InterruptedException e1) {
        throw new IOException(e1);
      }
      completedWithPool[0] = true;
      table.close();
View Full Code Here

    }
    HTableInterface table = null;
    try {
      table = this.sharedHtableCon.getTable(tableName);
      for (List<Row> rows : allRows) {
        table.batch(rows);
      }
    } catch (InterruptedException ix) {
      throw (InterruptedIOException)new InterruptedIOException().initCause(ix);
    } finally {
      if (table != null) {
View Full Code Here

      return;
    }
    HTableInterface table = null;
    try {
      table = new HTable(tableName, this.sharedHtableCon, this.sharedThreadPool);
      table.batch(rows);
      this.metrics.appliedOpsRate.inc(rows.size());
    } catch (InterruptedException ix) {
      throw new IOException(ix);
    } finally {
      if (table != null) {
View Full Code Here

                                        + ignord);
                            }
                        }
                        HTableInterface table = factory.getTable(tableReference.get());
                        throwFailureIfDone();
                        table.batch(mutations);
                    } catch (SingleIndexWriteFailureException e) {
                        throw e;
                    } catch (IOException e) {
                        throw new SingleIndexWriteFailureException(tableReference.toString(), mutations, e);
                    } catch (InterruptedException e) {
View Full Code Here

                            }
                        }

                        HTableInterface table = factory.getTable(tableReference.get());
                        throwFailureIfDone();
                        table.batch(mutations);
                    } catch (InterruptedException e) {
                        // reset the interrupt status on the thread
                        Thread.currentThread().interrupt();
                        throw e;
                    } catch (Exception e) {
View Full Code Here

                    HTableInterface hTable = connection.getQueryServices().getTable(htableName);
                    try {
                        if (logger.isDebugEnabled()) logMutationSize(hTable, mutations);
                        long startTime = System.currentTimeMillis();
                        child.addTimelineAnnotation("Attempt " + retryCount);
                        hTable.batch(mutations);
                        child.stop();
                        shouldRetry = false;
                        if (logger.isDebugEnabled()) logger.debug("Total time for batch call of  " + mutations.size() + " mutations into " + table.getName().getString() + ": " + (System.currentTimeMillis() - startTime) + " ms");
                        committedList.add(entry);
                    } catch (Exception e) {
View Full Code Here

            put = new Put(key);
            put.add(family, uintCol, ts, Bytes.toBytes(4000));
            put.add(family, ulongCol, ts, Bytes.toBytes(40000L));
            mutations.add(put);
           
            hTable.batch(mutations);
           
            Result r = hTable.get(new Get(bKey));
            assertFalse(r.isEmpty());
        } finally {
            hTable.close();
View Full Code Here

        // we don't affect them
        put.add(family, uintCol, ts+6, Bytes.toBytes(10));
        put.add(family, ulongCol, ts+6, Bytes.toBytes(100L));
        put.add(family, QueryConstants.EMPTY_COLUMN_BYTES, ts+6, ByteUtil.EMPTY_BYTE_ARRAY);
        mutations.add(put);
        hTable.batch(mutations);
   
        // Demonstrates weakness of HBase Bytes serialization. Negative numbers
        // show up as bigger than positive numbers
        PreparedStatement statement = conn.prepareStatement(query);
        ResultSet rs = statement.executeQuery();
View Full Code Here

           
        } finally {
            HTableInterface htable = pconn.getQueryServices().getTable(SchemaUtil.getTableNameAsBytes(MDTEST_SCHEMA_NAME,MDTEST_NAME));
            Delete delete1 = new Delete(Bytes.toBytes("0"));
            Delete delete2 = new Delete(Bytes.toBytes("1"));
            htable.batch(Arrays.asList(delete1, delete2));
        }
       
    }
   
    @Test
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.