nickwallen opened a new pull request #1345: METRON-2012 Unable to Execute Stellar Functions Against HBase in the REPL URL: https://github.com/apache/metron/pull/1345 When running any functions that attempt to access HBase from the REPL, an IllegalAccessError exception is thrown. This can be replicated with Stellar functions like ENRICHMENT_GET and PROFILE_GET that attempt to read from HBase. To replicate, start the Stellar REPL with HBase and Zookeeper running and accessible. ``` [root@node1 ~]# source /etc/default/metron [root@node1 ~]# cd $METRON_HOME [root@node1 0.7.1]# bin/stellar -z $ZOOKEEPER [Stellar]>>> ENRICHMENT_GET("example","192.168.1.1","example","E") 2019-01-30 08:51:31 ERROR SimpleHBaseEnrichmentFunctions:251 - Unable to call exists: java.lang.IllegalAccessError: tried to access method com.google.common.base.Stopwatch.<init>()V from class org.apache.hadoop.hbase.zookeeper.MetaTableLocator org.apache.hadoop.hbase.DoNotRetryIOException: java.lang.IllegalAccessError: tried to access method com.google.common.base.Stopwatch.<init>()V from class org.apache.hadoop.hbase.zookeeper.MetaTableLocator at org.apache.hadoop.hbase.client.RpcRetryingCaller.translateException(RpcRetryingCaller.java:229) at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:140) at org.apache.hadoop.hbase.client.HTable.get(HTable.java:879) at org.apache.hadoop.hbase.client.HTable.get(HTable.java:845) at org.apache.metron.enrichment.lookup.EnrichmentLookup$Handler.get(EnrichmentLookup.java:70) at org.apache.metron.enrichment.lookup.EnrichmentLookup$Handler.get(EnrichmentLookup.java:52) at org.apache.metron.enrichment.lookup.Lookup.get(Lookup.java:68) at org.apache.metron.enrichment.stellar.SimpleHBaseEnrichmentFunctions$EnrichmentGet.apply(SimpleHBaseEnrichmentFunctions.java:245) at org.apache.metron.stellar.common.StellarCompiler.lambda$exitTransformationFunc$13(StellarCompiler.java:664) at org.apache.metron.stellar.common.StellarCompiler$Expression.apply(StellarCompiler.java:259) at org.apache.metron.stellar.common.BaseStellarProcessor.parse(BaseStellarProcessor.java:151) at org.apache.metron.stellar.common.shell.DefaultStellarShellExecutor.executeStellar(DefaultStellarShellExecutor.java:407) at org.apache.metron.stellar.common.shell.DefaultStellarShellExecutor.execute(DefaultStellarShellExecutor.java:257) at org.apache.metron.stellar.common.shell.cli.StellarShell.execute(StellarShell.java:359) at org.jboss.aesh.console.AeshProcess.run(AeshProcess.java:53) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.IllegalAccessError: tried to access method com.google.common.base.Stopwatch.<init>()V from class org.apache.hadoop.hbase.zookeeper.MetaTableLocator at org.apache.hadoop.hbase.zookeeper.MetaTableLocator.blockUntilAvailable(MetaTableLocator.java:596) at org.apache.hadoop.hbase.zookeeper.MetaTableLocator.blockUntilAvailable(MetaTableLocator.java:580) at org.apache.hadoop.hbase.zookeeper.MetaTableLocator.blockUntilAvailable(MetaTableLocator.java:559) at org.apache.hadoop.hbase.client.ZooKeeperRegistry.getMetaRegionLocation(ZooKeeperRegistry.java:61) at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateMeta(ConnectionManager.java:1185) at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1152) at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.relocateRegion(ConnectionManager.java:1126) at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegionInMeta(ConnectionManager.java:1331) at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1155) at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1139) at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1096) at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.getRegionLocation(ConnectionManager.java:931) at org.apache.hadoop.hbase.client.HRegionLocator.getRegionLocation(HRegionLocator.java:83) at org.apache.hadoop.hbase.client.RegionServerCallable.prepare(RegionServerCallable.java:79) at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:124) ... 16 more {} ``` ``` [Stellar]>>> PROFILE_GET("hello-world","192.168.1.1",PROFILE_FIXED(30, "DAYS")) [!] Unable to parse: PROFILE_GET("hello-world","192.168.1.1",PROFILE_FIXED(30, "DAYS")) due to: tried to access method com.google.common.base.Stopwatch.<init>()V from class org.apache.hadoop.hbase.zookeeper.MetaTableLocator org.apache.metron.stellar.dsl.ParseException: Unable to parse: PROFILE_GET("hello-world","192.168.1.1",PROFILE_FIXED(30, "DAYS")) due to: tried to access method com.google.common.base.Stopwatch.<init>()V from class org.apache.hadoop.hbase.zookeeper.MetaTableLocator at org.apache.metron.stellar.common.BaseStellarProcessor.createException(BaseStellarProcessor.java:166) at org.apache.metron.stellar.common.BaseStellarProcessor.parse(BaseStellarProcessor.java:154) at org.apache.metron.stellar.common.shell.DefaultStellarShellExecutor.executeStellar(DefaultStellarShellExecutor.java:407) at org.apache.metron.stellar.common.shell.DefaultStellarShellExecutor.execute(DefaultStellarShellExecutor.java:257) at org.apache.metron.stellar.common.shell.cli.StellarShell.execute(StellarShell.java:359) at org.jboss.aesh.console.AeshProcess.run(AeshProcess.java:53) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.IllegalAccessError: tried to access method com.google.common.base.Stopwatch.<init>()V from class org.apache.hadoop.hbase.zookeeper.MetaTableLocator at org.apache.hadoop.hbase.zookeeper.MetaTableLocator.blockUntilAvailable(MetaTableLocator.java:596) at org.apache.hadoop.hbase.zookeeper.MetaTableLocator.blockUntilAvailable(MetaTableLocator.java:580) at org.apache.hadoop.hbase.zookeeper.MetaTableLocator.blockUntilAvailable(MetaTableLocator.java:559) at org.apache.hadoop.hbase.client.ZooKeeperRegistry.getMetaRegionLocation(ZooKeeperRegistry.java:61) at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateMeta(ConnectionManager.java:1185) at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1152) at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.relocateRegion(ConnectionManager.java:1126) at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegionInMeta(ConnectionManager.java:1331) at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1155) at org.apache.hadoop.hbase.client.AsyncProcess$AsyncRequestFutureImpl.findAllLocationsOrFail(AsyncProcess.java:940) at org.apache.hadoop.hbase.client.AsyncProcess$AsyncRequestFutureImpl.groupAndSendMultiAction(AsyncProcess.java:857) at org.apache.hadoop.hbase.client.AsyncProcess$AsyncRequestFutureImpl.access$100(AsyncProcess.java:575) at org.apache.hadoop.hbase.client.AsyncProcess.submitAll(AsyncProcess.java:557) at org.apache.hadoop.hbase.client.HTable.batch(HTable.java:923) at org.apache.hadoop.hbase.client.HTable.batch(HTable.java:940) at org.apache.hadoop.hbase.client.HTable.get(HTable.java:901) at org.apache.metron.profiler.client.HBaseProfilerClient.doFetch(HBaseProfilerClient.java:138) at org.apache.metron.profiler.client.HBaseProfilerClient.fetch(HBaseProfilerClient.java:120) at org.apache.metron.profiler.client.stellar.GetProfile.apply(GetProfile.java:182) at org.apache.metron.stellar.common.StellarCompiler.lambda$exitTransformationFunc$13(StellarCompiler.java:664) at org.apache.metron.stellar.common.StellarCompiler$Expression.apply(StellarCompiler.java:259) at org.apache.metron.stellar.common.BaseStellarProcessor.parse(BaseStellarProcessor.java:151) ... 7 more ``` ### Changes The Stellar REPL is being launched in a manner that pulls in multiple conflicting versions of Guava. Guava 17 was being used by `metron-management` and `metron-parsers-storm`, but the `metron-profiler-client` was unexpectedly pulling in Guava 12 through the `metron-hbase` project. * Altered the Profiler Client so that it does not depend on Guava. * Excluded Guava from any Profiler Client dependencies. * Removed unnecessary Hadoop dependencies from the Profiler family of projects. * Ensure that Netty 4.1.13 is explicitly being pulled in for the Elasticsearch integration tests. ### What's Lacking? * We do not have any automated tests that would have caught this issue. To do that we would need some tests that exercise the REPL after it is launched using the $METRON_HOME/bin/stellar script along with the deployed shaded JARs. ### Testing #### End to End 1. Ensure that we can continue to parse, enrich, and index telemetry. Launch the development environment and ensure that telemetry is visible within the Alerts UI. #### Streaming Enrichment 1. Create a Streaming Enrichment [by following these instructions](https://cwiki.apache.org/confluence/display/METRON/2016/06/16/Metron+Tutorial+-+Fundamentals+Part+6%3A+Streaming+Enrichment). 1. Define the streaming enrichment and save it as a new source of telemetry. ``` [Stellar]>>> conf := SHELL_EDIT() { "parserClassName": "org.apache.metron.parsers.csv.CSVParser", "writerClassName": "org.apache.metron.enrichment.writer.SimpleHbaseEnrichmentWriter", "sensorTopic": "user", "parserConfig": { "shew.table": "enrichment", "shew.cf": "t", "shew.keyColumns": "ip", "shew.enrichmentType": "user", "columns": { "user": 0, "ip": 1 } } } [Stellar]>>> [Stellar]>>> CONFIG_PUT("PARSER", conf, "user") ``` 1. Go to the Management UI and start the new parser called 'user'. 1. Create some test telemetry. ``` [Stellar]>>> msgs := ["user1,192.168.1.1", "user2,192.168.1.2", "user3,192.168.1.3"] [user1,192.168.1.1, user2,192.168.1.2, user3,192.168.1.3] [Stellar]>>> KAFKA_PUT("user", msgs) 3 [Stellar]>>> KAFKA_PUT("user", msgs) 3 [Stellar]>>> KAFKA_PUT("user", msgs) 3 ``` 1. Ensure that the enrichments are persisted in HBase. ``` [Stellar]>>> ENRICHMENT_GET('user', '192.168.1.1', 'enrichment', 't') {original_string=user1,192.168.1.1, guid=a6caf3c1-2506-4eb7-b33e-7c05b77cd72c, user=user1, timestamp=1551813589399, source.type=user} [Stellar]>>> ENRICHMENT_GET('user', '192.168.1.2', 'enrichment', 't') {original_string=user2,192.168.1.2, guid=49e4b8fa-c797-44f0-b041-cfb47983d54a, user=user2, timestamp=1551813589399, source.type=user} [Stellar]>>> ENRICHMENT_GET('user', '192.168.1.3', 'enrichment', 't') {original_string=user3,192.168.1.3, guid=324149fd-6c4c-42a3-b579-e218c032ea7f, user=user3, timestamp=1551813589402, source.type=user} ``` #### Profiler 1. Test a profile in the REPL according to [these instructions](https://github.com/apache/metron/tree/master/metron-analytics/metron-profiler-repl#getting-started). ``` [Stellar]>>> values := PROFILER_FLUSH(profiler) [{period={duration=900000, period=1723089, start=1550780100000, end=1550781000000}, profile=hello-world, groups=[], value=4, entity=192.168.138.158}] ``` 1. Deploy that profile to the Streaming Profiler. ``` [Stellar]>>> CONFIG_PUT("PROFILER", conf) ``` 1. Wait for the Streaming Profiler in Storm to flush and retrieve the measurement from HBase. For the impatient, you can reset the period duration to 1 minute. Alternatively, you can allow the Profiler topology to work for a minute or two and then kill the `profiler` topology which will force it to flush a profile measurement to HBase. Retrieve the measurement from HBase. Prior to this PR, it was not possible to query HBase from the REPL. ``` [Stellar]>>> PROFILE_GET("hello-world","192.168.138.158",PROFILE_FIXED(30,"DAYS")) [2979] ``` 1. Install Spark using Ambari. 1. Stop Storm, YARN, Elasticsearch, Kibana, and Kafka. 1. Install Spark2 using Ambari. 1. Ensure that Spark can talk with HBase. ``` cp /etc/hbase/conf/hbase-site.xml /etc/spark2/conf/ ``` 1. Use the Batch Profiler to back-fill your profile. To do this, follow the direction [provided here](https://github.com/apache/metron/tree/master/metron-analytics/metron-profiler-spark#getting-started). 1. Retrieve the entire profile, including the back-filled data. ``` [Stellar]>>> PROFILE_GET("hello-world","192.168.138.158",PROFILE_FIXED(30,"DAYS")) [1203, 2849, 2900, 1944, 1054, 1241, 1721] ``` ## Pull Request Checklist - [x] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel). - [x] Does your PR title start with METRON-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [x] Has your PR been rebased against the latest commit within the target branch (typically master)? - [x] Have you included steps to reproduce the behavior or problem that is being changed or addressed? - [x] Have you included steps or a guide to how the change may be verified and tested manually? - [x] Have you ensured that the full suite of tests and checks have been executed in the root metron folder via: - [x] Have you written or updated unit tests and or integration tests to verify your changes? - [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [x] Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services