com.groupbyinc.flux.index.translog.Translog.class Maven / Gradle / Ivy
???? 44 +com/groupbyinc/flux/index/translog/Translog ;com/groupbyinc/flux/index/shard/AbstractIndexShardComponent 3com/groupbyinc/flux/index/shard/IndexShardComponent java/io/Closeable
Translog.java -com/groupbyinc/flux/index/translog/Translog$1
>com/groupbyinc/flux/index/translog/Translog$TranslogGeneration TranslogGeneration 6com/groupbyinc/flux/index/translog/Translog$Durability
Durability 0com/groupbyinc/flux/index/translog/Translog$NoOp NoOp 2com/groupbyinc/flux/index/translog/Translog$Delete Delete 1com/groupbyinc/flux/index/translog/Translog$Index Index 2com/groupbyinc/flux/index/translog/Translog$Source Source 5com/groupbyinc/flux/index/translog/Translog$Operation Operation 4com/groupbyinc/flux/index/translog/Translog$Snapshot ! Snapshot 4com/groupbyinc/flux/index/translog/Translog$Location $ Location %java/lang/invoke/MethodHandles$Lookup ' java/lang/invoke/MethodHandles ) Lookup TRANSLOG_GENERATION_KEY Ljava/lang/String; translog_generation . TRANSLOG_UUID_KEY
translog_uuid 1 TRANSLOG_FILE_PREFIX translog- 4 TRANSLOG_FILE_SUFFIX .tlog 7 CHECKPOINT_SUFFIX .ckp : CHECKPOINT_FILE_NAME translog.ckp = PARSE_STRICT_ID_PATTERN Ljava/util/regex/Pattern; readers Ljava/util/List; ELjava/util/List; bigArrays +Lcom/groupbyinc/flux/common/util/BigArrays; readLock ;Lcom/groupbyinc/flux/common/util/concurrent/ReleasableLock; writeLock location Ljava/nio/file/Path; current 3Lcom/groupbyinc/flux/index/translog/TranslogWriter; closed +Ljava/util/concurrent/atomic/AtomicBoolean; config 3Lcom/groupbyinc/flux/index/translog/TranslogConfig; globalCheckpointSupplier !Ljava/util/function/LongSupplier; translogUUID deletionPolicy ;Lcom/groupbyinc/flux/index/translog/TranslogDeletionPolicy; $assertionsDisabled Z ?(Lcom/groupbyinc/flux/index/translog/TranslogConfig;Ljava/lang/String;Lcom/groupbyinc/flux/index/translog/TranslogDeletionPolicy;Ljava/util/function/LongSupplier;)V java/io/IOException Z java/lang/Exception \ 1com/groupbyinc/flux/index/translog/TranslogConfig ^
getShardId +()Lcom/groupbyinc/flux/index/shard/ShardId; ` a
_ b getIndexSettings +()Lcom/groupbyinc/flux/index/IndexSettings; d e
_ f U(Lcom/groupbyinc/flux/index/shard/ShardId;Lcom/groupbyinc/flux/index/IndexSettings;)V X h
i java/util/ArrayList k ()V X m
l n A B p )java/util/concurrent/atomic/AtomicBoolean r
s n M N u O P w Q R y T U { com/groupbyinc/flux/common/UUIDs } randomBase64UUID ()Ljava/lang/String; ?
~ ? S - ? java/lang/String ? 9com/groupbyinc/flux/index/translog/TranslogDeletionPolicy ? java/util/function/LongSupplier ? getBigArrays -()Lcom/groupbyinc/flux/common/util/BigArrays; ? ?
_ ? D E ? 1java/util/concurrent/locks/ReentrantReadWriteLock ?
? n 9com/groupbyinc/flux/common/util/concurrent/ReleasableLock ? (java/util/concurrent/locks/ReadWriteLock ? #()Ljava/util/concurrent/locks/Lock; F ? ? ? $(Ljava/util/concurrent/locks/Lock;)V X ?
? ? F G ? H ? ? ? H G ? getTranslogPath ()Ljava/nio/file/Path; ? ?
_ ? I J ? %java/nio/file/attribute/FileAttribute ? java/nio/file/Files ? createDirectories R(Ljava/nio/file/Path;[Ljava/nio/file/attribute/FileAttribute;)Ljava/nio/file/Path; ? ?
? ? readCheckpoint E(Ljava/nio/file/Path;)Lcom/groupbyinc/flux/index/translog/Checkpoint; ? ?
? -com/groupbyinc/flux/index/translog/Checkpoint ?
generation J ? ? ? ? getFilename (J)Ljava/lang/String; ? ?
? java/nio/file/Path ? resolve ((Ljava/lang/String;)Ljava/nio/file/Path; ? ? ? ? getCommitCheckpointFileName ? ?
? V W ? java/nio/file/LinkOption ? exists 2(Ljava/nio/file/Path;[Ljava/nio/file/LinkOption;)Z ? ?
? ? size (Ljava/nio/file/Path;)J ? ?
? ? 1com/groupbyinc/flux/index/translog/TranslogWriter ? getHeaderLength (Ljava/lang/String;)I ? ?
? ? java/lang/AssertionError ? java/lang/StringBuilder ?
? n unexpected translog file: [ ? append -(Ljava/lang/String;)Ljava/lang/StringBuilder; ? ?
? ? -(Ljava/lang/Object;)Ljava/lang/StringBuilder; ? ?
? ? ] ? toString ? ?
? ? (Ljava/lang/Object;)V X ?
? ? deleteIfExists (Ljava/nio/file/Path;)Z ? ?
? ? logger !Lorg/apache/logging/log4j/Logger; ? ? ? ?deleted previously created, but not yet committed, next generation [{}]. This can happen due to a tragic exception when creating a new generation ? getFileName ? ? ? ? org/apache/logging/log4j/Logger ? warn '(Ljava/lang/String;Ljava/lang/Object;)V ? recoverFromFiles F(Lcom/groupbyinc/flux/index/translog/Checkpoint;)Ljava/util/ArrayList;
java/util/List addAll (Ljava/util/Collection;)Z
isEmpty ()Z java/lang/IllegalStateException %at least one reader must be recovered (Ljava/lang/String;)V X
K L createWriter 6(J)Lcom/groupbyinc/flux/index/translog/TranslogWriter;
5com/groupbyinc/flux/common/apache/lucene/util/IOUtils closeWhileHandlingException (Ljava/lang/Iterable;)V!"
# java/lang/Throwable% rm ([Ljava/nio/file/Path;)V'(
) #getMinTranslogGenerationForRecovery ()J+,
?- Hwipe translog location - creating new translog, starting generation [{}]/ java/lang/Long1 valueOf (J)Ljava/lang/Long;34
25 debug7 ?8 getAsLong:, ?; emptyTranslogCheckpoint 5(JJJJ)Lcom/groupbyinc/flux/index/translog/Checkpoint;=>
?? getChannelFactory 5()Lcom/groupbyinc/flux/index/translog/ChannelFactory;AB
C java/nio/file/OpenOptionE java/nio/file/StandardOpenOptionG WRITE "Ljava/nio/file/StandardOpenOption;IJ HK
CREATE_NEWMJ HN write ?(Lcom/groupbyinc/flux/index/translog/ChannelFactory;Ljava/nio/file/Path;Lcom/groupbyinc/flux/index/translog/Checkpoint;[Ljava/nio/file/OpenOption;)VPQ
?R fsync (Ljava/nio/file/Path;Z)VTU
V 7(JJ)Lcom/groupbyinc/flux/index/translog/TranslogWriter;X
Y clear[ m \ ([Ljava/io/Closeable;)V!^
_
checkpoint /Lcom/groupbyinc/flux/index/translog/Checkpoint; nextTranslogFile currentCheckpointFile success checkpointFile e Ljava/lang/Exception; this -Lcom/groupbyinc/flux/index/translog/Translog; expectedTranslogUUID rwl *Ljava/util/concurrent/locks/ReadWriteLock; createTempFile v(Ljava/nio/file/Path;Ljava/lang/String;Ljava/lang/String;[Ljava/nio/file/attribute/FileAttribute;)Ljava/nio/file/Path;no
?p acquire =()Lcom/groupbyinc/flux/common/util/concurrent/ReleasableLock;rs
?t 'open uncommitted translog checkpoint {}v minTranslogGenerationx ? ?y
indexSettings{ e
| 'com/groupbyinc/flux/index/IndexSettings~ getIndexVersionCreated ()Lcom/groupbyinc/flux/Version;??
? com/groupbyinc/flux/Version?
V_6_0_0_beta1 Lcom/groupbyinc/flux/Version;?? ?? before (Lcom/groupbyinc/flux/Version;)Z??
?? Lno minTranslogGeneration in checkpoint, but index was created with version [?
openReader x(Ljava/nio/file/Path;Lcom/groupbyinc/flux/index/translog/Checkpoint;)Lcom/groupbyinc/flux/index/translog/TranslogReader;??
? add (Ljava/lang/Object;)Z??
l? -translog file doesn't exist with generation: ? (J)Ljava/lang/StringBuilder; ??
?? recovering from: ?
checkpoint: ? # - translog ids must be consecutive? read? ?
?? +recovered local translog from checkpoint {}? java/util/Collections? reverse (Ljava/util/List;)V??
?? deleteFilesIgnoringExceptions?(
? equals??
?? Checkpoint file ? 4 already exists but has corrupted content expected: ?
but got: ? java/nio/file/CopyOption? java/nio/file/StandardCopyOption? REPLACE_EXISTING "Ljava/nio/file/StandardCopyOption;?? ?? copy Y(Ljava/nio/file/Path;Ljava/nio/file/Path;[Ljava/nio/file/CopyOption;)Ljava/nio/file/Path;??
?? ATOMIC_MOVE?? ?? move??
?? getParent? ? ?? close? m
??
addSuppressed (Ljava/lang/Throwable;)V??
&? delete (Ljava/nio/file/Path;)V??
?? "java/lang/invoke/LambdaMetafactory? metafactory ?(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;??
??? ()Ljava/lang/Object;? lambda$recoverFromFiles$0 ((Ljava/nio/file/Path;)Ljava/lang/Object;??
?? get >(Ljava/nio/file/Path;)Lorg/apache/logging/log4j/util/Supplier;?? ? @(Lorg/apache/logging/log4j/util/Supplier;Ljava/lang/Throwable;)V ? ?? indexVersionCreated minGenerationToRecoverFrom committedTranslogFile reader 3Lcom/groupbyinc/flux/index/translog/TranslogReader; i checkpointFromDisk checkpointTranslogFile commitCheckpoint lock ex Ljava/io/IOException; foundTranslogs JLjava/util/ArrayList; Ljava/util/ArrayList; tempFile tempFileRenamed READ J H java/nio/channels/FileChannel open P(Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/nio/channels/FileChannel;
parseIdFromFileName ?
expected generation: 1com/groupbyinc/flux/index/translog/TranslogReader ?(Ljava/nio/channels/FileChannel;Ljava/nio/file/Path;Lcom/groupbyinc/flux/index/translog/Checkpoint;Ljava/lang/String;)Lcom/groupbyinc/flux/index/translog/TranslogReader;
?^
path channel Ljava/nio/channels/FileChannel; java/lang/NumberFormatException ? ? ? @ java/util/regex/Pattern matcher 3(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;
! java/util/regex/Matcher# matches%
$& group (I)Ljava/lang/String;()
$* parseLong (Ljava/lang/String;)J,-
2. Gnumber formatting issue in a file that passed PARSE_STRICT_ID_PATTERN: 0 *(Ljava/lang/String;Ljava/lang/Throwable;)V X2
3 "java/lang/IllegalArgumentException5 can't parse id from file: 7
6 !Ljava/lang/NumberFormatException; translogFile fileName Ljava/util/regex/Matcher; isOpen?
s?
compareAndSet (ZZ)ZAB
sC syncE m
?F #closeFilesIfNoPendingRetentionLocksH m
I translog closedK7 ?M currentFileGeneration
getGenerationP,
?Q ignored getMinFileGeneration stream ()Ljava/util/stream/Stream;UV W &(Ljava/lang/Object;)Ljava/lang/Object;Y 5com/groupbyinc/flux/index/translog/BaseTranslogReader[
\Q] E(Lcom/groupbyinc/flux/index/translog/TranslogReader;)Ljava/lang/Long;_ apply ()Ljava/util/function/Function;ab c java/util/stream/Streame map 8(Ljava/util/function/Function;)Ljava/util/stream/Stream;ghfi '(Ljava/lang/Object;Ljava/lang/Object;)Ik compareTo (Ljava/lang/Long;)Imn
2op #(Ljava/lang/Long;Ljava/lang/Long;)Ir compare ()Ljava/util/Comparator;tu v min ,(Ljava/util/Comparator;)Ljava/util/Optional;xyfz java/util/Optional|??
}~ (I)Ljava/lang/Object;?? ?
Q
2? =the first translog isn't the one with the minimum generation:? uncommittedOperations ()I totalOperations (J)I??
? uncommittedSizeInBytes sizeInBytesByMinGen (J)J??
????????? sizeInBytes
ensureOpen? m
? of -(Ljava/lang/Object;)Ljava/util/stream/Stream;??f? concat M(Ljava/util/stream/Stream;Ljava/util/stream/Stream;)Ljava/util/stream/Stream;??f?? lambda$totalOperations$1 ;(JLcom/groupbyinc/flux/index/translog/BaseTranslogReader;)Z??
?? :(Lcom/groupbyinc/flux/index/translog/BaseTranslogReader;)Z? test !(J)Ljava/util/function/Predicate;?? ? filter 9(Ljava/util/function/Predicate;)Ljava/util/stream/Stream;??f? (Ljava/lang/Object;)I???
\?? :(Lcom/groupbyinc/flux/index/translog/BaseTranslogReader;)I?
applyAsInt $()Ljava/util/function/ToIntFunction;?? ? mapToInt @(Ljava/util/function/ToIntFunction;)Ljava/util/stream/IntStream;??f? java/util/stream/IntStream? sum????
minGeneration !estimateTotalOperationsFromMinSeq readersAboveMinSeqNo (J)Ljava/util/stream/Stream;??
? minSeqNo lambda$sizeInBytesByMinGen$2??
?? ? (Ljava/lang/Object;)J??,
\?? :(Lcom/groupbyinc/flux/index/translog/BaseTranslogReader;)J? applyAsLong %()Ljava/util/function/ToLongFunction;?? ? mapToLong B(Ljava/util/function/ToLongFunction;)Ljava/util/stream/LongStream;??f? java/util/stream/LongStream??,?? sizeOfGensAboveSeqNoInBytesT,
? fileGeneration shardId )Lcom/groupbyinc/flux/index/shard/ShardId;?? ?
getBufferSize 1()Lcom/groupbyinc/flux/common/unit/ByteSizeValue;??
_?,? P(Lcom/groupbyinc/flux/index/translog/Translog;)Ljava/util/function/LongSupplier;:? ? create*(Lcom/groupbyinc/flux/index/shard/ShardId;Ljava/lang/String;JLjava/nio/file/Path;Lcom/groupbyinc/flux/index/translog/ChannelFactory;Lcom/groupbyinc/flux/common/unit/ByteSizeValue;Ljava/util/function/LongSupplier;JLjava/util/function/LongSupplier;)Lcom/groupbyinc/flux/index/translog/TranslogWriter;??
?? 4com/groupbyinc/flux/index/translog/TranslogException? "failed to create new translog file? S(Lcom/groupbyinc/flux/index/shard/ShardId;Ljava/lang/String;Ljava/lang/Throwable;)V X?
?? newFile initialMinTranslogGen o(Lcom/groupbyinc/flux/index/translog/Translog$Operation;)Lcom/groupbyinc/flux/index/translog/Translog$Location; Ecom/groupbyinc/flux/common/apache/lucene/store/AlreadyClosedException @com/groupbyinc/flux/common/io/stream/ReleasableBytesStreamOutput .(Lcom/groupbyinc/flux/common/util/BigArrays;)V X
position ,
skip (I)V
?com/groupbyinc/flux/index/translog/BufferedChecksumStreamOutput 6(Lcom/groupbyinc/flux/common/io/stream/StreamOutput;)V X
writeOperationNoSize {(Lcom/groupbyinc/flux/index/translog/BufferedChecksumStreamOutput;Lcom/groupbyinc/flux/index/translog/Translog$Operation;)V
seek (J)V
writeInt
bytes B()Lcom/groupbyinc/flux/common/bytes/ReleasablePagedBytesReference;"#
$ seqNo&, ' j(Lcom/groupbyinc/flux/common/bytes/BytesReference;J)Lcom/groupbyinc/flux/index/translog/Translog$Location;?)
?* >com/groupbyinc/flux/common/bytes/ReleasablePagedBytesReference, +com/groupbyinc/flux/common/lease/Releasable. ,com/groupbyinc/flux/common/lease/Releasables0 1([Lcom/groupbyinc/flux/common/lease/Releasable;)V?2
13 closeOnTragicEvent (Ljava/lang/Exception;)V56
7
]? Failed to write operation [: start end
operationSize I @Lcom/groupbyinc/flux/common/bytes/ReleasablePagedBytesReference; inner operation 7Lcom/groupbyinc/flux/index/translog/Translog$Operation; out BLcom/groupbyinc/flux/common/io/stream/ReleasableBytesStreamOutput; shouldFlush?,
G )Lcom/groupbyinc/flux/index/IndexSettings;{I J getFlushThresholdSizeL?
M -com/groupbyinc/flux/common/unit/ByteSizeValueO getBytesQ,
PR shouldRollGeneration
?? getGenerationThresholdSizeV?
W threshold getLastWriteLocation 8()Lcom/groupbyinc/flux/index/translog/Translog$Location; ? ???? (JJI)V X^
%_ getLastSyncedGlobalCheckpoint getLastSyncedCheckpoint 1()Lcom/groupbyinc/flux/index/translog/Checkpoint;bc
?d globalCheckpointf ? ?g newSnapshot 8()Lcom/groupbyinc/flux/index/translog/Translog$Snapshot; newSnapshotFromGen 9(J)Lcom/groupbyinc/flux/index/translog/Translog$Snapshot;kl
m requested snapshot generation [o 2] is not available. Min referenced generation is [q lambda$newSnapshotFromGen$3s?
tu ? 7()Lcom/groupbyinc/flux/index/translog/TranslogSnapshot;ix
\yz n(Lcom/groupbyinc/flux/index/translog/BaseTranslogReader;)Lcom/groupbyinc/flux/index/translog/TranslogSnapshot;| c? lambda$newSnapshotFromGen$4 9(I)[Lcom/groupbyinc/flux/index/translog/TranslogSnapshot;??
??? "()Ljava/util/function/IntFunction;a?
? toArray 5(Ljava/util/function/IntFunction;)[Ljava/lang/Object;??f? 6[Lcom/groupbyinc/flux/index/translog/TranslogSnapshot;? newMultiSnapshot n([Lcom/groupbyinc/flux/index/translog/TranslogSnapshot;)Lcom/groupbyinc/flux/index/translog/Translog$Snapshot;??
? snapshots newSnapshotFromMinSeqNo lambda$newSnapshotFromMinSeqNo$5??
?? ? m lambda$newMultiSnapshot$6? m
?? ()Ljava/io/Closeable;?? ? java/util/Arrays? .([Ljava/lang/Object;)Ljava/util/stream/Stream;U?
?? G(Lcom/groupbyinc/flux/index/translog/TranslogSnapshot;)Ljava/lang/Long;?
c longValue?,
2? 3com/groupbyinc/flux/index/translog/TranslogSnapshot? ? ? first reader generation of ? is not the smallest? $acquireTranslogGenFromDeletionPolicy (J)Ljava/io/Closeable;??
? 0com/groupbyinc/flux/index/translog/MultiSnapshot? L([Lcom/groupbyinc/flux/index/translog/TranslogSnapshot;Ljava/io/Closeable;)V X?
?? ? onClose Ljava/io/Closeable; result 6Lcom/groupbyinc/flux/index/translog/Translog$Snapshot; isHeldByCurrentThread ()Ljava/lang/Boolean;??
?? java/lang/Boolean? booleanValue?
??