
com.groupbyinc.flux.index.translog.TranslogWriter.class Maven / Gradle / Ivy
???? 3? 1com/groupbyinc/flux/index/translog/TranslogWriter 1com/groupbyinc/flux/index/translog/TranslogReader TranslogWriter.java 3com/groupbyinc/flux/index/translog/TranslogWriter$1 @com/groupbyinc/flux/index/translog/TranslogWriter$ChannelFactory ChannelFactory =com/groupbyinc/flux/index/translog/TranslogWriter$InnerReader InnerReader 6com/groupbyinc/flux/index/translog/TranslogWriter$Type Type 4com/groupbyinc/flux/index/translog/Translog$Location +com/groupbyinc/flux/index/translog/Translog Location TRANSLOG_CODEC Ljava/lang/String; translog VERSION_CHECKSUMS I VERSION_CHECKPOINTS VERSION shardId )Lcom/groupbyinc/flux/index/shard/ShardId; readLock ;Lcom/groupbyinc/flux/common/util/concurrent/ReleasableLock; writeLock lastSyncedOffset J operationCounter
writtenOffset tragedy Ljava/lang/Throwable; b(Lcom/groupbyinc/flux/index/shard/ShardId;JLcom/groupbyinc/flux/index/translog/ChannelReference;)V java/io/IOException - 3com/groupbyinc/flux/index/translog/ChannelReference /
getChannel !()Ljava/nio/channels/FileChannel; 1 2
0 3 java/nio/channels/FileChannel 5 position ()J 7 8
6 9 :(JLcom/groupbyinc/flux/index/translog/ChannelReference;J)V + ;
< ! > 1java/util/concurrent/locks/ReentrantReadWriteLock @ ()V + B
A C 9com/groupbyinc/flux/common/util/concurrent/ReleasableLock E (java/util/concurrent/locks/ReadWriteLock G #()Ljava/util/concurrent/locks/Lock; " I H J $(Ljava/util/concurrent/locks/Lock;)V + L
F M " # O $ I H Q $ # S ( & U % & W this 3Lcom/groupbyinc/flux/index/translog/TranslogWriter;
generation channelReference 5Lcom/groupbyinc/flux/index/translog/ChannelReference; rwl *Ljava/util/concurrent/locks/ReadWriteLock; getHeaderLength (Ljava/lang/String;)I 6com/groupbyinc/flux/common/apache/lucene/util/BytesRef b (Ljava/lang/CharSequence;)V + d
c e length g c h (I)I ` j
k translogUUID 9com/groupbyinc/flux/common/apache/lucene/codecs/CodecUtil n headerLength p a
o q
uuidLength create*(Lcom/groupbyinc/flux/index/translog/TranslogWriter$Type;Lcom/groupbyinc/flux/index/shard/ShardId;Ljava/lang/String;JLjava/nio/file/Path;Lcom/groupbyinc/flux/common/util/Callback;ILcom/groupbyinc/flux/index/translog/TranslogWriter$ChannelFactory;)Lcom/groupbyinc/flux/index/translog/TranslogWriter; java/lang/Throwable v open 5(Ljava/nio/file/Path;)Ljava/nio/channels/FileChannel; x y
z Ecom/groupbyinc/flux/common/apache/lucene/store/OutputStreamDataOutput | java/nio/channels/Channels ~ newOutputStream ?(Ljava/nio/channels/WritableByteChannel;)Ljava/io/OutputStream; ? ?
? (Ljava/io/OutputStream;)V + ?
} ? writeHeader Q(Lcom/groupbyinc/flux/common/apache/lucene/store/DataOutput;Ljava/lang/String;I)V ? ?
o ? writeInt (I)V ? ?
} ? bytes [B ? ? c ? offset ? c ?
writeBytes ([BII)V ? ?
} ? force (Z)V ? ?
6 ? java/nio/file/Path ? getParent ()Ljava/nio/file/Path; ? ? ? ? java/nio/file/OpenOption ? java/nio/file/StandardOpenOption ? WRITE "Ljava/nio/file/StandardOpenOption; ? ? ? ? writeCheckpoint 5(JILjava/nio/file/Path;J[Ljava/nio/file/OpenOption;)V ? ?
? a(Ljava/nio/file/Path;JLjava/nio/channels/FileChannel;Lcom/groupbyinc/flux/common/util/Callback;)V + ?
0 ? ?(Lcom/groupbyinc/flux/index/shard/ShardId;JLcom/groupbyinc/flux/index/translog/ChannelReference;I)Lcom/groupbyinc/flux/index/translog/TranslogWriter; t ?
? 'com/groupbyinc/flux/index/shard/ShardId ? java/lang/String ? (com/groupbyinc/flux/common/util/Callback ? java/io/Closeable ? 5com/groupbyinc/flux/common/apache/lucene/util/IOUtils ? closeWhileHandlingException ([Ljava/io/Closeable;)V ? ?
? ? out GLcom/groupbyinc/flux/common/apache/lucene/store/OutputStreamDataOutput; writer throwable type 8Lcom/groupbyinc/flux/index/translog/TranslogWriter$Type; fileGeneration file Ljava/nio/file/Path; onClose aLcom/groupbyinc/flux/common/util/Callback; *Lcom/groupbyinc/flux/common/util/Callback;
bufferSize channelFactory BLcom/groupbyinc/flux/index/translog/TranslogWriter$ChannelFactory; ref 8Lcom/groupbyinc/flux/common/apache/lucene/util/BytesRef; channel Ljava/nio/channels/FileChannel; getTragicException ()Ljava/lang/Throwable; ) * ? closeWithTragicEvent (Ljava/lang/Throwable;)V acquire =()Lcom/groupbyinc/flux/common/util/concurrent/ReleasableLock; ? ?
F ?
addSuppressed ? ?
w ? close ? B
?
F ? lock add i(Lcom/groupbyinc/flux/common/bytes/BytesReference;)Lcom/groupbyinc/flux/index/translog/Translog$Location;
ensureOpen ? B
? ? ? ? /com/groupbyinc/flux/common/bytes/BytesReference ? writeTo +(Ljava/nio/channels/GatheringByteChannel;)V ? ? ? ? ? ?
? ()I g ? ? ? ' ? [ & ? (JJI)V + ?
e data 1Lcom/groupbyinc/flux/common/bytes/BytesReference; updateBufferSize 4com/groupbyinc/flux/index/translog/TranslogException sync
syncNeeded ()Z
\ ]
checkpoint :(JILcom/groupbyinc/flux/index/translog/ChannelReference;)V
totalOperations sizeInBytes flush newReaderFromWriter 5()Lcom/groupbyinc/flux/index/translog/TranslogReader; incRef B
0 firstOperationOffset & m(Lcom/groupbyinc/flux/index/translog/TranslogWriter;JJLcom/groupbyinc/flux/index/translog/ChannelReference;)V +
decRef! B
0" reader 3Lcom/groupbyinc/flux/index/translog/TranslogReader; success Z immutableReader >()Lcom/groupbyinc/flux/index/translog/ImmutableTranslogReader; java/lang/Exception* tryIncRef,
0- B
/ :com/groupbyinc/flux/index/translog/ImmutableTranslogReader1 <(JLcom/groupbyinc/flux/index/translog/ChannelReference;JJI)V +3
24 ,exception while creating an immutable reader6 S(Lcom/groupbyinc/flux/index/shard/ShardId;Ljava/lang/String;Ljava/lang/Throwable;)V +8
9 java/lang/StringBuilder;
<