accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joshelser <...@git.apache.org>
Subject [GitHub] accumulo pull request: ACCUMULO-3602 BatchScanner optimization for...
Date Thu, 02 Apr 2015 02:16:21 GMT
Github user joshelser commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/25#discussion_r27628573
  
    --- Diff: core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java
---
    @@ -433,24 +435,76 @@ public void initialize(InputSplit inSplit, JobConf job) throws IOException
{
           // but the scanner will use the table id resolved at job setup time
           InputTableConfig tableConfig = getInputTableConfig(job, split.getTableName());
     
    -      Boolean isOffline = split.isOffline();
    -      if (null == isOffline) {
    -        isOffline = tableConfig.isOfflineScan();
    -      }
    +      log.debug("Creating connector with user: " + principal);
    +      log.debug("Creating scanner for table: " + table);
    +      log.debug("Authorizations are: " + authorizations);
     
    -      Boolean isIsolated = split.isIsolatedScan();
    -      if (null == isIsolated) {
    -        isIsolated = tableConfig.shouldUseIsolatedScanners();
    -      }
    +      if (split instanceof org.apache.accumulo.core.client.mapreduce.RangeInputSplit)
{
    +        org.apache.accumulo.core.client.mapreduce.RangeInputSplit rangeSplit = (org.apache.accumulo.core.client.mapreduce.RangeInputSplit)
split;
     
    -      Boolean usesLocalIterators = split.usesLocalIterators();
    -      if (null == usesLocalIterators) {
    -        usesLocalIterators = tableConfig.shouldUseLocalIterators();
    -      }
    +        Boolean isOffline = rangeSplit.isOffline();
    +        if (null == isOffline) {
    +          isOffline = tableConfig.isOfflineScan();
    +        }
    +
    +        Boolean isIsolated = rangeSplit.isIsolatedScan();
    +        if (null == isIsolated) {
    +          isIsolated = tableConfig.shouldUseIsolatedScanners();
    +        }
     
    -      List<IteratorSetting> iterators = split.getIterators();
    -      if (null == iterators) {
    -        iterators = tableConfig.getIterators();
    +        Boolean usesLocalIterators = rangeSplit.usesLocalIterators();
    +        if (null == usesLocalIterators) {
    +          usesLocalIterators = tableConfig.shouldUseLocalIterators();
    +        }
    +
    +        Scanner scanner;
    +
    +        try {
    +          if (isOffline) {
    +            scanner = new OfflineScanner(instance, new Credentials(principal, token),
split.getTableId(), authorizations);
    +          } else if (instance instanceof MockInstance) {
    +            scanner = instance.getConnector(principal, token).createScanner(split.getTableName(),
authorizations);
    +          } else {
    +            ClientConfiguration clientConf = getClientConfiguration(job);
    +            ClientContext context = new ClientContext(instance, new Credentials(principal,
token), clientConf);
    +            scanner = new ScannerImpl(context, split.getTableId(), authorizations);
    +          }
    +          if (isIsolated) {
    +            log.info("Creating isolated scanner");
    +            scanner = new IsolatedScanner(scanner);
    +          }
    +          if (usesLocalIterators) {
    +            log.info("Using local iterators");
    +            scanner = new ClientSideIteratorScanner(scanner);
    +          }
    +          setupIterators(job, scanner, split.getTableName(), split);
    +        } catch (Exception e) {
    +          throw new IOException(e);
    +        }
    +
    +        scanner.setRange(rangeSplit.getRange());
    +
    +        // do this last after setting all scanner options
    +        scannerIterator = scanner.iterator();
    --- End diff --
    
    Duplicated call to `scanner.iterator()`. Looks like you do it down below too?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message