-
Notifications
You must be signed in to change notification settings - Fork 460
Modified IteratorEnvironment to no longer throw UOE #5490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d67a38d
08d29a6
00a2758
fdd77d0
c14c35f
b9f12f4
3cec5f7
bf294a4
2d39e46
6c3f356
1c75b6c
aa7e548
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,8 +30,9 @@ | |
|
||
import org.apache.accumulo.core.client.IteratorSetting; | ||
import org.apache.accumulo.core.client.Scanner; | ||
import org.apache.accumulo.core.client.TableNotFoundException; | ||
import org.apache.accumulo.core.client.rfile.RFileScannerBuilder.InputArgs; | ||
import org.apache.accumulo.core.client.sample.SamplerConfiguration; | ||
import org.apache.accumulo.core.clientImpl.ClientServiceEnvironmentImpl; | ||
import org.apache.accumulo.core.clientImpl.ScannerOptions; | ||
import org.apache.accumulo.core.conf.AccumuloConfiguration; | ||
import org.apache.accumulo.core.conf.ConfigurationCopy; | ||
|
@@ -42,6 +43,7 @@ | |
import org.apache.accumulo.core.data.Column; | ||
import org.apache.accumulo.core.data.Key; | ||
import org.apache.accumulo.core.data.Range; | ||
import org.apache.accumulo.core.data.TableId; | ||
import org.apache.accumulo.core.data.Value; | ||
import org.apache.accumulo.core.file.blockfile.cache.impl.BlockCacheConfiguration; | ||
import org.apache.accumulo.core.file.blockfile.cache.impl.BlockCacheManagerFactory; | ||
|
@@ -55,6 +57,7 @@ | |
import org.apache.accumulo.core.iterators.IteratorEnvironment; | ||
import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope; | ||
import org.apache.accumulo.core.iterators.SortedKeyValueIterator; | ||
import org.apache.accumulo.core.iteratorsImpl.ClientIteratorEnvironment; | ||
import org.apache.accumulo.core.iteratorsImpl.IteratorBuilder; | ||
import org.apache.accumulo.core.iteratorsImpl.IteratorConfigUtil; | ||
import org.apache.accumulo.core.iteratorsImpl.system.MultiIterator; | ||
|
@@ -66,6 +69,7 @@ | |
import org.apache.accumulo.core.spi.cache.CacheType; | ||
import org.apache.accumulo.core.spi.crypto.CryptoEnvironment; | ||
import org.apache.accumulo.core.spi.crypto.CryptoService; | ||
import org.apache.accumulo.core.util.ConfigurationImpl; | ||
import org.apache.accumulo.core.util.LocalityGroupUtil; | ||
import org.apache.hadoop.fs.FSDataInputStream; | ||
import org.apache.hadoop.io.Text; | ||
|
@@ -74,8 +78,46 @@ | |
|
||
class RFileScanner extends ScannerOptions implements Scanner { | ||
|
||
private static class RFileScannerEnvironmentImpl extends ClientServiceEnvironmentImpl { | ||
|
||
private final Configuration conf; | ||
private final Configuration tableConf; | ||
|
||
public RFileScannerEnvironmentImpl(Opts opts) { | ||
super(null); | ||
conf = new ConfigurationImpl(new ConfigurationCopy(DefaultConfiguration.getInstance())); | ||
ConfigurationCopy tableCC = new ConfigurationCopy(DefaultConfiguration.getInstance()); | ||
if (opts.tableConfig != null) { | ||
opts.tableConfig.forEach(tableCC::set); | ||
} | ||
tableConf = new ConfigurationImpl(tableCC); | ||
} | ||
|
||
@Override | ||
public String getTableName(TableId tableId) throws TableNotFoundException { | ||
Preconditions.checkArgument(tableId == TABLE_ID, "Expected " + TABLE_ID + " obtained" | ||
+ " from IteratorEnvironment.getTableId(), but got: " + tableId); | ||
return TABLE_NAME; | ||
} | ||
Comment on lines
+96
to
+101
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think |
||
|
||
@Override | ||
public Configuration getConfiguration() { | ||
return conf; | ||
} | ||
|
||
@Override | ||
public Configuration getConfiguration(TableId tableId) { | ||
Preconditions.checkArgument(tableId == TABLE_ID, "Expected " + TABLE_ID + " obtained" | ||
+ " from IteratorEnvironment.getTableId(), but got: " + tableId); | ||
return tableConf; | ||
} | ||
|
||
} | ||
|
||
private static final byte[] EMPTY_BYTES = new byte[0]; | ||
private static final Range EMPTY_RANGE = new Range(); | ||
private static final String TABLE_NAME = "rfileScanner"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be deleted if |
||
private static final TableId TABLE_ID = TableId.of(TABLE_NAME); | ||
Comment on lines
+119
to
+120
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I discussed in more detail here but I'm not sure about a dummy table id/name here. Both In my opinion, a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could spin this off in a separate issue since it was a preexisting pattern in the code. |
||
|
||
private Range range; | ||
private BlockCacheManager blockCacheManager = null; | ||
|
@@ -225,33 +267,6 @@ public void updateScanIteratorOption(String iteratorName, String key, String val | |
super.updateScanIteratorOption(iteratorName, key, value); | ||
} | ||
|
||
private class IterEnv implements IteratorEnvironment { | ||
@Override | ||
public IteratorScope getIteratorScope() { | ||
return IteratorScope.scan; | ||
} | ||
|
||
@Override | ||
public boolean isFullMajorCompaction() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public Authorizations getAuthorizations() { | ||
return opts.auths; | ||
} | ||
|
||
@Override | ||
public boolean isSamplingEnabled() { | ||
return RFileScanner.this.getSamplerConfiguration() != null; | ||
} | ||
|
||
@Override | ||
public SamplerConfiguration getSamplerConfiguration() { | ||
return RFileScanner.this.getSamplerConfiguration(); | ||
} | ||
} | ||
|
||
@Override | ||
public Iterator<Entry<Key,Value>> iterator() { | ||
try { | ||
|
@@ -292,15 +307,23 @@ public Iterator<Entry<Key,Value>> iterator() { | |
EMPTY_BYTES, tableConf); | ||
} | ||
|
||
ClientIteratorEnvironment.Builder iterEnvBuilder = new ClientIteratorEnvironment.Builder() | ||
.withEnvironment(new RFileScannerEnvironmentImpl(opts)).withAuthorizations(opts.auths) | ||
.withScope(IteratorScope.scan).withTableId(TABLE_ID); | ||
if (getSamplerConfiguration() != null) { | ||
iterEnvBuilder.withSamplerConfiguration(getSamplerConfiguration()); | ||
iterEnvBuilder.withSamplingEnabled(); | ||
} | ||
IteratorEnvironment iterEnv = iterEnvBuilder.build(); | ||
try { | ||
if (opts.tableConfig != null && !opts.tableConfig.isEmpty()) { | ||
var ibEnv = IteratorConfigUtil.loadIterConf(IteratorScope.scan, serverSideIteratorList, | ||
serverSideIteratorOptions, tableConf); | ||
var iteratorBuilder = ibEnv.env(new IterEnv()).build(); | ||
var iteratorBuilder = ibEnv.env(iterEnv).build(); | ||
iterator = IteratorConfigUtil.loadIterators(iterator, iteratorBuilder); | ||
} else { | ||
var iteratorBuilder = IteratorBuilder.builder(serverSideIteratorList) | ||
.opts(serverSideIteratorOptions).env(new IterEnv()).build(); | ||
.opts(serverSideIteratorOptions).env(iterEnv).build(); | ||
iterator = IteratorConfigUtil.loadIterators(iterator, iteratorBuilder); | ||
} | ||
} catch (IOException e) { | ||
|
Uh oh!
There was an error while loading. Please reload this page.