Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,28 +62,28 @@ public final class ActiveScanImpl extends ActiveScan {
ActiveScanImpl(ClientContext context,
org.apache.accumulo.core.tabletscan.thrift.ActiveScan activeScan, ServerId server)
throws TableNotFoundException {
this.scanId = activeScan.scanId;
this.client = activeScan.client;
this.user = activeScan.user;
this.age = activeScan.age;
this.idle = activeScan.idleTime;
this.tableName = context.getQualifiedTableName(TableId.of(activeScan.tableId));
this.scanId = activeScan.getScanId();
this.client = activeScan.getClient();
this.user = activeScan.getUser();
this.age = activeScan.getAge();
this.idle = activeScan.getIdleTime();
this.tableName = context.getQualifiedTableName(TableId.of(activeScan.getTableId()));
this.type = ScanType.valueOf(activeScan.getType().name());
this.state = ScanState.valueOf(activeScan.state.name());
this.extent = KeyExtent.fromThrift(activeScan.extent);
this.authorizations = new Authorizations(activeScan.authorizations);
this.state = ScanState.valueOf(activeScan.getState().name());
this.extent = KeyExtent.fromThrift(activeScan.getExtent());
this.authorizations = new Authorizations(activeScan.getAuthorizations());

this.columns = new ArrayList<>(activeScan.columns.size());
this.columns = new ArrayList<>(activeScan.getColumns().size());

for (TColumn tcolumn : activeScan.columns) {
for (TColumn tcolumn : activeScan.getColumns()) {
this.columns.add(new Column(tcolumn));
}

this.ssiList = new ArrayList<>();
for (IterInfo ii : activeScan.ssiList) {
this.ssiList.add(ii.iterName + "=" + ii.priority + "," + ii.className);
for (IterInfo ii : activeScan.getSsiList()) {
this.ssiList.add(ii.getIterName() + "=" + ii.getPriority() + "," + ii.getClassName());
}
this.ssio = activeScan.ssio;
this.ssio = activeScan.getSsio();
this.server = Objects.requireNonNull(server);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void readFields(DataInput in) throws IOException {
}

private void populateFields(TAuthenticationTokenIdentifier tAuthTokenId) {
impl.principal = tAuthTokenId.getPrincipal();
impl.setPrincipal(tAuthTokenId.getPrincipal());
setExpirationDate(tAuthTokenId.getExpirationDate());
setIssueDate(tAuthTokenId.getIssueDate());
if (tAuthTokenId.getInstanceId() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,9 +510,9 @@ private SessionID reserveSessionID(HostAndPort location, TabletIngestClientServi
synchronized (cachedSessionIDs) {
SessionID sid = new SessionID();
sid.reserved = true;
sid.sessionID = tcs.sessionId;
sid.lockId = tcs.tserverLock;
sid.ttl = tcs.ttl;
sid.sessionID = tcs.getSessionId();
sid.lockId = tcs.getTserverLock();
sid.ttl = tcs.getTtl();
sid.location = location;
if (cachedSessionIDs.put(location, sid) != null) {
throw new IllegalStateException();
Expand Down Expand Up @@ -600,13 +600,13 @@ private void sendToServer(HostAndPort location, TabletServerMutations<QCMutation
ArrayList<QCMutation> ignored = new ArrayList<>();

for (TCMResult tcmResult : tresults) {
if (tcmResult.status == TCMStatus.IGNORED) {
CMK cmk = cmidToCm.get(tcmResult.cmid);
if (tcmResult.getStatus() == TCMStatus.IGNORED) {
CMK cmk = cmidToCm.get(tcmResult.getCmid());
ignored.add(cmk.cm);
extentsToInvalidate.add(cmk.ke);
} else {
QCMutation qcm = cmidToCm.get(tcmResult.cmid).cm;
qcm.queueResult(new Result(fromThrift(tcmResult.status), qcm, location.toString()));
QCMutation qcm = cmidToCm.get(tcmResult.getCmid()).cm;
qcm.queueResult(new Result(fromThrift(tcmResult.getStatus()), qcm, location.toString()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ private List<ActiveScan> getActiveScans(ServerId server)
}
return as;
} catch (ThriftSecurityException e) {
throw new AccumuloSecurityException(e.user, e.code, e);
throw new AccumuloSecurityException(e.getUser(), e.getCode(), e);
} catch (TException e) {
throw new AccumuloException(e);
} finally {
Expand Down Expand Up @@ -364,7 +364,7 @@ private List<ActiveCompaction> getActiveCompactions(ServerId server)
}
return as;
} catch (ThriftSecurityException e) {
throw new AccumuloSecurityException(e.user, e.code, e);
throw new AccumuloSecurityException(e.getUser(), e.getCode(), e);
} catch (TException e) {
throw new AccumuloException(e);
}
Expand Down Expand Up @@ -425,7 +425,7 @@ private <T> List<T> queryServers(Collection<ServerId> servers, ServerQuery<List<
ret.addAll(future.get());
} catch (InterruptedException | ExecutionException e) {
if (e.getCause() instanceof ThriftSecurityException tse) {
throw new AccumuloSecurityException(tse.user, tse.code, e);
throw new AccumuloSecurityException(tse.getUser(), tse.getCode(), e);
}
throw new AccumuloException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public synchronized void addScanIterator(IteratorSetting si) {
}

for (IterInfo ii : serverSideIteratorList) {
if (ii.iterName.equals(si.getName())) {
if (ii.getIterName().equals(si.getName())) {
throw new IllegalArgumentException("Iterator name is already in use " + si.getName());
}
if (ii.getPriority() == si.getPriority()) {
Expand All @@ -108,7 +108,7 @@ public synchronized void removeScanIterator(String iteratorName) {
}

for (IterInfo ii : serverSideIteratorList) {
if (ii.iterName.equals(iteratorName)) {
if (ii.getIterName().equals(iteratorName)) {
serverSideIteratorList.remove(ii);
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ private <T> T handleFateOperation(FateOperationExecutor<T> executor, String tabl
"Target namespace does not exist");
default:
String tableInfo = context.getPrintableTableInfoFromName(tableOrNamespaceName);
throw new AccumuloSecurityException(e.user, e.code, tableInfo, e);
throw new AccumuloSecurityException(e.getUser(), e.getCode(), tableInfo, e);
}
} catch (ThriftTableOperationException e) {
switch (e.getType()) {
Expand All @@ -418,7 +418,7 @@ private <T> T handleFateOperation(FateOperationExecutor<T> executor, String tabl
case BULK_CONCURRENT_MERGE:
throw new AccumuloBulkMergeException(e);
default:
throw new AccumuloException(e.description, e);
throw new AccumuloException(e.getDescription(), e);
}
} catch (Exception e) {
throw new AccumuloException(e.getMessage(), e);
Expand Down Expand Up @@ -1017,12 +1017,12 @@ private void _flush(TableId tableId, Text start, Text end, boolean wait)
throw new TableNotFoundException(tableId.canonical(), null, e.getMessage(), e);
}
log.debug("flush security exception on table id {}", tableId);
throw new AccumuloSecurityException(e.user, e.code, e);
throw new AccumuloSecurityException(e.getUser(), e.getCode(), e);
} catch (ThriftTableOperationException e) {
if (requireNonNull(e.getType()) == TableOperationExceptionType.NOTFOUND) {
throw new TableNotFoundException(e);
}
throw new AccumuloException(e.description, e);
throw new AccumuloException(e.getDescription(), e);
} catch (Exception e) {
throw new AccumuloException(e);
}
Expand Down Expand Up @@ -1592,7 +1592,7 @@ public List<DiskUsage> getDiskUsage(Set<String> tableNames)
case NAMESPACE_NOTFOUND:
throw new TableNotFoundException(e.getTableName(), new NamespaceNotFoundException(e));
default:
throw new AccumuloException(e.description, e);
throw new AccumuloException(e.getDescription(), e);
}
} catch (ThriftSecurityException e) {
throw new AccumuloSecurityException(e.getUser(), e.getCode());
Expand Down Expand Up @@ -2069,8 +2069,8 @@ public List<Summary> retrieve()
TSummaries ret = ThriftClientTypes.TABLET_SERVER.execute(context, client -> {
TSummaries tsr =
client.startGetSummaries(TraceUtil.traceInfo(), context.rpcCreds(), request);
while (!tsr.finished) {
tsr = client.contiuneGetSummaries(TraceUtil.traceInfo(), tsr.sessionId);
while (!tsr.isFinished()) {
tsr = client.contiuneGetSummaries(TraceUtil.traceInfo(), tsr.getSessionId());
}
return tsr;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ public static SplitMergeability decode(String data) {
}

public static TabletMergeability fromThrift(TTabletMergeability thriftTm) {
if (thriftTm.never) {
if (thriftTm.isNever()) {
return TabletMergeability.never();
}
return TabletMergeability.after(Duration.ofNanos(thriftTm.delay));
return TabletMergeability.after(Duration.ofNanos(thriftTm.getDelay()));
}

public static TTabletMergeability toThrift(TabletMergeability tabletMergeability) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ static void trackScanning(Map<KeyExtent,List<Range>> failures,

// translate returned failures, remove them from unscanned, and add them to failures
// @formatter:off
Map<KeyExtent, List<Range>> retFailures = scanResult.failures.entrySet().stream().collect(Collectors.toMap(
Map<KeyExtent, List<Range>> retFailures = scanResult.getFailures().entrySet().stream().collect(Collectors.toMap(
entry -> KeyExtent.fromThrift(entry.getKey()),
entry -> entry.getValue().stream().map(Range::new).collect(Collectors.toList())
));
Expand All @@ -773,25 +773,25 @@ static void trackScanning(Map<KeyExtent,List<Range>> failures,

// translate full scans and remove them from unscanned
Set<KeyExtent> fullScans =
scanResult.fullScans.stream().map(KeyExtent::fromThrift).collect(Collectors.toSet());
scanResult.getFullScans().stream().map(KeyExtent::fromThrift).collect(Collectors.toSet());
unscanned.keySet().removeAll(fullScans);

// remove partial scan from unscanned
if (scanResult.partScan != null) {
KeyExtent ke = KeyExtent.fromThrift(scanResult.partScan);
Key nextKey = new Key(scanResult.partNextKey);
if (scanResult.getPartScan() != null) {
KeyExtent ke = KeyExtent.fromThrift(scanResult.getPartScan());
Key nextKey = new Key(scanResult.getPartNextKey());

ListIterator<Range> iterator = unscanned.get(ke).listIterator();
while (iterator.hasNext()) {
Range range = iterator.next();

if (range.afterEndKey(nextKey) || (nextKey.equals(range.getEndKey())
&& scanResult.partNextKeyInclusive != range.isEndKeyInclusive())) {
&& scanResult.isPartNextKeyInclusive() != range.isEndKeyInclusive())) {
iterator.remove();
} else if (range.contains(nextKey)) {
iterator.remove();
Range partRange = new Range(nextKey, scanResult.partNextKeyInclusive, range.getEndKey(),
range.isEndKeyInclusive());
Range partRange = new Range(nextKey, scanResult.isPartNextKeyInclusive(),
range.getEndKey(), range.isEndKeyInclusive());
iterator.add(partRange);
}
}
Expand Down Expand Up @@ -936,33 +936,35 @@ static void doLookup(ClientContext context, String server, Map<KeyExtent,List<Ra
ByteBufferUtil.toByteBuffers(authorizations.getAuthorizations()), waitForWrites,
SamplerConfigurationImpl.toThrift(options.getSamplerConfiguration()),
options.batchTimeout, options.classLoaderContext, execHints, busyTimeout);
scanIdToClose = imsr.scanID;
scanIdToClose = imsr.getScanID();
if (waitForWrites) {
ThriftScanner.serversWaitedForWrites.get(ttype).add(server.toString());
}

MultiScanResult scanResult = imsr.result;
MultiScanResult scanResult = imsr.getResult();

if (timer != null) {
log.trace("Got 1st multi scan results, #results={} {} in {}", scanResult.results.size(),
(scanResult.more ? "scanID=" + imsr.scanID : ""),
log.trace("Got 1st multi scan results, #results={} {} in {}",
scanResult.getResults().size(),
(scanResult.isMore() ? "scanID=" + imsr.getScanID() : ""),
String.format("%.3f secs", timer.elapsed(MILLISECONDS) / 1000.0));
}

ArrayList<Entry<Key,Value>> entries = new ArrayList<>(scanResult.results.size());
for (TKeyValue kv : scanResult.results) {
entries.add(new SimpleImmutableEntry<>(new Key(kv.key), new Value(kv.value)));
ArrayList<Entry<Key,Value>> entries = new ArrayList<>(scanResult.getResults().size());
for (TKeyValue kv : scanResult.getResults()) {
entries.add(new SimpleImmutableEntry<>(new Key(kv.getKey()), new Value(kv.getValue())));
}

if (!entries.isEmpty()) {
receiver.receive(entries);
}

if (!entries.isEmpty() || !scanResult.fullScans.isEmpty() || scanResult.partScan != null) {
if (!entries.isEmpty() || !scanResult.getFullScans().isEmpty()
|| scanResult.getPartScan() != null) {
// Got some data back, finished scanning a tablet w/o getting data, or partially scanned a
// tablet w/o getting data. Any of these indicate the scan is making progress.
timeoutSession.madeProgress();
} else if (!scanResult.failures.isEmpty()) {
} else if (!scanResult.getFailures().isEmpty()) {
// Observed no progress and only tablets failed. Want to eventually timeout if this
// situation continues.
timeoutTracker.sawOnlyFailures(timeoutSession);
Expand All @@ -972,44 +974,45 @@ static void doLookup(ClientContext context, String server, Map<KeyExtent,List<Ra

AtomicLong nextOpid = new AtomicLong();

while (scanResult.more) {
while (scanResult.isMore()) {

timeoutSession.check();

if (timer != null) {
log.trace("oid={} Continuing multi scan, scanid={}", nextOpid.get(), imsr.scanID);
log.trace("oid={} Continuing multi scan, scanid={}", nextOpid.get(), imsr.getScanID());
timer.restart();
}

scanResult = client.continueMultiScan(TraceUtil.traceInfo(), imsr.scanID, busyTimeout);
scanResult =
client.continueMultiScan(TraceUtil.traceInfo(), imsr.getScanID(), busyTimeout);

if (timer != null) {
log.trace("oid={} Got more multi scan results, #results={} {} in {}",
nextOpid.getAndIncrement(), scanResult.results.size(),
(scanResult.more ? " scanID=" + imsr.scanID : ""),
nextOpid.getAndIncrement(), scanResult.getResults().size(),
(scanResult.isMore() ? " scanID=" + imsr.getScanID() : ""),
String.format("%.3f secs", timer.elapsed(MILLISECONDS) / 1000.0));
}

entries = new ArrayList<>(scanResult.results.size());
for (TKeyValue kv : scanResult.results) {
entries.add(new SimpleImmutableEntry<>(new Key(kv.key), new Value(kv.value)));
entries = new ArrayList<>(scanResult.getResults().size());
for (TKeyValue kv : scanResult.getResults()) {
entries.add(new SimpleImmutableEntry<>(new Key(kv.getKey()), new Value(kv.getValue())));
}

if (!entries.isEmpty()) {
receiver.receive(entries);
}

if (!entries.isEmpty() || !scanResult.fullScans.isEmpty()
|| scanResult.partScan != null) {
if (!entries.isEmpty() || !scanResult.getFullScans().isEmpty()
|| scanResult.getPartScan() != null) {
timeoutSession.madeProgress();
} else if (!scanResult.failures.isEmpty()) {
} else if (!scanResult.getFailures().isEmpty()) {
timeoutTracker.sawOnlyFailures(timeoutSession);
}

trackScanning(failures, unscanned, scanResult);
}

client.closeMultiScan(TraceUtil.traceInfo(), imsr.scanID);
client.closeMultiScan(TraceUtil.traceInfo(), imsr.getScanID());
scanIdToClose = null;

} finally {
Expand All @@ -1034,7 +1037,7 @@ static void doLookup(ClientContext context, String server, Map<KeyExtent,List<Ra
throw new IOException(e);
} catch (ThriftSecurityException e) {
log.debug("Server : {} msg : {}", server, e.getMessage(), e);
throw new AccumuloSecurityException(e.user, e.code, e);
throw new AccumuloSecurityException(e.getUser(), e.getCode(), e);
} catch (TApplicationException e) {
log.debug("Server : {} msg : {}", server, e.getMessage(), e);
throw new AccumuloServerException(server, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -882,8 +882,8 @@ public void send(TabletServerMutations<Mutation> tsm)
sessionCloser);
} catch (ThriftSecurityException e) {
updateAuthorizationFailures(
mutationBatch.keySet().stream().collect(toMap(identity(), ke -> e.code)));
throw new AccumuloSecurityException(e.user, e.code, e);
mutationBatch.keySet().stream().collect(toMap(identity(), ke -> e.getCode())));
throw new AccumuloSecurityException(e.getUser(), e.getCode(), e);
}

long st2 = System.currentTimeMillis();
Expand Down Expand Up @@ -983,15 +983,15 @@ private MutationSet sendMutationsToTabletServer(String location,
sessionCloser.clearSession();

// @formatter:off
Map<KeyExtent,Long> failures = updateErrors.failedExtents.entrySet().stream().collect(toMap(
Map<KeyExtent,Long> failures = updateErrors.getFailedExtents().entrySet().stream().collect(toMap(
entry -> KeyExtent.fromThrift(entry.getKey()),
Entry::getValue
));
// @formatter:on
updatedConstraintViolations(updateErrors.violationSummaries.stream()
updatedConstraintViolations(updateErrors.getViolationSummaries().stream()
.map(ConstraintViolationSummary::new).collect(toList()));
// @formatter:off
updateAuthorizationFailures(updateErrors.authorizationFailures.entrySet().stream().collect(toMap(
updateAuthorizationFailures(updateErrors.getAuthorizationFailures().entrySet().stream().collect(toMap(
entry -> KeyExtent.fromThrift(entry.getKey()),
Entry::getValue
)));
Expand Down Expand Up @@ -1035,8 +1035,8 @@ private MutationSet sendMutationsToTabletServer(String location,
// no need to close the session when unretryable errors happen
sessionCloser.clearSession();
updateAuthorizationFailures(
tabMuts.keySet().stream().collect(toMap(identity(), ke -> e.code)));
throw new AccumuloSecurityException(e.user, e.code, e);
tabMuts.keySet().stream().collect(toMap(identity(), ke -> e.getCode())));
throw new AccumuloSecurityException(e.getUser(), e.getCode(), e);
} catch (TException e) {
throw new IOException(e);
}
Expand Down
Loading