[TINKERPOP 3107] Remove Groovy dependency from default server initialization#3384
Conversation
|
Can you add unit test to verify gremlin-groovy is disabled? something like |
cd8dce5 to
774548f
Compare
I've adapted this test and added it to the server integration tests. I've given it extra cases to additionally verify error responses if the driver explicitly asks for |
|
A lot of the test files do something like |
| case "sink": | ||
| TinkerFactory.generateKitchenSink(tinkerGraph); | ||
| break; | ||
| case "airroutes": |
There was a problem hiding this comment.
Does this take into account the min-jar build that won't come with the kryo data for air-routes?
There was a problem hiding this comment.
It's not explicitly handled here, but it implicitly behaves in the way I would expect. TinkerFactory.generateAirRoutes() already throws an IllegalStateException with a clear message about the min classifier if the file is not found. That error will propagate through the hook and ultimately cause the server to fail to start. I think this is the safest way of handling this case.
|
VOTE +1 |
…ation
Gremlin Server currently relies on Groovy init scripts for server
initialization — binding traversal sources, running lifecycle hooks,
and loading data. This introduces a Groovy-free initialization path
so that Groovy can be disabled by default in all shipped server configs.
Groovy remains available as an opt-in for backward compatibility.
Three new YAML configuration mechanisms replace the Groovy init scripts:
Auto-created TraversalSources — After graphs are loaded, a default
TraversalSource is automatically created for each graph that doesn't
have an explicit traversalSources entry. A graph named "graph" gets
"g"; others get "g_<name>".
Declarative traversalSources — A new YAML section for explicit
TraversalSource creation with optional strategy configuration:
traversalSources:
g: {graph: graph}
gReadOnly: {graph: graph, gremlinExpression: "g.withStrategies(ReadOnlyStrategy)"}
Java-based lifecycleHooks — A new YAML section for configuring
LifeCycleHook implementations via reflection:
lifecycleHooks:
- className: org.apache.tinkerpop.gremlin.server.util.TinkerFactoryDataLoader
config: {graph: graph, dataset: modern}
Supporting changes:
- TinkerFactoryDataLoader: built-in LifeCycleHook that loads TinkerFactory
sample datasets (modern, classic, crew, grateful, sink, airroutes)
- LifeCycleHook interface: added default init(Map) and GraphManager to Context
- Settings: new TraversalSourceSettings and LifeCycleHookSettings classes
- Script engine allowlist: GremlinExecutor restricts available engines to
those in scriptEngines config (plus gremlin-lang, always permitted)
- Deprecated Groovy-based LifeCycleHook/TraversalSource creation with
startup warnings
- New gremlin-server-airroutes.yaml shipped config
All default configs updated to remove gremlin-groovy from scriptEngines.
Docker and JVM test configs migrated to use traversalSources +
lifecycleHooks instead of Groovy generate scripts.
https://issues.apache.org/jira/browse/TINKERPOP-3107
Gremlin Server currently relies on Groovy init scripts for server initialization — binding traversal sources, running lifecycle hooks, and loading data. This PR introduces a Groovy-free initialization path so that Groovy can be disabled by default in all shipped server configs. Groovy remains available as an
opt-in for backward compatibility.
Changes
Three new YAML configuration mechanisms replace the Groovy init scripts:
Auto-created TraversalSources — After graphs are loaded, a default TraversalSource is automatically created for each graph that doesn't have an explicit traversalSources entry. A graph named graph gets g; others get g_. A minimal config with just a graphs section is now fully functional.
Declarative traversalSources — A new YAML section for explicit TraversalSource creation with optional strategy configuration via a Gremlin query:
yaml
traversalSources: {
g: {graph: graph},
gReadOnly: {graph: graph, query: "g.withStrategies(ReadOnlyStrategy)"}}
Java-based lifecycleHooks — A new YAML section for configuring LifeCycleHook implementations via reflection, replacing Groovy-based hook creation:
yaml
lifecycleHooks:
config: {graph: graph, dataset: modern}
Supporting changes
explicitly listed in
scriptEngines(plusgremlin-lang, which is always permitted).Requests targeting an engine not in the allowlist are rejected. This prevents clients from
invoking gremlin-groovy when it is removed from the default configuration.
Config migrations
All default configs under gremlin-server/conf/ updated to remove gremlin-groovy from scriptEngines. All Docker integration test configs (docker/gremlin-server/) and JVM test configs migrated to use traversalSources + lifecycleHooks instead of generate-all.groovy. The gremlin-console test infrastructure
similarly migrated.
Deleted files
Testing
VOTE +1