View Javadoc

1   /*
2    *
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *     http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  
20  package org.apache.hadoop.hbase.rest.client;
21  
22  import java.io.IOException;
23  import java.io.InterruptedIOException;
24  import java.util.ArrayList;
25  import java.util.Collection;
26  import java.util.Iterator;
27  import java.util.List;
28  import java.util.Map;
29  import java.util.Set;
30  import java.util.TreeMap;
31  
32  import org.apache.commons.logging.Log;
33  import org.apache.commons.logging.LogFactory;
34  import org.apache.hadoop.classification.InterfaceAudience;
35  import org.apache.hadoop.classification.InterfaceStability;
36  import org.apache.hadoop.conf.Configuration;
37  import org.apache.hadoop.hbase.Cell;
38  import org.apache.hadoop.hbase.HBaseConfiguration;
39  import org.apache.hadoop.hbase.HConstants;
40  import org.apache.hadoop.hbase.HTableDescriptor;
41  import org.apache.hadoop.hbase.KeyValue;
42  import org.apache.hadoop.hbase.KeyValueUtil;
43  import org.apache.hadoop.hbase.TableName;
44  import org.apache.hadoop.hbase.client.Append;
45  import org.apache.hadoop.hbase.client.Delete;
46  import org.apache.hadoop.hbase.client.Durability;
47  import org.apache.hadoop.hbase.client.Get;
48  import org.apache.hadoop.hbase.client.HTableInterface;
49  import org.apache.hadoop.hbase.client.Increment;
50  import org.apache.hadoop.hbase.client.Put;
51  import org.apache.hadoop.hbase.client.Result;
52  import org.apache.hadoop.hbase.client.ResultScanner;
53  import org.apache.hadoop.hbase.client.Row;
54  import org.apache.hadoop.hbase.client.RowMutations;
55  import org.apache.hadoop.hbase.client.Scan;
56  import org.apache.hadoop.hbase.client.coprocessor.Batch;
57  import org.apache.hadoop.hbase.client.coprocessor.Batch.Callback;
58  import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
59  import org.apache.hadoop.hbase.io.TimeRange;
60  import org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel;
61  import org.apache.hadoop.hbase.rest.Constants;
62  import org.apache.hadoop.hbase.rest.model.CellModel;
63  import org.apache.hadoop.hbase.rest.model.CellSetModel;
64  import org.apache.hadoop.hbase.rest.model.RowModel;
65  import org.apache.hadoop.hbase.rest.model.ScannerModel;
66  import org.apache.hadoop.hbase.rest.model.TableSchemaModel;
67  import org.apache.hadoop.hbase.util.Bytes;
68  import org.apache.hadoop.util.StringUtils;
69  
70  import com.google.protobuf.Descriptors;
71  import com.google.protobuf.Message;
72  import com.google.protobuf.Service;
73  import com.google.protobuf.ServiceException;
74  
75  /**
76   * HTable interface to remote tables accessed via REST gateway
77   */
78  @InterfaceAudience.Public
79  @InterfaceStability.Stable
80  public class RemoteHTable implements HTableInterface {
81  
82    private static final Log LOG = LogFactory.getLog(RemoteHTable.class);
83  
84    final Client client;
85    final Configuration conf;
86    final byte[] name;
87    final int maxRetries;
88    final long sleepTime;
89  
90    @SuppressWarnings("rawtypes")
91    protected String buildRowSpec(final byte[] row, final Map familyMap,
92        final long startTime, final long endTime, final int maxVersions) {
93      StringBuffer sb = new StringBuffer();
94      sb.append('/');
95      sb.append(Bytes.toStringBinary(name));
96      sb.append('/');
97      sb.append(Bytes.toStringBinary(row));
98      Set families = familyMap.entrySet();
99      if (families != null) {
100       Iterator i = familyMap.entrySet().iterator();
101       sb.append('/');
102       while (i.hasNext()) {
103         Map.Entry e = (Map.Entry)i.next();
104         Collection quals = (Collection)e.getValue();
105         if (quals == null || quals.isEmpty()) {
106           // this is an unqualified family. append the family name and NO ':'
107           sb.append(Bytes.toStringBinary((byte[])e.getKey()));
108         } else {
109           Iterator ii = quals.iterator();
110           while (ii.hasNext()) {
111             sb.append(Bytes.toStringBinary((byte[])e.getKey()));
112             sb.append(':');
113             Object o = ii.next();
114             // Puts use byte[] but Deletes use KeyValue
115             if (o instanceof byte[]) {
116               sb.append(Bytes.toStringBinary((byte[])o));
117             } else if (o instanceof KeyValue) {
118               sb.append(Bytes.toStringBinary(((KeyValue)o).getQualifier()));
119             } else {
120               throw new RuntimeException("object type not handled");
121             }
122             if (ii.hasNext()) {
123               sb.append(',');
124             }
125           }
126         }
127         if (i.hasNext()) {
128           sb.append(',');
129         }
130       }
131     }
132     if (startTime >= 0 && endTime != Long.MAX_VALUE) {
133       sb.append('/');
134       sb.append(startTime);
135       if (startTime != endTime) {
136         sb.append(',');
137         sb.append(endTime);
138       }
139     } else if (endTime != Long.MAX_VALUE) {
140       sb.append('/');
141       sb.append(endTime);
142     }
143     if (maxVersions > 1) {
144       sb.append("?v=");
145       sb.append(maxVersions);
146     }
147     return sb.toString();
148   }
149 
150   protected String buildMultiRowSpec(final byte[][] rows, int maxVersions) {
151     StringBuilder sb = new StringBuilder();
152     sb.append('/');
153     sb.append(Bytes.toStringBinary(name));
154     sb.append("/multiget/");
155     if (rows == null || rows.length == 0) {
156       return sb.toString();
157     }
158     sb.append("?");
159     for(int i=0; i<rows.length; i++) {
160       byte[] rk = rows[i];
161       if (i != 0) {
162         sb.append('&');
163       }
164       sb.append("row=");
165       sb.append(Bytes.toStringBinary(rk));
166     }
167     sb.append("&v=");
168     sb.append(maxVersions);
169 
170     return sb.toString();
171   }
172 
173   protected Result[] buildResultFromModel(final CellSetModel model) {
174     List<Result> results = new ArrayList<Result>();
175     for (RowModel row: model.getRows()) {
176       List<Cell> kvs = new ArrayList<Cell>();
177       for (CellModel cell: row.getCells()) {
178         byte[][] split = KeyValue.parseColumn(cell.getColumn());
179         byte[] column = split[0];
180         byte[] qualifier = null;
181         if (split.length == 1) {
182           qualifier = HConstants.EMPTY_BYTE_ARRAY;
183         } else if (split.length == 2) {
184           qualifier = split[1];
185         } else {
186           throw new IllegalArgumentException("Invalid familyAndQualifier provided.");
187         }
188         kvs.add(new KeyValue(row.getKey(), column, qualifier,
189           cell.getTimestamp(), cell.getValue()));
190       }
191       results.add(Result.create(kvs));
192     }
193     return results.toArray(new Result[results.size()]);
194   }
195 
196   protected CellSetModel buildModelFromPut(Put put) {
197     RowModel row = new RowModel(put.getRow());
198     long ts = put.getTimeStamp();
199     for (List<Cell> cells: put.getFamilyCellMap().values()) {
200       for (Cell cell: cells) {
201         KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
202         row.addCell(new CellModel(kv.getFamily(), kv.getQualifier(),
203           ts != HConstants.LATEST_TIMESTAMP ? ts : kv.getTimestamp(),
204           kv.getValue()));
205       }
206     }
207     CellSetModel model = new CellSetModel();
208     model.addRow(row);
209     return model;
210   }
211 
212   /**
213    * Constructor
214    * @param client
215    * @param name
216    */
217   public RemoteHTable(Client client, String name) {
218     this(client, HBaseConfiguration.create(), Bytes.toBytes(name));
219   }
220 
221   /**
222    * Constructor
223    * @param client
224    * @param conf
225    * @param name
226    */
227   public RemoteHTable(Client client, Configuration conf, String name) {
228     this(client, conf, Bytes.toBytes(name));
229   }
230 
231   /**
232    * Constructor
233    * @param client
234    * @param conf
235    * @param name
236    */
237   public RemoteHTable(Client client, Configuration conf, byte[] name) {
238     this.client = client;
239     this.conf = conf;
240     this.name = name;
241     this.maxRetries = conf.getInt("hbase.rest.client.max.retries", 10);
242     this.sleepTime = conf.getLong("hbase.rest.client.sleep", 1000);
243   }
244 
245   public byte[] getTableName() {
246     return name.clone();
247   }
248 
249   @Override
250   public TableName getName() {
251     return TableName.valueOf(name);
252   }
253 
254   public Configuration getConfiguration() {
255     return conf;
256   }
257 
258   public HTableDescriptor getTableDescriptor() throws IOException {
259     StringBuilder sb = new StringBuilder();
260     sb.append('/');
261     sb.append(Bytes.toStringBinary(name));
262     sb.append('/');
263     sb.append("schema");
264     for (int i = 0; i < maxRetries; i++) {
265       Response response = client.get(sb.toString(), Constants.MIMETYPE_PROTOBUF);
266       int code = response.getCode();
267       switch (code) {
268       case 200:
269         TableSchemaModel schema = new TableSchemaModel();
270         schema.getObjectFromMessage(response.getBody());
271         return schema.getTableDescriptor();
272       case 509:
273         try {
274           Thread.sleep(sleepTime);
275         } catch (InterruptedException e) {
276           throw (InterruptedIOException)new InterruptedIOException().initCause(e);
277         }
278         break;
279       default:
280         throw new IOException("schema request returned " + code);
281       }
282     }
283     throw new IOException("schema request timed out");
284   }
285 
286   public void close() throws IOException {
287     client.shutdown();
288   }
289 
290   public Result get(Get get) throws IOException {
291     TimeRange range = get.getTimeRange();
292     String spec = buildRowSpec(get.getRow(), get.getFamilyMap(),
293       range.getMin(), range.getMax(), get.getMaxVersions());
294     if (get.getFilter() != null) {
295       LOG.warn("filters not supported on gets");
296     }
297     Result[] results = getResults(spec);
298     if (results.length > 0) {
299       if (results.length > 1) {
300         LOG.warn("too many results for get (" + results.length + ")");
301       }
302       return results[0];
303     } else {
304       return new Result();
305     }
306   }
307 
308   public Result[] get(List<Get> gets) throws IOException {
309     byte[][] rows = new byte[gets.size()][];
310     int maxVersions = 1;
311     int count = 0;
312 
313     for(Get g:gets) {
314 
315       if ( count == 0 ) {
316         maxVersions = g.getMaxVersions();
317       } else if (g.getMaxVersions() != maxVersions) {
318         LOG.warn("MaxVersions on Gets do not match, using the first in the list ("+maxVersions+")");
319       }
320 
321       if (g.getFilter() != null) {
322         LOG.warn("filters not supported on gets");
323       }
324 
325       rows[count] = g.getRow();
326       count ++;
327     }
328 
329     String spec = buildMultiRowSpec(rows, maxVersions);
330 
331     return getResults(spec);
332   }
333 
334   private Result[] getResults(String spec) throws IOException {
335     for (int i = 0; i < maxRetries; i++) {
336       Response response = client.get(spec, Constants.MIMETYPE_PROTOBUF);
337       int code = response.getCode();
338       switch (code) {
339         case 200:
340           CellSetModel model = new CellSetModel();
341           model.getObjectFromMessage(response.getBody());
342           Result[] results = buildResultFromModel(model);
343           if ( results.length > 0) {
344             return results;
345           }
346           // fall through
347         case 404:
348           return new Result[0];
349 
350         case 509:
351           try {
352             Thread.sleep(sleepTime);
353           } catch (InterruptedException e) {
354             throw (InterruptedIOException)new InterruptedIOException().initCause(e);
355           }
356           break;
357         default:
358           throw new IOException("get request returned " + code);
359       }
360     }
361     throw new IOException("get request timed out");
362   }
363 
364   public boolean exists(Get get) throws IOException {
365     LOG.warn("exists() is really get(), just use get()");
366     Result result = get(get);
367     return (result != null && !(result.isEmpty()));
368   }
369 
370   /**
371    * exists(List) is really a list of get() calls. Just use get().
372    * @param gets list of Get to test for the existence
373    */
374   public Boolean[] exists(List<Get> gets) throws IOException {
375     LOG.warn("exists(List<Get>) is really list of get() calls, just use get()");
376     Boolean[] results = new Boolean[gets.size()];
377     for (int i = 0; i < results.length; i++) {
378       results[i] = exists(gets.get(i));
379     }
380     return results;
381   }
382 
383   public void put(Put put) throws IOException {
384     CellSetModel model = buildModelFromPut(put);
385     StringBuilder sb = new StringBuilder();
386     sb.append('/');
387     sb.append(Bytes.toStringBinary(name));
388     sb.append('/');
389     sb.append(Bytes.toStringBinary(put.getRow()));
390     for (int i = 0; i < maxRetries; i++) {
391       Response response = client.put(sb.toString(), Constants.MIMETYPE_PROTOBUF,
392         model.createProtobufOutput());
393       int code = response.getCode();
394       switch (code) {
395       case 200:
396         return;
397       case 509:
398         try {
399           Thread.sleep(sleepTime);
400         } catch (InterruptedException e) {
401           throw (InterruptedIOException)new InterruptedIOException().initCause(e);
402         }
403         break;
404       default:
405         throw new IOException("put request failed with " + code);
406       }
407     }
408     throw new IOException("put request timed out");
409   }
410 
411   public void put(List<Put> puts) throws IOException {
412     // this is a trick: The gateway accepts multiple rows in a cell set and
413     // ignores the row specification in the URI
414 
415     // separate puts by row
416     TreeMap<byte[],List<Cell>> map =
417       new TreeMap<byte[],List<Cell>>(Bytes.BYTES_COMPARATOR);
418     for (Put put: puts) {
419       byte[] row = put.getRow();
420       List<Cell> cells = map.get(row);
421       if (cells == null) {
422         cells = new ArrayList<Cell>();
423         map.put(row, cells);
424       }
425       for (List<Cell> l: put.getFamilyCellMap().values()) {
426         cells.addAll(l);
427       }
428     }
429 
430     // build the cell set
431     CellSetModel model = new CellSetModel();
432     for (Map.Entry<byte[], List<Cell>> e: map.entrySet()) {
433       RowModel row = new RowModel(e.getKey());
434       for (Cell cell: e.getValue()) {
435         KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
436         row.addCell(new CellModel(kv));
437       }
438       model.addRow(row);
439     }
440 
441     // build path for multiput
442     StringBuilder sb = new StringBuilder();
443     sb.append('/');
444     sb.append(Bytes.toStringBinary(name));
445     sb.append("/$multiput"); // can be any nonexistent row
446     for (int i = 0; i < maxRetries; i++) {
447       Response response = client.put(sb.toString(), Constants.MIMETYPE_PROTOBUF,
448         model.createProtobufOutput());
449       int code = response.getCode();
450       switch (code) {
451       case 200:
452         return;
453       case 509:
454         try {
455           Thread.sleep(sleepTime);
456         } catch (InterruptedException e) {
457           throw (InterruptedIOException)new InterruptedIOException().initCause(e);
458         }
459         break;
460       default:
461         throw new IOException("multiput request failed with " + code);
462       }
463     }
464     throw new IOException("multiput request timed out");
465   }
466 
467   public void delete(Delete delete) throws IOException {
468     String spec = buildRowSpec(delete.getRow(), delete.getFamilyCellMap(),
469       delete.getTimeStamp(), delete.getTimeStamp(), 1);
470     for (int i = 0; i < maxRetries; i++) {
471       Response response = client.delete(spec);
472       int code = response.getCode();
473       switch (code) {
474       case 200:
475         return;
476       case 509:
477         try {
478           Thread.sleep(sleepTime);
479         } catch (InterruptedException e) {
480           throw (InterruptedIOException)new InterruptedIOException().initCause(e);
481         }
482         break;
483       default:
484         throw new IOException("delete request failed with " + code);
485       }
486     }
487     throw new IOException("delete request timed out");
488   }
489 
490   public void delete(List<Delete> deletes) throws IOException {
491     for (Delete delete: deletes) {
492       delete(delete);
493     }
494   }
495 
496   public void flushCommits() throws IOException {
497     // no-op
498   }
499 
500   class Scanner implements ResultScanner {
501 
502     String uri;
503 
504     public Scanner(Scan scan) throws IOException {
505       ScannerModel model;
506       try {
507         model = ScannerModel.fromScan(scan);
508       } catch (Exception e) {
509         throw new IOException(e);
510       }
511       StringBuffer sb = new StringBuffer();
512       sb.append('/');
513       sb.append(Bytes.toStringBinary(name));
514       sb.append('/');
515       sb.append("scanner");
516       for (int i = 0; i < maxRetries; i++) {
517         Response response = client.post(sb.toString(),
518           Constants.MIMETYPE_PROTOBUF, model.createProtobufOutput());
519         int code = response.getCode();
520         switch (code) {
521         case 201:
522           uri = response.getLocation();
523           return;
524         case 509:
525           try {
526             Thread.sleep(sleepTime);
527           } catch (InterruptedException e) {
528             throw (InterruptedIOException)new InterruptedIOException().initCause(e);
529           }
530           break;
531         default:
532           throw new IOException("scan request failed with " + code);
533         }
534       }
535       throw new IOException("scan request timed out");
536     }
537 
538     @Override
539     public Result[] next(int nbRows) throws IOException {
540       StringBuilder sb = new StringBuilder(uri);
541       sb.append("?n=");
542       sb.append(nbRows);
543       for (int i = 0; i < maxRetries; i++) {
544         Response response = client.get(sb.toString(),
545           Constants.MIMETYPE_PROTOBUF);
546         int code = response.getCode();
547         switch (code) {
548         case 200:
549           CellSetModel model = new CellSetModel();
550           model.getObjectFromMessage(response.getBody());
551           return buildResultFromModel(model);
552         case 204:
553         case 206:
554           return null;
555         case 509:
556           try {
557             Thread.sleep(sleepTime);
558           } catch (InterruptedException e) {
559             throw (InterruptedIOException)new InterruptedIOException().initCause(e);
560           }
561           break;
562         default:
563           throw new IOException("scanner.next request failed with " + code);
564         }
565       }
566       throw new IOException("scanner.next request timed out");
567     }
568 
569     @Override
570     public Result next() throws IOException {
571       Result[] results = next(1);
572       if (results == null || results.length < 1) {
573         return null;
574       }
575       return results[0];
576     }
577 
578     class Iter implements Iterator<Result> {
579 
580       Result cache;
581 
582       public Iter() {
583         try {
584           cache = Scanner.this.next();
585         } catch (IOException e) {
586           LOG.warn(StringUtils.stringifyException(e));
587         }
588       }
589 
590       @Override
591       public boolean hasNext() {
592         return cache != null;
593       }
594 
595       @Override
596       public Result next() {
597         Result result = cache;
598         try {
599           cache = Scanner.this.next();
600         } catch (IOException e) {
601           LOG.warn(StringUtils.stringifyException(e));
602           cache = null;
603         }
604         return result;
605       }
606 
607       @Override
608       public void remove() {
609         throw new RuntimeException("remove() not supported");
610       }
611 
612     }
613 
614     @Override
615     public Iterator<Result> iterator() {
616       return new Iter();
617     }
618 
619     @Override
620     public void close() {
621       try {
622         client.delete(uri);
623       } catch (IOException e) {
624         LOG.warn(StringUtils.stringifyException(e));
625       }
626     }
627 
628   }
629 
630   public ResultScanner getScanner(Scan scan) throws IOException {
631     return new Scanner(scan);
632   }
633 
634   public ResultScanner getScanner(byte[] family) throws IOException {
635     Scan scan = new Scan();
636     scan.addFamily(family);
637     return new Scanner(scan);
638   }
639 
640   public ResultScanner getScanner(byte[] family, byte[] qualifier)
641       throws IOException {
642     Scan scan = new Scan();
643     scan.addColumn(family, qualifier);
644     return new Scanner(scan);
645   }
646 
647   public boolean isAutoFlush() {
648     return true;
649   }
650 
651   public Result getRowOrBefore(byte[] row, byte[] family) throws IOException {
652     throw new IOException("getRowOrBefore not supported");
653   }
654 
655   public boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier,
656       byte[] value, Put put) throws IOException {
657     // column to check-the-value
658     put.add(new KeyValue(row, family, qualifier, value));
659 
660     CellSetModel model = buildModelFromPut(put);
661     StringBuilder sb = new StringBuilder();
662     sb.append('/');
663     sb.append(Bytes.toStringBinary(name));
664     sb.append('/');
665     sb.append(Bytes.toStringBinary(put.getRow()));
666     sb.append("?check=put");
667 
668     for (int i = 0; i < maxRetries; i++) {
669       Response response = client.put(sb.toString(),
670         Constants.MIMETYPE_PROTOBUF, model.createProtobufOutput());
671       int code = response.getCode();
672       switch (code) {
673       case 200:
674         return true;
675       case 304: // NOT-MODIFIED
676         return false;
677       case 509:
678         try {
679           Thread.sleep(sleepTime);
680         } catch (final InterruptedException e) {
681           throw (InterruptedIOException)new InterruptedIOException().initCause(e);
682         }
683         break;
684       default:
685         throw new IOException("checkAndPut request failed with " + code);
686       }
687     }
688     throw new IOException("checkAndPut request timed out");
689   }
690 
691   public boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier,
692       CompareOp compareOp, byte[] value, Put put) throws IOException {
693     throw new IOException("checkAndPut for non-equal comparison not implemented");
694   }
695 
696   public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier,
697       byte[] value, Delete delete) throws IOException {
698     Put put = new Put(row);
699     // column to check-the-value
700     put.add(new KeyValue(row, family, qualifier, value));
701     CellSetModel model = buildModelFromPut(put);
702     StringBuilder sb = new StringBuilder();
703     sb.append('/');
704     sb.append(Bytes.toStringBinary(name));
705     sb.append('/');
706     sb.append(Bytes.toStringBinary(row));
707     sb.append("?check=delete");
708 
709     for (int i = 0; i < maxRetries; i++) {
710       Response response = client.put(sb.toString(),
711         Constants.MIMETYPE_PROTOBUF, model.createProtobufOutput());
712       int code = response.getCode();
713       switch (code) {
714       case 200:
715         return true;
716       case 304: // NOT-MODIFIED
717         return false;
718       case 509:
719         try {
720           Thread.sleep(sleepTime);
721         } catch (final InterruptedException e) {
722           throw (InterruptedIOException)new InterruptedIOException().initCause(e);
723         }
724         break;
725       default:
726         throw new IOException("checkAndDelete request failed with " + code);
727       }
728     }
729     throw new IOException("checkAndDelete request timed out");
730   }
731 
732   public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier,
733       CompareOp compareOp, byte[] value, Delete delete) throws IOException {
734     throw new IOException("checkAndDelete for non-equal comparison not implemented");
735   }
736 
737   public Result increment(Increment increment) throws IOException {
738     throw new IOException("Increment not supported");
739   }
740 
741   public Result append(Append append) throws IOException {
742     throw new IOException("Append not supported");
743   }
744 
745   public long incrementColumnValue(byte[] row, byte[] family, byte[] qualifier,
746       long amount) throws IOException {
747     throw new IOException("incrementColumnValue not supported");
748   }
749 
750   public long incrementColumnValue(byte[] row, byte[] family, byte[] qualifier,
751       long amount, Durability durability) throws IOException {
752     throw new IOException("incrementColumnValue not supported");
753   }
754 
755   @Override
756   public void batch(List<? extends Row> actions, Object[] results) throws IOException {
757     throw new IOException("batch not supported");
758   }
759 
760   @Override
761   public Object[] batch(List<? extends Row> actions) throws IOException {
762     throw new IOException("batch not supported");
763   }
764 
765   @Override
766   public <R> void batchCallback(List<? extends Row> actions, Object[] results,
767       Batch.Callback<R> callback) throws IOException, InterruptedException {
768     throw new IOException("batchCallback not supported");
769   }
770 
771   @Override
772   public <R> Object[] batchCallback(List<? extends Row> actions, Batch.Callback<R> callback)
773    throws IOException, InterruptedException {
774     throw new IOException("batchCallback not supported");
775   }
776 
777   @Override
778   public CoprocessorRpcChannel coprocessorService(byte[] row) {
779     throw new UnsupportedOperationException("coprocessorService not implemented");
780   }
781 
782   @Override
783   public <T extends Service, R> Map<byte[], R> coprocessorService(Class<T> service,
784       byte[] startKey, byte[] endKey, Batch.Call<T, R> callable)
785       throws ServiceException, Throwable {
786     throw new UnsupportedOperationException("coprocessorService not implemented");
787   }
788 
789   @Override
790   public <T extends Service, R> void coprocessorService(Class<T> service,
791       byte[] startKey, byte[] endKey, Batch.Call<T, R> callable, Batch.Callback<R> callback)
792       throws ServiceException, Throwable {
793     throw new UnsupportedOperationException("coprocessorService not implemented");
794   }
795 
796   @Override
797   public void mutateRow(RowMutations rm) throws IOException {
798     throw new IOException("atomicMutation not supported");
799   }
800 
801   @Override
802   public void setAutoFlush(boolean autoFlush) {
803     throw new UnsupportedOperationException("setAutoFlush not implemented");
804   }
805 
806   @Override
807   public void setAutoFlush(boolean autoFlush, boolean clearBufferOnFail) {
808     throw new UnsupportedOperationException("setAutoFlush not implemented");
809   }
810 
811   @Override
812   public void setAutoFlushTo(boolean autoFlush) {
813     throw new UnsupportedOperationException("setAutoFlushTo not implemented");
814   }
815 
816   @Override
817   public long getWriteBufferSize() {
818     throw new UnsupportedOperationException("getWriteBufferSize not implemented");
819   }
820 
821   @Override
822   public void setWriteBufferSize(long writeBufferSize) throws IOException {
823     throw new IOException("setWriteBufferSize not supported");
824   }
825 
826   @Override
827   public long incrementColumnValue(byte[] row, byte[] family, byte[] qualifier,
828       long amount, boolean writeToWAL) throws IOException {
829     throw new IOException("incrementColumnValue not supported");
830   }
831 
832   @Override
833   public <R extends Message> Map<byte[], R> batchCoprocessorService(
834       Descriptors.MethodDescriptor method, Message request,
835       byte[] startKey, byte[] endKey, R responsePrototype) throws ServiceException, Throwable {
836     throw new UnsupportedOperationException("batchCoprocessorService not implemented");
837   }
838 
839   @Override
840   public <R extends Message> void batchCoprocessorService(
841       Descriptors.MethodDescriptor method, Message request,
842       byte[] startKey, byte[] endKey, R responsePrototype, Callback<R> callback)
843       throws ServiceException, Throwable {
844     throw new UnsupportedOperationException("batchCoprocessorService not implemented");
845   }
846 }