You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@accumulo.apache.org by z11373 <z1...@outlook.com> on 2015/11/17 20:00:17 UTC
hasNext throws weird exception
The code does following:
+ Create scanner and pass column visibility CV (user indeed has that authz)
+ Set ranges for that scanner
+ For loop code:
for (Map.Entry<Key, Value> entry : scanner) {
// get the entry's key and perform additional work
}
The weird thing is this exception is thrown, and it points to exactly the
line where that for () statement is. I obsfucated the code below with xxx,
but it is real exception. The user indeed HAS that authz, in fact it works
fine in other scan code. Even more weird, the code inside for loop also
executed fine (as I can see the output).
Any idea? Is this a known issue?
Thanks,
Z
[ERROR] 2015-11-17 18:47:02,858 xxx lambda$deleteAll$0 - Exception at
deleteAll:
java.lang.RuntimeException:
org.apache.accumulo.core.client.AccumuloSecurityException: Error
BAD_AUTHORIZATIONS for user foo on table T1(ID:f) - The user does not have
the specified authorizations assigned
at
org.apache.accumulo.core.client.impl.ScannerIterator.hasNext(ScannerIterator.java:187)
at xxx.deleteAllItems(xxx.java:313)
at xxx.lambda$deleteAll$0(xxx.java:214)
at xxx$$Lambda$3/276735975.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.accumulo.core.client.AccumuloSecurityException: Error
BAD_AUTHORIZATIONS for user foo on table T2(ID:f) - The user does not have
the specified authorizations assigned
at
org.apache.accumulo.core.client.impl.ThriftScanner.scan(ThriftScanner.java:458)
at
org.apache.accumulo.core.client.impl.ThriftScanner.scan(ThriftScanner.java:279)
at
org.apache.accumulo.core.client.impl.ScannerIterator$Reader.run(ScannerIterator.java:84)
at
org.apache.accumulo.core.client.impl.ScannerIterator.hasNext(ScannerIterator.java:177)
... 4 more
Caused by: ThriftSecurityException(user:foo, code:BAD_AUTHORIZATIONS)
at
org.apache.accumulo.core.tabletserver.thrift.TabletClientService$startScan_result$startScan_resultStandardScheme.read(TabletClientService.java:6548)
at
org.apache.accumulo.core.tabletserver.thrift.TabletClientService$startScan_result$startScan_resultStandardScheme.read(TabletClientService.java:6525)
at
org.apache.accumulo.core.tabletserver.thrift.TabletClientService$startScan_result.read(TabletClientService.java:6448)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78)
at
org.apache.accumulo.core.tabletserver.thrift.TabletClientService$Client.recv_startScan(TabletClientService.java:228)
at
org.apache.accumulo.core.tabletserver.thrift.TabletClientService$Client.startScan(TabletClientService.java:204)
at
org.apache.accumulo.core.client.impl.ThriftScanner.scan(ThriftScanner.java:403)
... 7 more
--
View this message in context: http://apache-accumulo.1065345.n5.nabble.com/hasNext-throws-weird-exception-tp15586.html
Sent from the Developers mailing list archive at Nabble.com.
Re: hasNext throws weird exception
Posted by z11373 <z1...@outlook.com>.
That really makes sense. Thanks Christ!
--
View this message in context: http://apache-accumulo.1065345.n5.nabble.com/hasNext-throws-weird-exception-tp15586p15602.html
Sent from the Developers mailing list archive at Nabble.com.
Re: hasNext throws weird exception
Posted by Christopher <ct...@apache.org>.
When you call the iterator method on a scanner, Accumulo instantiates a
bunch of internal data structures that are specific to that iterator/query.
Scanner is basically a configuration object which has iterator as a factory
method. The iterator is really what does the query work. Calling iterator
multiple times creates multiple, independent queries.
On Thu, Nov 19, 2015, 12:44 z11373 <z1...@outlook.com> wrote:
> Thanks Christopher! What are those separate iterations? The scanner object
> was not shared (besides it's only single thread), and also my test app is
> the only client app running at that time.
> I am just curious, however, the code you suggested is a good practice, and
> I'll keep in mind.
>
> Thanks,
> Z
>
>
>
> --
> View this message in context:
> http://apache-accumulo.1065345.n5.nabble.com/hasNext-throws-weird-exception-tp15586p15600.html
> Sent from the Developers mailing list archive at Nabble.com.
>
Re: hasNext throws weird exception
Posted by z11373 <z1...@outlook.com>.
Thanks Christopher! What are those separate iterations? The scanner object
was not shared (besides it's only single thread), and also my test app is
the only client app running at that time.
I am just curious, however, the code you suggested is a good practice, and
I'll keep in mind.
Thanks,
Z
--
View this message in context: http://apache-accumulo.1065345.n5.nabble.com/hasNext-throws-weird-exception-tp15586p15600.html
Sent from the Developers mailing list archive at Nabble.com.
Re: hasNext throws weird exception
Posted by Christopher <ct...@apache.org>.
Different scanner.iterator() executions will refer to separate
iterations. The first code should be modified to look like:
Iterator iter = scanner.iterator();
while (iter.hasNext()) { ... iter.next() ...}
Only then would it be the same as the foreach syntax you showed.
--
Christopher L Tubbs II
http://gravatar.com/ctubbsii
On Thu, Nov 19, 2015 at 10:15 AM, z11373 <z1...@outlook.com> wrote:
> Hi Josh,
> This one seems weird however, and this time is not my mistake with 99%
> certainty :-)
>
> When I wrote my code like this:
> while (scanner.iterator().hasNext()) { // call scanner.iterator().next()
> somewhere }
>
> The hasNext() somehow never got evaluated to true. Then I changed the code
> becomes:
>
> for (Map.Entry<Key, Value> entry : scanner) { // do something with entry var
> }
>
> It works fine. I'd think both should behave same, right?
>
>
> Thanks,
> Z
>
>
>
> --
> View this message in context: http://apache-accumulo.1065345.n5.nabble.com/hasNext-throws-weird-exception-tp15586p15598.html
> Sent from the Developers mailing list archive at Nabble.com.
Re: hasNext throws weird exception
Posted by z11373 <z1...@outlook.com>.
Hi Josh,
This one seems weird however, and this time is not my mistake with 99%
certainty :-)
When I wrote my code like this:
while (scanner.iterator().hasNext()) { // call scanner.iterator().next()
somewhere }
The hasNext() somehow never got evaluated to true. Then I changed the code
becomes:
for (Map.Entry<Key, Value> entry : scanner) { // do something with entry var
}
It works fine. I'd think both should behave same, right?
Thanks,
Z
--
View this message in context: http://apache-accumulo.1065345.n5.nabble.com/hasNext-throws-weird-exception-tp15586p15598.html
Sent from the Developers mailing list archive at Nabble.com.
Re: hasNext throws weird exception
Posted by Josh Elser <jo...@gmail.com>.
These things happen :)
z11373 wrote:
> Found out the issue, my bad :-(
>
>
>
> --
> View this message in context: http://apache-accumulo.1065345.n5.nabble.com/hasNext-throws-weird-exception-tp15586p15587.html
> Sent from the Developers mailing list archive at Nabble.com.
Re: hasNext throws weird exception
Posted by z11373 <z1...@outlook.com>.
Found out the issue, my bad :-(
--
View this message in context: http://apache-accumulo.1065345.n5.nabble.com/hasNext-throws-weird-exception-tp15586p15587.html
Sent from the Developers mailing list archive at Nabble.com.