You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by bo...@apache.org on 2015/03/26 15:39:04 UTC
[2/2] storm git commit: Merge branch 'STORM-723' of
https://github.com/HeartSaVioR/storm into STORM-723
Merge branch 'STORM-723' of https://github.com/HeartSaVioR/storm into STORM-723
STORM-723: Remove RedisStateSetUpdater / RedisStateSetCountQuerier which didn't tested and have a bug
Conflicts:
external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/RedisStateSetCountQuerier.java
external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/RedisStateSetUpdater.java
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/5c5abdfe
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/5c5abdfe
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/5c5abdfe
Branch: refs/heads/0.10.x-branch
Commit: 5c5abdfee6ff2db7839c2faaf1782eb28f0a8723
Parents: 950bb0b
Author: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Authored: Thu Mar 26 09:28:06 2015 -0500
Committer: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Committed: Thu Mar 26 09:31:25 2015 -0500
----------------------------------------------------------------------
.../state/RedisStateSetCountQuerier.java | 74 ------------------
.../trident/state/RedisStateSetUpdater.java | 80 --------------------
2 files changed, 154 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/5c5abdfe/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/RedisStateSetCountQuerier.java
----------------------------------------------------------------------
diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/RedisStateSetCountQuerier.java b/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/RedisStateSetCountQuerier.java
deleted file mode 100644
index 5b04d59..0000000
--- a/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/RedisStateSetCountQuerier.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.storm.redis.trident.state;
-
-import backtype.storm.tuple.Values;
-import org.apache.storm.redis.trident.mapper.TridentTupleMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import redis.clients.jedis.Jedis;
-import storm.trident.operation.TridentCollector;
-import storm.trident.state.BaseQueryFunction;
-import storm.trident.tuple.TridentTuple;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class RedisStateSetCountQuerier extends BaseQueryFunction<RedisState, Long> {
- private static final Logger logger = LoggerFactory.getLogger(RedisState.class);
-
- private final String redisKeyPrefix;
- private final TridentTupleMapper tupleMapper;
-
- public RedisStateSetCountQuerier(String redisKeyPrefix, TridentTupleMapper tupleMapper) {
- this.redisKeyPrefix = redisKeyPrefix;
- this.tupleMapper = tupleMapper;
- }
-
- @Override
- public List<Long> batchRetrieve(RedisState redisState, List<TridentTuple> inputs) {
- List<Long> ret = new ArrayList<Long>();
-
- Jedis jedis = null;
- try {
- jedis = redisState.getJedis();
- for (TridentTuple input : inputs) {
- String key = this.tupleMapper.getKeyFromTridentTuple(input);
- if (redisKeyPrefix != null && redisKeyPrefix.length() > 0) {
- key = redisKeyPrefix + key;
- }
- long count = jedis.scard(key);
- ret.add(count);
-
- logger.debug("redis get key[" + key + "] count[" + count + "]");
- }
- } finally {
- if (jedis != null) {
- redisState.returnJedis(jedis);
- }
- }
-
- return ret;
- }
-
- @Override
- public void execute(TridentTuple tuple, Long s, TridentCollector collector) {
- String key = this.tupleMapper.getKeyFromTridentTuple(tuple);
- collector.emit(new Values(key, s));
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/storm/blob/5c5abdfe/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/RedisStateSetUpdater.java
----------------------------------------------------------------------
diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/RedisStateSetUpdater.java b/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/RedisStateSetUpdater.java
deleted file mode 100644
index c36d1f0..0000000
--- a/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/RedisStateSetUpdater.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.storm.redis.trident.state;
-
-import backtype.storm.tuple.Values;
-import org.apache.storm.redis.trident.mapper.TridentTupleMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import redis.clients.jedis.Jedis;
-import storm.trident.operation.TridentCollector;
-import storm.trident.state.BaseStateUpdater;
-import storm.trident.tuple.TridentTuple;
-
-import java.util.List;
-
-public class RedisStateSetUpdater extends BaseStateUpdater<RedisState> {
- private static final Logger logger = LoggerFactory.getLogger(RedisState.class);
-
- private final String redisKeyPrefix;
- private final TridentTupleMapper tupleMapper;
- private final int expireIntervalSec;
-
- public RedisStateSetUpdater(String redisKeyPrefix, TridentTupleMapper tupleMapper, int expireIntervalSec) {
- this.redisKeyPrefix = redisKeyPrefix;
- this.tupleMapper = tupleMapper;
- if (expireIntervalSec > 0) {
- this.expireIntervalSec = expireIntervalSec;
- } else {
- this.expireIntervalSec = 0;
- }
- }
-
- @Override
- public void updateState(RedisState redisState, List<TridentTuple> inputs,
- TridentCollector collector) {
-
- Jedis jedis = null;
- try {
- jedis = redisState.getJedis();
- for (TridentTuple input : inputs) {
- String key = this.tupleMapper.getKeyFromTridentTuple(input);
- String redisKey = key;
- if (redisKeyPrefix != null && redisKeyPrefix.length() > 0) {
- redisKey = redisKeyPrefix + redisKey;
- }
- String value = this.tupleMapper.getValueFromTridentTuple(input);
-
- logger.debug("update key[" + key + "] redisKey[" + redisKey + "] value[" + value + "]");
-
- if (this.expireIntervalSec > 0) {
- jedis.setex(redisKey, expireIntervalSec, value);
- } else {
- jedis.set(redisKey, value);
- }
- Long count = jedis.scard(redisKey);
-
- collector.emit(new Values(key, count));
- }
- } finally {
- if (jedis != null) {
- redisState.returnJedis(jedis);
- }
- }
- }
-}