-
Notifications
You must be signed in to change notification settings - Fork 476
Enables SharedVariableAtomicityDetector #6025
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.1
Are you sure you want to change the base?
Changes from all commits
00db6e1
11a8056
5784d49
72d9e82
2d8ddd2
f827d1a
2b3db90
ce5c4ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,6 +35,8 @@ | |
| import java.util.TreeSet; | ||
| import java.util.concurrent.TimeUnit; | ||
|
|
||
| import javax.annotation.concurrent.NotThreadSafe; | ||
|
|
||
| import org.apache.accumulo.core.client.IteratorSetting; | ||
| import org.apache.accumulo.core.client.ScannerBase; | ||
| import org.apache.accumulo.core.client.sample.SamplerConfiguration; | ||
|
|
@@ -46,6 +48,7 @@ | |
| import org.apache.accumulo.core.util.TextUtil; | ||
| import org.apache.hadoop.io.Text; | ||
|
|
||
| @NotThreadSafe | ||
| public class ScannerOptions implements ScannerBase { | ||
|
Comment on lines
+51
to
52
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Scanners are not thread safe |
||
|
|
||
| protected List<IterInfo> serverSideIteratorList = Collections.emptyList(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,6 +45,8 @@ | |
| import java.util.function.Supplier; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| import javax.annotation.concurrent.NotThreadSafe; | ||
|
|
||
| import org.apache.accumulo.core.client.AccumuloException; | ||
| import org.apache.accumulo.core.client.AccumuloSecurityException; | ||
| import org.apache.accumulo.core.client.SampleNotPresentException; | ||
|
|
@@ -355,6 +357,7 @@ private String getTableInfo() { | |
| return context.getPrintableTableInfoFromId(tableId); | ||
| } | ||
|
|
||
| @NotThreadSafe | ||
| private class QueryTask implements Runnable { | ||
|
Comment on lines
+360
to
361
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. QueryTask is not used as/expected to be a thread-safe object |
||
|
|
||
| private final String tsLocation; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,8 @@ | |
| import java.util.function.LongSupplier; | ||
| import java.util.function.Supplier; | ||
|
|
||
| import javax.annotation.concurrent.NotThreadSafe; | ||
|
|
||
| import org.apache.accumulo.core.rpc.ThriftUtil; | ||
| import org.apache.accumulo.core.rpc.clients.ThriftClientTypes; | ||
| import org.apache.accumulo.core.util.HostAndPort; | ||
|
|
@@ -577,6 +579,7 @@ public TransportPoolShutdownException(String msg) { | |
| private static final long serialVersionUID = 1L; | ||
| } | ||
|
|
||
| @NotThreadSafe | ||
| private static class CachedTTransport extends TTransport { | ||
|
Comment on lines
+582
to
583
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CachedTTransport is only modified by a single thread at a time (must be reserved()/unreserved()) |
||
|
|
||
| private final ThriftTransportKey cacheKey; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,10 +23,13 @@ | |
| import java.io.IOException; | ||
| import java.io.InputStream; | ||
|
|
||
| import javax.annotation.concurrent.NotThreadSafe; | ||
|
|
||
| /** | ||
| * Reader corresponding to BlockedOutputStream. Expects all data to be in the form of size (int) | ||
| * data (size bytes) junk (however many bytes it takes to complete a block) | ||
| */ | ||
| @NotThreadSafe | ||
| public class BlockedInputStream extends InputStream { | ||
|
Comment on lines
+32
to
33
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BlockedInputStream is a wrapper for DataInputStream, which is not thread safe |
||
| byte[] array; | ||
| // ReadPos is where to start reading | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,6 +35,8 @@ | |
| import java.util.concurrent.ExecutorService; | ||
| import java.util.concurrent.atomic.AtomicBoolean; | ||
|
|
||
| import javax.annotation.concurrent.NotThreadSafe; | ||
|
|
||
| import org.apache.accumulo.core.bloomfilter.DynamicBloomFilter; | ||
| import org.apache.accumulo.core.classloader.ClassLoaderUtil; | ||
| import org.apache.accumulo.core.conf.AccumuloConfiguration; | ||
|
|
@@ -346,6 +348,7 @@ public void close() { | |
| } | ||
| } | ||
|
|
||
| @NotThreadSafe | ||
| public static class Reader implements FileSKVIterator { | ||
|
Comment on lines
+351
to
352
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. accumulo iterators are not expected to be thread safe |
||
|
|
||
| private final BloomFilterLoader bfl; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,12 +23,15 @@ | |
| import java.io.IOException; | ||
| import java.io.InputStream; | ||
|
|
||
| import javax.annotation.concurrent.NotThreadSafe; | ||
|
|
||
| import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; | ||
|
|
||
| /** | ||
| * This class is like byte array input stream with two differences. It supports seeking and avoids | ||
| * synchronization. | ||
| */ | ||
| @NotThreadSafe | ||
| public class SeekableByteArrayInputStream extends InputStream { | ||
|
Comment on lines
30
to
35
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This class is clearly not meant to be thread safe: "It ... avoids synchronization." |
||
|
|
||
| // making this volatile for the following case | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,8 @@ | |
| import java.util.Map; | ||
| import java.util.concurrent.atomic.AtomicBoolean; | ||
|
|
||
| import javax.annotation.concurrent.NotThreadSafe; | ||
|
|
||
| import org.apache.accumulo.core.data.ByteSequence; | ||
| import org.apache.accumulo.core.data.Key; | ||
| import org.apache.accumulo.core.data.Range; | ||
|
|
@@ -43,6 +45,7 @@ | |
| public class MapFileOperations extends FileOperations { | ||
| private static final String MSG = "Map files are not supported"; | ||
|
|
||
| @NotThreadSafe | ||
| public static class RangeIterator implements FileSKVIterator { | ||
|
Comment on lines
+48
to
49
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. accumulo iterators are not expected to be thread safe |
||
|
|
||
| SortedKeyValueIterator<Key,Value> reader; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,8 @@ | |
| import java.util.TreeMap; | ||
| import java.util.concurrent.atomic.AtomicBoolean; | ||
|
|
||
| import javax.annotation.concurrent.NotThreadSafe; | ||
|
|
||
| import org.apache.accumulo.core.client.SampleNotPresentException; | ||
| import org.apache.accumulo.core.client.sample.Sampler; | ||
| import org.apache.accumulo.core.client.sample.SamplerConfiguration; | ||
|
|
@@ -557,6 +559,7 @@ public void close() throws IOException { | |
| } | ||
| } | ||
|
|
||
| @NotThreadSafe | ||
| public static class Writer implements FileSKVWriter { | ||
|
Comment on lines
+562
to
563
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. impl clearly expects single threaded access (no volatiles or sync (other than close)) |
||
|
|
||
| public static final int MAX_CF_IN_DLG = 1000; | ||
|
|
@@ -754,6 +757,7 @@ public long getLength() { | |
| } | ||
| } | ||
|
|
||
| @NotThreadSafe | ||
| private static class LocalityGroupReader extends LocalityGroup implements FileSKVIterator { | ||
|
Comment on lines
+760
to
761
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. accumulo iterators are not expected to be thread safe |
||
|
|
||
| private final CachableBlockFile.Reader reader; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,10 +22,13 @@ | |
| import java.io.IOException; | ||
| import java.io.OutputStream; | ||
|
|
||
| import javax.annotation.concurrent.NotThreadSafe; | ||
|
|
||
| /** | ||
| * A simplified BufferedOutputStream with borrowed buffer, and allow users to see how much data have | ||
| * been buffered. | ||
| */ | ||
| @NotThreadSafe | ||
| class SimpleBufferedOutputStream extends FilterOutputStream { | ||
|
Comment on lines
+31
to
32
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The fact that this is a stream and the the impl itself show this is not a thread safe class |
||
| protected byte[] buf; // the borrowed buffer | ||
| protected int count = 0; // bytes used in buffer. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,13 +21,16 @@ | |
| import java.io.IOException; | ||
| import java.io.InputStream; | ||
|
|
||
| import javax.annotation.concurrent.NotThreadSafe; | ||
|
|
||
| import org.apache.hadoop.fs.Seekable; | ||
|
|
||
| /** | ||
| * BoundedRangeFIleInputStream abstracts a contiguous region of a Hadoop FSDataInputStream as a | ||
| * regular input stream. One can create multiple BoundedRangeFileInputStream on top of the same | ||
| * FSDataInputStream and they would not interfere with each other. | ||
| */ | ||
| @NotThreadSafe | ||
| public class BoundedRangeFileInputStream extends InputStream { | ||
|
Comment on lines
28
to
34
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Desc and impl show multiple threads can have their own BoundedRangeFileInputStream for same underlying data, but not that they can share same BoundedRangeFileInputStream. |
||
|
|
||
| private volatile boolean closed = false; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,8 @@ | |
| import java.util.TreeSet; | ||
| import java.util.concurrent.atomic.AtomicBoolean; | ||
|
|
||
| import javax.annotation.concurrent.NotThreadSafe; | ||
|
|
||
| import org.apache.accumulo.core.data.ByteSequence; | ||
| import org.apache.accumulo.core.data.Column; | ||
| import org.apache.accumulo.core.data.Key; | ||
|
|
@@ -36,6 +38,7 @@ | |
| import org.apache.accumulo.core.iterators.ServerSkippingIterator; | ||
| import org.apache.accumulo.core.iterators.SortedKeyValueIterator; | ||
|
|
||
| @NotThreadSafe | ||
| public class ColumnFamilySkippingIterator extends ServerSkippingIterator | ||
| implements InterruptibleIterator { | ||
|
Comment on lines
+41
to
43
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. accumulo iterators are not expected to be thread safe |
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,8 @@ | |
| import java.util.concurrent.atomic.AtomicLong; | ||
| import java.util.concurrent.atomic.LongAdder; | ||
|
|
||
| import javax.annotation.concurrent.NotThreadSafe; | ||
|
|
||
| import org.apache.accumulo.core.data.ByteSequence; | ||
| import org.apache.accumulo.core.data.Key; | ||
| import org.apache.accumulo.core.data.Range; | ||
|
|
@@ -34,6 +36,7 @@ | |
| import org.apache.accumulo.core.iterators.ServerWrappingIterator; | ||
| import org.apache.accumulo.core.iterators.SortedKeyValueIterator; | ||
|
|
||
| @NotThreadSafe | ||
| public class StatsIterator extends ServerWrappingIterator { | ||
|
Comment on lines
+39
to
40
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. accumulo iterators are not expected to be thread safe. The counters here are shared, but those are safely atomic. Internal state "numRead" is not and is not expected to be. deepCopy() shows intended use. |
||
|
|
||
| private int numRead = 0; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,6 +44,8 @@ | |
| import java.util.stream.Stream; | ||
| import java.util.stream.StreamSupport; | ||
|
|
||
| import javax.annotation.concurrent.NotThreadSafe; | ||
|
|
||
| import org.apache.accumulo.core.client.AccumuloClient; | ||
| import org.apache.accumulo.core.client.BatchScanner; | ||
| import org.apache.accumulo.core.client.IsolatedScanner; | ||
|
|
@@ -89,6 +91,7 @@ | |
| */ | ||
| public class TabletsMetadata implements Iterable<TabletMetadata>, AutoCloseable { | ||
|
|
||
| @NotThreadSafe | ||
| public static class Builder implements TableRangeOptions, TableOptions, RangeOptions, Options { | ||
|
Comment on lines
+94
to
95
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. impl clearly shows that this is not intended to be thread safe (no volatile, no synchronization) |
||
|
|
||
| private final List<Text> families = new ArrayList<>(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,8 @@ | |
| import java.io.InputStream; | ||
| import java.util.Objects; | ||
|
|
||
| import javax.annotation.concurrent.NotThreadSafe; | ||
|
|
||
| /** | ||
| * This class was copied from Guava and modified. If this class was not final in Guava it could have | ||
| * been extended. Guava has issue 590 open about this. | ||
|
|
@@ -26,6 +28,7 @@ | |
| * | ||
| * @author Chris Nokleberg | ||
| */ | ||
| @NotThreadSafe | ||
| public final class CountingInputStream extends FilterInputStream { | ||
|
Comment on lines
+31
to
32
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a stream and the impl shows this is not intended to be thread safe |
||
|
|
||
| private long count; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,12 +23,15 @@ | |
| import java.util.Map; | ||
| import java.util.concurrent.atomic.AtomicLong; | ||
|
|
||
| import javax.annotation.concurrent.NotThreadSafe; | ||
|
|
||
| import org.apache.accumulo.core.data.Key; | ||
| import org.apache.accumulo.core.data.Value; | ||
| import org.apache.accumulo.core.iterators.IteratorEnvironment; | ||
| import org.apache.accumulo.core.iterators.SortedKeyValueIterator; | ||
| import org.apache.accumulo.core.iterators.WrappingIterator; | ||
|
|
||
| @NotThreadSafe | ||
| public class CountingIterator extends WrappingIterator { | ||
|
Comment on lines
+34
to
35
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. accumulo iterators are not thread safe |
||
|
|
||
| private long count; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,8 @@ | |
| import java.util.concurrent.atomic.AtomicBoolean; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| import javax.annotation.concurrent.NotThreadSafe; | ||
|
|
||
| import org.apache.accumulo.core.client.SampleNotPresentException; | ||
| import org.apache.accumulo.core.conf.Property; | ||
| import org.apache.accumulo.core.data.Key; | ||
|
|
@@ -386,6 +388,7 @@ private void releaseReaders(KeyExtent tablet, List<FileSKVIterator> readers, | |
|
|
||
| } | ||
|
|
||
| @NotThreadSafe | ||
| static class FileDataSource implements DataSource { | ||
|
Comment on lines
+391
to
392
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A supporting class for SourceSwitchingIterator which is an iterator which is not thread safe, and impl shows this is intended for single threaded access (e.g., no volatile, sync, etc). |
||
|
|
||
| private SortedKeyValueIterator<Key,Value> iter; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scanners are not thread safe objects