act-act about projects rss

Debugging Apache Drill on Windows

TL;DR

I try to remote debug Apache Drill in Embedded Mode with IntelliJ on Windows10.

Prerequirements

  • Apache Drill installation
  • Apache Drill source code(same version)
  • IDEA IntelliJ

Set DRILL_SHELL_JAVA_OPTS

Using sqlline.bat for starting drill as embedded mode. We can set debug options to DRILL_SHELL_JAVA_OPTS.

1
set DRILL_SHELL_JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000

Timeout Configuration

To avoid timeout for debugging, set drill.exec.rpc.user.timeout to 0 in drill-override.conf.

drill-override.conf

1
2
3
4
5
6
7
8
9
drill.exec: {
  cluster-id: "drillbits1",
  zk.connect: "localhost:2181",
  rpc: {
    user: {
      timeout: 0
    }
  }
}

Set breakpoints

In IntelliJ, set breakpoints that you would like to check in source code. If you don’t have such as points, I recommend to set it in Foreman constructor.

drill-dubug-breakpoints.png

Create debuggin configuration in IntelliJ

Select menu Run -> Edit Configuration.

Click + on Remote to create new debug configuration for drill. Then change configuration name and dubugging port.

drill-dubug-config.png

Start drill embedded mode

In command prompt, run sqlline.bat -u "jdbc:drill:zk=local" to start sqlline.

1
2
3
4
5
6
D:\development\drill\apache-drill-1.10.0\bin>sqlline.bat -u "jdbc:drill:zk=local"
DRILL_ARGS - " -u jdbc:drill:zk=local"
HADOOP_HOME not detected...
HBASE_HOME not detected...
Calculating Drill classpath...
Listening for transport dt_socket at address: 8000

Start to debug on IntelliJ

Select menu Run -> Debug 'drill' to start debug drill. Below messages are shown in IntelliJ console.

1
Connected to the target VM, address: 'localhost:8000', transport: 'socket'

Then sqlline starts to wait for SQL input.

1
2
3
apache drill 1.10.0
"json ain't no thang"
0: jdbc:drill:zk=local>

Conclusion

Getting ready for debugging drill. Enjoy it!