storm-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zhiming Guo (JIRA)" <>
Subject [jira] [Commented] (STORM-328) and Utils.get{Int,Long} are not in sync for floating point
Date Wed, 09 Jul 2014 01:23:04 GMT


Zhiming Guo commented on STORM-328:

Hi there, I'm a newbie and I want to solve this newbie bug. I have read the related codes.
Is it a real bug? 
Should I just simply add a new Utils.getFloat? Or I add Utils.getFloat and Utils.getNumber
then replace all getInt with getNumber?

I ran 
egrep -ir --include=*.{java,clj} "getInt\(" . | less
and I got output: 
./backtype/storm/drpc/            int port = Utils.getInt(conf.get(Config.DRPC_INVOCATIONS_PORT));
./backtype/storm/drpc/            final int port = Utils.getInt(retMap.get("port"));
./backtype/storm/messaging/netty/        buffer_size = Utils.getInt(storm_conf.get(Config.STORM_MESSAGING_NETTY_BUFFER_SIZE));
./backtype/storm/messaging/netty/        max_retries = Math.min(30, Utils.getInt(storm_conf.get(Config.STORM_MESSAGING_NETTY_MAX_RETRIES)));
./backtype/storm/messaging/netty/        base_sleep_ms = Utils.getInt(storm_conf.get(Config.STORM_MESSAGING_NETTY_MIN_SLEEP_MS));
./backtype/storm/messaging/netty/        max_sleep_ms = Utils.getInt(storm_conf.get(Config.STORM_MESSAGING_NETTY_MAX_SLEEP_MS));
./backtype/storm/messaging/netty/        this.messageBatchSize = Utils.getInt(storm_conf.get(Config.STORM_NETTY_MESSAGE_BATCH_SIZE),
./backtype/storm/messaging/netty/        flushCheckInterval = Utils.getInt(storm_conf.get(Config.STORM_NETTY_FLUSH_CHECK_INTERVAL_MS),
10); // default 10 ms
./backtype/storm/messaging/netty/        int maxWorkers = Utils.getInt(storm_conf.get(Config.STORM_MESSAGING_NETTY_CLIENT_WORKER_THREADS));
./backtype/storm/messaging/netty/        int otherWorkers = Utils.getInt(storm_conf.get(Config.TOPOLOGY_WORKERS),
1) - 1;
./backtype/storm/messaging/netty/        queueCount = Utils.getInt(storm_conf.get(Config.WORKER_RECEIVER_THREAD_COUNT),
./backtype/storm/messaging/netty/        int buffer_size = Utils.getInt(storm_conf.get(Config.STORM_MESSAGING_NETTY_BUFFER_SIZE));
./backtype/storm/messaging/netty/        int maxWorkers = Utils.getInt(storm_conf.get(Config.STORM_MESSAGING_NETTY_SERVER_WORKER_THREADS));
./backtype/storm/task/        Integer max = Utils.getInt(_stormConf.get(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS));
./backtype/storm/task/                    max = Math.max(Utils.getInt(comp),
./backtype/storm/testing/            else _maxSpoutPending =
./backtype/storm/testing/            else _maxSpoutPending
= Utils.getInt(c);
./backtype/storm/transactional/            _maxTransactionActive
= Utils.getInt(active);
./backtype/storm/utils/            int nimbusPort = Utils.getInt(conf.get(Config.NIMBUS_THRIFT_PORT));
./backtype/storm/utils/    public static Integer getInt(Object o) {
./backtype/storm/utils/      Integer result = getInt(o, null);
./backtype/storm/utils/    public static Integer getInt(Object o, Integer defaultValue)
./backtype/storm/utils/            serverPorts.add(zkServer + ":" + Utils.getInt(port));
./backtype/storm/utils/                .connectionTimeoutMs(Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_CONNECTION_TIMEOUT)))
./backtype/storm/utils/                .sessionTimeoutMs(Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_SESSION_TIMEOUT)))
./backtype/storm/utils/                            Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL)),
./backtype/storm/utils/                            Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_RETRY_TIMES)),
./backtype/storm/utils/                            Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL_CEILING))));
./storm/trident/drpc/            final int port = Utils.getInt(retMap.get("port"));

> and Utils.get{Int,Long} are not in sync for floating point
> ----------------------------------------------------------------------
>                 Key: STORM-328
>                 URL:
>             Project: Apache Storm (Incubating)
>          Issue Type: Bug
>    Affects Versions: 0.9.2-incubating, 0.9.1-incubating,
>            Reporter: Robert Joseph Evans
>              Labels: newbie
> For most numeric configuration values has a type of Number listed, but the
values are parsed using Utils.getInt or Utils.getLong, which means if someone gave a floating
point number it would pass the ConfigValidation, but would blow up when it is used.  This
is most critical for values that Nimbus reads, but would be good to have them consistent everywhere.
> We should also check that getInt works properly for numbers that are larger then would
fit in an integer.
> Either we need to update Utils to be more lenient when looking at doubles, or we need
to make Config more strict, which may be difficult with the YAML and JSON parsing that happens,
where ints are often converted into longs.

This message was sent by Atlassian JIRA

View raw message