Repository: zeppelin Updated Branches: refs/heads/master 401c81370 -> 5e02186df
[ZEPPELIN-908] Apply new mechanism to CassandraInterpreter ### What is this PR for? This handles replacing the registration of interpreter with static block by the interpreter-setting.json file ### What type of PR is it? Sub-ask ### Todos NA ### What is the Jira issue? https://issues.apache.org/jira/browse/ZEPPELIN-908 ### How should this be tested? * There shouldn't be any warning like below on starting the server `INFO [2016-09-29 00:25:46,247] ({main} CassandraInterpreter.java[<clinit>]:155) - Bootstrapping Cassandra Interpreter WARN [2016-09-29 00:25:46,250] ({main} Interpreter.java[register]:347) - Static initialization is deprecated for interpreter cassandra, You should change it to use interpreter-setting.json in your jar or interpreter/{interpreter}/interpreter-setting.json INFO [2016-09-29 00:25:46,250] ({main} InterpreterFactory.java[init]:204) - Interpreter cassandra.cassandra found. class=org.apache.zeppelin.cassandra.CassandraInterpreter` * And ensure that the cassandra related paragraphs run without any error ### Screenshots (if appropriate) ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: Kavin <[email protected]> Closes #1473 from kavinkumarks/zeppelin-908-register-cassandra-interpreter and squashes the following commits: d1fe586 [Kavin] Removed static initialization of interpreter registration with the interpreter-setting.json file. Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/5e02186d Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/5e02186d Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/5e02186d Branch: refs/heads/master Commit: 5e02186df86d719286ae8e2c97df936c02166d34 Parents: 401c813 Author: Kavin <[email protected]> Authored: Thu Sep 29 17:32:03 2016 +0530 Committer: doanduyhai <[email protected]> Committed: Sat Oct 1 09:04:41 2016 +0200 ---------------------------------------------------------------------- .../cassandra/CassandraInterpreter.java | 105 ---------- .../src/main/resources/interpreter-setting.json | 195 +++++++++++++++++++ 2 files changed, 195 insertions(+), 105 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/5e02186d/cassandra/src/main/java/org/apache/zeppelin/cassandra/CassandraInterpreter.java ---------------------------------------------------------------------- diff --git a/cassandra/src/main/java/org/apache/zeppelin/cassandra/CassandraInterpreter.java b/cassandra/src/main/java/org/apache/zeppelin/cassandra/CassandraInterpreter.java index 147fb62..47d8e3a 100644 --- a/cassandra/src/main/java/org/apache/zeppelin/cassandra/CassandraInterpreter.java +++ b/cassandra/src/main/java/org/apache/zeppelin/cassandra/CassandraInterpreter.java @@ -151,111 +151,6 @@ public class CassandraInterpreter extends Interpreter { super(properties); } - static { - LOGGER.info("Bootstrapping Cassandra Interpreter"); - Interpreter.register("cassandra", "cassandra", CassandraInterpreter.class.getName(), - new InterpreterPropertyBuilder() - .add(CASSANDRA_HOSTS, DEFAULT_HOST, - "Comma separated Cassandra hosts (DNS name or " + - "IP address). Default = localhost. Ex: '192.168.0.12,node2,node3'") - .add(CASSANDRA_PORT, DEFAULT_PORT, "Cassandra native port. Default = 9042") - .add(CASSANDRA_PROTOCOL_VERSION, DEFAULT_PROTOCOL_VERSION, - "Cassandra protocol version. Default = 4") - .add(CASSANDRA_CLUSTER_NAME, DEFAULT_CLUSTER, "Cassandra cluster name. " + - "Default = 'Test Cluster'") - .add(CASSANDRA_KEYSPACE_NAME, DEFAULT_KEYSPACE, "Cassandra keyspace name. " + - "Default = 'system'") - .add(CASSANDRA_COMPRESSION_PROTOCOL, DEFAULT_COMPRESSION, - "Cassandra compression protocol. " + - "Available values: NONE, SNAPPY, LZ4. Default = NONE") - .add(CASSANDRA_CREDENTIALS_USERNAME, DEFAULT_CREDENTIAL, - "Cassandra credentials username. " + - "Default = 'none'") - .add(CASSANDRA_CREDENTIALS_PASSWORD, DEFAULT_CREDENTIAL, - "Cassandra credentials password. " + - "Default = 'none'") - .add(CASSANDRA_LOAD_BALANCING_POLICY, DEFAULT_POLICY, "Cassandra Load Balancing Policy. " + - "Default = new TokenAwarePolicy(new DCAwareRoundRobinPolicy())") - .add(CASSANDRA_RETRY_POLICY, DEFAULT_POLICY, "Cassandra Retry Policy. " + - "Default = DefaultRetryPolicy.INSTANCE") - .add(CASSANDRA_RECONNECTION_POLICY, DEFAULT_POLICY, "Cassandra Reconnection Policy. " + - "Default = new ExponentialReconnectionPolicy(1000, 10 * 60 * 1000)") - .add(CASSANDRA_SPECULATIVE_EXECUTION_POLICY, DEFAULT_POLICY, - "Cassandra Speculative Execution Policy. " + - "Default = NoSpeculativeExecutionPolicy.INSTANCE") - .add(CASSANDRA_INTERPRETER_PARALLELISM, DEFAULT_PARALLELISM, - "Cassandra interpreter parallelism" + - ".Default = 10") - .add(CASSANDRA_MAX_SCHEMA_AGREEMENT_WAIT_SECONDS, - DEFAULT_MAX_SCHEMA_AGREEMENT_WAIT_SECONDS + "" - , "Cassandra max schema agreement wait in second" + - ".Default = ProtocolOptions.DEFAULT_MAX_SCHEMA_AGREEMENT_WAIT_SECONDS") - - .add(CASSANDRA_POOLING_NEW_CONNECTION_THRESHOLD_LOCAL, - DEFAULT_NEW_CONNECTION_THRESHOLD_LOCAL, - "Cassandra new connection threshold local. " + - "Protocol V2 and below default = 100" + - "Protocol V3 and above default = 800") - .add(CASSANDRA_POOLING_NEW_CONNECTION_THRESHOLD_REMOTE, - DEFAULT_NEW_CONNECTION_THRESHOLD_REMOTE, - "Cassandra new connection threshold remove. " + - "Protocol V2 and below default = 100" + - "Protocol V3 and above default = 200") - - .add(CASSANDRA_POOLING_CORE_CONNECTION_PER_HOST_LOCAL, - DEFAULT_CORE_CONNECTION_PER_HOST_LOCAL, - "Cassandra core connection per host local. " + - "Protocol V2 and below default = 2" + - "Protocol V3 and above default = 1") - .add(CASSANDRA_POOLING_CORE_CONNECTION_PER_HOST_REMOTE, - DEFAULT_CORE_CONNECTION_PER_HOST_REMOTE, - "Cassandra core connection per host remove. " + - "Protocol V2 and below default = 1" + - "Protocol V3 and above default = 1") - - .add(CASSANDRA_POOLING_MAX_CONNECTION_PER_HOST_LOCAL, - DEFAULT_MAX_CONNECTION_PER_HOST_LOCAL, - "Cassandra max connection per host local. " + - "Protocol V2 and below default = 8" + - "Protocol V3 and above default = 1") - .add(CASSANDRA_POOLING_MAX_CONNECTION_PER_HOST_REMOTE, - DEFAULT_MAX_CONNECTION_PER_HOST_REMOTE, - "Cassandra max connection per host remote. " + - "Protocol V2 and below default = 2" + - "Protocol V3 and above default = 1") - - .add(CASSANDRA_POOLING_MAX_REQUESTS_PER_CONNECTION_LOCAL, - DEFAULT_MAX_REQUEST_PER_CONNECTION_LOCAL, - "Cassandra max request per connection local. " + - "Protocol V2 and below default = 128" + - "Protocol V3 and above default = 1024") - .add(CASSANDRA_POOLING_MAX_REQUESTS_PER_CONNECTION_REMOTE, - DEFAULT_MAX_REQUEST_PER_CONNECTION_REMOTE, - "Cassandra max request per connection remote. " + - "Protocol V2 and below default = 128" + - "Protocol V3 and above default = 256") - - .add(CASSANDRA_POOLING_IDLE_TIMEOUT_SECONDS, DEFAULT_IDLE_TIMEOUT, - "Cassandra idle time out in seconds. Default = 120") - .add(CASSANDRA_POOLING_POOL_TIMEOUT_MILLIS, DEFAULT_POOL_TIMEOUT, - "Cassandra pool time out in millisecs. Default = 5000") - .add(CASSANDRA_POOLING_HEARTBEAT_INTERVAL_SECONDS, DEFAULT_HEARTBEAT_INTERVAL, - "Cassandra pool heartbeat interval in secs. Default = 30") - .add(CASSANDRA_QUERY_DEFAULT_CONSISTENCY, DEFAULT_CONSISTENCY, - "Cassandra query default consistency level. Default = ONE") - .add(CASSANDRA_QUERY_DEFAULT_SERIAL_CONSISTENCY, DEFAULT_SERIAL_CONSISTENCY, - "Cassandra query default serial consistency level. Default = SERIAL") - .add(CASSANDRA_QUERY_DEFAULT_FETCH_SIZE, DEFAULT_FETCH_SIZE, - "Cassandra query default fetch size. Default = 5000") - .add(CASSANDRA_SOCKET_CONNECTION_TIMEOUT_MILLIS, DEFAULT_CONNECTION_TIMEOUT, - "Cassandra socket default connection timeout in millisecs. Default = 5000") - .add(CASSANDRA_SOCKET_READ_TIMEOUT_MILLIS, DEFAULT_READ_TIMEOUT, - "Cassandra socket read timeout in millisecs. Default = 12000") - .add(CASSANDRA_SOCKET_TCP_NO_DELAY, DEFAULT_TCP_NO_DELAY, - "Cassandra socket TCP no delay. Default = true") - .build()); - } - @Override public void open() { http://git-wip-us.apache.org/repos/asf/zeppelin/blob/5e02186d/cassandra/src/main/resources/interpreter-setting.json ---------------------------------------------------------------------- diff --git a/cassandra/src/main/resources/interpreter-setting.json b/cassandra/src/main/resources/interpreter-setting.json new file mode 100644 index 0000000..eb98472 --- /dev/null +++ b/cassandra/src/main/resources/interpreter-setting.json @@ -0,0 +1,195 @@ +[ + { + "group": "cassandra", + "name": "cassandra", + "className": "org.apache.zeppelin.cassandra.CassandraInterpreter", + "properties": { + "cassandra.hosts": { + "envName": null, + "propertyName": "cassandra.hosts", + "defaultValue": "localhost", + "description": "Comma separated Cassandra hosts (DNS name or IP address). Default = localhost. Ex: '192.168.0.12,node2,node3'" + }, + "cassandra.native.port": { + "envName": null, + "propertyName": "cassandra.native.port", + "defaultValue": "9042", + "description": "Cassandra native port. Default = 9042" + }, + "cassandra.protocol.version": { + "envName": null, + "propertyName": "cassandra.protocol.version", + "defaultValue": "4", + "description": "Cassandra protocol version. Default = 4" + }, + "cassandra.cluster": { + "envName": null, + "propertyName": "cassandra.cluster", + "defaultValue": "Test Cluster", + "description": "Cassandra cluster name. Default = 'Test Cluster'" + }, + "cassandra.keyspace": { + "envName": null, + "propertyName": "cassandra.keyspace", + "defaultValue": "system", + "description": "Cassandra keyspace name. Default = 'system'" + }, + "cassandra.compression.protocol": { + "envName": null, + "propertyName": "cassandra.compression.protocol", + "defaultValue": "NONE", + "description": "Cassandra compression protocol. Available values: NONE, SNAPPY, LZ4. Default = NONE" + }, + "cassandra.credentials.username": { + "envName": null, + "propertyName": "cassandra.credentials.username", + "defaultValue": "none", + "description": "Cassandra credentials username. Default = 'none'" + }, + "cassandra.credentials.password": { + "envName": null, + "propertyName": "cassandra.credentials.password", + "defaultValue": "none", + "description": "Cassandra credentials password. Default = 'none'" + }, + "cassandra.load.balancing.policy": { + "envName": null, + "propertyName": "cassandra.load.balancing.policy", + "defaultValue": "DEFAULT", + "description": "Cassandra Load Balancing Policy. Default = new TokenAwarePolicy(new DCAwareRoundRobinPolicy())" + }, + "cassandra.retry.policy": { + "envName": null, + "propertyName": "cassandra.retry.policy", + "defaultValue": "DEFAULT", + "description": "Cassandra Retry Policy. Default = DefaultRetryPolicy.INSTANCE" + }, + "cassandra.reconnection.policy": { + "envName": null, + "propertyName": "cassandra.reconnection.policy", + "defaultValue": "DEFAULT", + "description": "Cassandra Reconnection Policy. Default = new ExponentialReconnectionPolicy(1000, 10 * 60 * 1000)" + }, + "cassandra.speculative.execution.policy": { + "envName": null, + "propertyName": "cassandra.speculative.execution.policy", + "defaultValue": "DEFAULT", + "description": "Cassandra Speculative Execution Policy. Default = NoSpeculativeExecutionPolicy.INSTANCE" + }, + "cassandra.interpreter.parallelism": { + "envName": null, + "propertyName": "cassandra.interpreter.parallelism", + "defaultValue": "10", + "description": "Cassandra interpreter parallelism.Default = 10" + }, + "cassandra.max.schema.agreement.wait.second": { + "envName": null, + "propertyName": "cassandra.max.schema.agreement.wait.second", + "defaultValue": "10", + "description": "Cassandra max schema agreement wait in second.Default = ProtocolOptions.DEFAULT_MAX_SCHEMA_AGREEMENT_WAIT_SECONDS" + }, + "cassandra.pooling.new.connection.threshold.local": { + "envName": null, + "propertyName": "cassandra.pooling.new.connection.threshold.local", + "defaultValue": "100", + "description": "Cassandra new connection threshold local. Protocol V2 and below default = 100 Protocol V3 and above default = 800" + }, + "cassandra.pooling.new.connection.threshold.remote": { + "envName": null, + "propertyName": "cassandra.pooling.new.connection.threshold.remote", + "defaultValue": "100", + "description": "Cassandra new connection threshold remove. Protocol V2 and below default = 100 Protocol V3 and above default = 200" + }, + "cassandra.pooling.core.connection.per.host.local": { + "envName": null, + "propertyName": "cassandra.pooling.core.connection.per.host.local", + "defaultValue": "2", + "description": "Cassandra core connection per host local. Protocol V2 and below default = 2 Protocol V3 and above default = 1" + }, + "cassandra.pooling.core.connection.per.host.remote": { + "envName": null, + "propertyName": "cassandra.pooling.core.connection.per.host.remote", + "defaultValue": "1", + "description": "Cassandra core connection per host remove. Protocol V2 and below default = 1 Protocol V3 and above default = 1" + }, + "cassandra.pooling.max.connection.per.host.local": { + "envName": null, + "propertyName": "cassandra.pooling.max.connection.per.host.local", + "defaultValue": "8", + "description": "Cassandra max connection per host local. Protocol V2 and below default = 8 Protocol V3 and above default = 1" + }, + "cassandra.pooling.max.connection.per.host.remote": { + "envName": null, + "propertyName": "cassandra.pooling.max.connection.per.host.remote", + "defaultValue": "2", + "description": "Cassandra max connection per host remote. Protocol V2 and below default = 2 Protocol V3 and above default = 1" + }, + "cassandra.pooling.max.request.per.connection.local": { + "envName": null, + "propertyName": "cassandra.pooling.max.request.per.connection.local", + "defaultValue": "1024", + "description": "Cassandra max request per connection local. Protocol V2 and below default = 128 Protocol V3 and above default = 1024" + }, + "cassandra.pooling.max.request.per.connection.remote": { + "envName": null, + "propertyName": "cassandra.pooling.max.request.per.connection.remote", + "defaultValue": "256", + "description": "Cassandra max request per connection remote. Protocol V2 and below default = 128 Protocol V3 and above default = 256" + }, + "cassandra.pooling.idle.timeout.seconds": { + "envName": null, + "propertyName": "cassandra.pooling.idle.timeout.seconds", + "defaultValue": "120", + "description": "Cassandra idle time out in seconds. Default = 120" + }, + "cassandra.pooling.pool.timeout.millisecs": { + "envName": null, + "propertyName": "cassandra.pooling.pool.timeout.millisecs", + "defaultValue": "5000", + "description": "Cassandra pool time out in millisecs. Default = 5000" + }, + "cassandra.pooling.heartbeat.interval.seconds": { + "envName": null, + "propertyName": "cassandra.pooling.heartbeat.interval.seconds", + "defaultValue": "30", + "description": "Cassandra pool heartbeat interval in secs. Default = 30" + }, + "cassandra.query.default.consistency": { + "envName": null, + "propertyName": "cassandra.query.default.consistency", + "defaultValue": "ONE", + "description": "Cassandra query default consistency level. Default = ONE" + }, + "cassandra.query.default.serial.consistency": { + "envName": null, + "propertyName": "cassandra.query.default.serial.consistency", + "defaultValue": "SERIAL", + "description": "Cassandra query default serial consistency level. Default = SERIAL" + }, + "cassandra.query.default.fetchSize": { + "envName": null, + "propertyName": "cassandra.query.default.fetchSize", + "defaultValue": "5000", + "description": "Cassandra query default fetch size. Default = 5000" + }, + "cassandra.socket.connection.timeout.millisecs": { + "envName": null, + "propertyName": "cassandra.socket.connection.timeout.millisecs", + "defaultValue": "5000", + "description": "Cassandra socket default connection timeout in millisecs. Default = 5000" + }, + "cassandra.socket.read.timeout.millisecs": { + "envName": null, + "propertyName": "cassandra.socket.read.timeout.millisecs", + "defaultValue": "12000", + "description": "Cassandra socket read timeout in millisecs. Default = 12000" + }, + "cassandra.socket.tcp.no_delay": { + "envName": null, + "propertyName": "cassandra.socket.tcp.no_delay", + "defaultValue": "true", + "description": "Cassandra socket TCP no delay. Default = true" + } + } + } +]
