Github user revans2 commented on a diff in the pull request:

    https://github.com/apache/storm/pull/2504#discussion_r160244314
  
    --- Diff: 
storm-server/src/main/java/org/apache/storm/metricstore/rocksdb/RocksDbMetricsWriter.java
 ---
    @@ -0,0 +1,306 @@
    +/**
    + * 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.metricstore.rocksdb;
    +
    +import com.codahale.metrics.Meter;
    +
    +import java.util.ArrayList;
    +import java.util.HashSet;
    +import java.util.ListIterator;
    +import java.util.Map;
    +import java.util.Set;
    +import java.util.TreeMap;
    +import java.util.concurrent.BlockingQueue;
    +import java.util.concurrent.ThreadLocalRandom;
    +import org.apache.storm.metricstore.AggLevel;
    +import org.apache.storm.metricstore.Metric;
    +import org.apache.storm.metricstore.MetricException;
    +import org.rocksdb.FlushOptions;
    +import org.rocksdb.RocksDBException;
    +import org.rocksdb.WriteBatch;
    +import org.rocksdb.WriteOptions;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +/**
    + * Class designed to perform all metrics inserts into RocksDB.  Metrics 
are processed from the a blocking queue.
    + * </P>
    + * A writable LRU StringMetadataCache is used to minimize looking up 
metadata string Ids.  As entries are added to the full cache, older
    + * entries are evicted from the cache and need to be written to the 
database.  This happens as the handleEvictedMetadata()
    + * method callback.
    + */
    +public class RocksDbMetricsWriter implements Runnable, AutoCloseable {
    +    private static final Logger LOG = 
LoggerFactory.getLogger(RocksDbMetricsWriter.class);
    +    private RocksDbStore store;
    +    private BlockingQueue queue;
    +    private WritableStringMetadataCache stringMetadataCache;
    +    private Set<Integer> unusedIds = new HashSet<>();
    +    private TreeMap<RocksDbKey, RocksDbValue> insertBatch = new 
TreeMap<>(); // RocksDB should insert in sorted key order
    --- End diff --
    
    I don't think this is being used in a thread safe way.
      


---

Reply via email to