accumulo icon indicating copy to clipboard operation
accumulo copied to clipboard

RFileScanner's IteratorEnvironment throws UnsupportedOperationException for getConfig() and getServiceEnv()

Open FineAndDandy opened this issue 1 year ago • 7 comments

Describe the bug When attaching an iterator to an RFileScanner which uses either the iterator environments config or ServiceEnvironment, the iterators will throw UnsupportedOperationExceptions

Versions (OS, Maven, Java, and others, as appropriate): Accumulo 2.x

To Reproduce Steps to reproduce the behavior (or a link to an example repository that reproduces the problem):

  1. Create an RFileScanner
  2. Attach an Iterator which in the init method calls env.getConfig() or env.getServiceEnv()

Expected behavior The config for the RFileScanner should be built from any table properties passed into the builder's withTableProperties() method. These properties can also be returned for any env.getServiceEnv().getConfiguration() or env.getServiceEnv().getConfiguration(TableId) methods.

FineAndDandy avatar Aug 15 '24 12:08 FineAndDandy

These methods have both been deprecated (getConfig() since 2.0.0 and getServiceEnv() since 2.1.0) and replaced with getPluginEnv() (since 2.1.0).

The equivalent to env.getServiceEnv() would now be env.getPluginEnv()

and the equivalent to env.getConfig() would now be env.getPluginEnv().getConfiguration(env.getTableId())

Hope this helps!

kevinrr888 avatar Aug 15 '24 16:08 kevinrr888

@kevinrr888 are you saying that using the replacement APIs fixes the issue, or are you just adding extra context to whoever works on fixing the bug?

ctubbsii avatar Aug 16 '24 02:08 ctubbsii

@kevinrr888 using getPluginEnv() under the covers calls getServiceEnv(), leading to the same UnsupportedOperationException. The issue is the RFileScanner uses an IteratorEnvironment implementation which implements none of these methods.

FineAndDandy avatar Aug 16 '24 11:08 FineAndDandy

@FineAndDandy

Yes, you are right

I saw that getPluginEnv() just called getServiceEnv() but tested (or so I thought) the RFileScanner and it was working for getPluginEnv() and getServiceEnv(). I assumed the IteratorEnvironment used for RFileScanner had these methods implemented. Upon looking and testing again, I see the same problem as you.

Looking into this and potentially more issues with IteratorEnvironment and its implemenations...

@ctubbsii

I thought this replacement fixed the issue, but now see that this is not the case

kevinrr888 avatar Aug 16 '24 14:08 kevinrr888

OfflineIteratorEnvironment has similar issues

FineAndDandy avatar Aug 16 '24 15:08 FineAndDandy

@FineAndDandy - The issue with OfflineIteratorEnvironment should be fixed in the latest release - 2.1.3 (which was very recently released). Are you on an earlier version?

kevinrr888 avatar Aug 19 '24 20:08 kevinrr888

https://github.com/apache/accumulo/pull/4283 Related code changes are here.

ddanielr avatar Aug 19 '24 21:08 ddanielr