Search in sources :

Example 1 with TColumn

use of org.apache.accumulo.core.data.thrift.TColumn in project accumulo by apache.

the class ColumnTest method testThriftRoundTrip.

@Test
public void testThriftRoundTrip() {
    for (Column c : col) {
        TColumn tc = c.toThrift();
        assertEquals(c, new Column(tc));
    }
}
Also used : TColumn(org.apache.accumulo.core.data.thrift.TColumn) TColumn(org.apache.accumulo.core.data.thrift.TColumn) Test(org.junit.Test)

Example 2 with TColumn

use of org.apache.accumulo.core.data.thrift.TColumn in project accumulo by apache.

the class VerifyTabletAssignments method checkTabletServer.

private static void checkTabletServer(ClientContext context, Entry<HostAndPort, List<KeyExtent>> entry, HashSet<KeyExtent> failures) throws ThriftSecurityException, TException, NoSuchScanIDException {
    TabletClientService.Iface client = ThriftUtil.getTServerClient(entry.getKey(), context);
    Map<TKeyExtent, List<TRange>> batch = new TreeMap<>();
    for (KeyExtent keyExtent : entry.getValue()) {
        Text row = keyExtent.getEndRow();
        Text row2 = null;
        if (row == null) {
            row = keyExtent.getPrevEndRow();
            if (row != null) {
                row = new Text(row);
                row.append(new byte[] { 'a' }, 0, 1);
            } else {
                row = new Text("1234567890");
            }
            row2 = new Text(row);
            row2.append(new byte[] { '!' }, 0, 1);
        } else {
            row = new Text(row);
            row2 = new Text(row);
            row.getBytes()[row.getLength() - 1] = (byte) (row.getBytes()[row.getLength() - 1] - 1);
        }
        Range r = new Range(row, true, row2, false);
        batch.put(keyExtent.toThrift(), Collections.singletonList(r.toThrift()));
    }
    TInfo tinfo = Tracer.traceInfo();
    Map<String, Map<String, String>> emptyMapSMapSS = Collections.emptyMap();
    List<IterInfo> emptyListIterInfo = Collections.emptyList();
    List<TColumn> emptyListColumn = Collections.emptyList();
    InitialMultiScan is = client.startMultiScan(tinfo, context.rpcCreds(), batch, emptyListColumn, emptyListIterInfo, emptyMapSMapSS, Authorizations.EMPTY.getAuthorizationsBB(), false, null, 0L, null);
    if (is.result.more) {
        MultiScanResult result = client.continueMultiScan(tinfo, is.scanID);
        checkFailures(entry.getKey(), failures, result);
        while (result.more) {
            result = client.continueMultiScan(tinfo, is.scanID);
            checkFailures(entry.getKey(), failures, result);
        }
    }
    client.closeMultiScan(tinfo, is.scanID);
    ThriftUtil.returnClient((TServiceClient) client);
}
Also used : TInfo(org.apache.accumulo.core.trace.thrift.TInfo) TColumn(org.apache.accumulo.core.data.thrift.TColumn) InitialMultiScan(org.apache.accumulo.core.data.thrift.InitialMultiScan) Text(org.apache.hadoop.io.Text) TKeyExtent(org.apache.accumulo.core.data.thrift.TKeyExtent) TreeMap(java.util.TreeMap) TRange(org.apache.accumulo.core.data.thrift.TRange) Range(org.apache.accumulo.core.data.Range) TKeyExtent(org.apache.accumulo.core.data.thrift.TKeyExtent) KeyExtent(org.apache.accumulo.core.data.impl.KeyExtent) IterInfo(org.apache.accumulo.core.data.thrift.IterInfo) MultiScanResult(org.apache.accumulo.core.data.thrift.MultiScanResult) ArrayList(java.util.ArrayList) List(java.util.List) TabletClientService(org.apache.accumulo.core.tabletserver.thrift.TabletClientService) Map(java.util.Map) TreeMap(java.util.TreeMap)

Aggregations

TColumn (org.apache.accumulo.core.data.thrift.TColumn)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 Range (org.apache.accumulo.core.data.Range)1 KeyExtent (org.apache.accumulo.core.data.impl.KeyExtent)1 InitialMultiScan (org.apache.accumulo.core.data.thrift.InitialMultiScan)1 IterInfo (org.apache.accumulo.core.data.thrift.IterInfo)1 MultiScanResult (org.apache.accumulo.core.data.thrift.MultiScanResult)1 TKeyExtent (org.apache.accumulo.core.data.thrift.TKeyExtent)1 TRange (org.apache.accumulo.core.data.thrift.TRange)1 TabletClientService (org.apache.accumulo.core.tabletserver.thrift.TabletClientService)1 TInfo (org.apache.accumulo.core.trace.thrift.TInfo)1 Text (org.apache.hadoop.io.Text)1 Test (org.junit.Test)1