com.groupbyinc.flux.index.translog.Translog.class Maven / Gradle / Ivy
???? 4? +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; DEFAULT_HEADER_SIZE_IN_BYTES I 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; primaryTermSupplier 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;Ljava/util/function/LongSupplier;)V java/io/IOException ] java/lang/Exception _ 1com/groupbyinc/flux/index/translog/TranslogConfig a
getShardId +()Lcom/groupbyinc/flux/index/shard/ShardId; c d
b e getIndexSettings +()Lcom/groupbyinc/flux/index/IndexSettings; g h
b i U(Lcom/groupbyinc/flux/index/shard/ShardId;Lcom/groupbyinc/flux/index/IndexSettings;)V [ k
l java/util/ArrayList n ()V [ p
o q C D s )java/util/concurrent/atomic/AtomicBoolean u
v q O P x Q R z S T | U T ~ W X ? V - ? getBigArrays -()Lcom/groupbyinc/flux/common/util/BigArrays; ? ?
b ? F G ? 1java/util/concurrent/locks/ReentrantReadWriteLock ?
? q 9com/groupbyinc/flux/common/util/concurrent/ReleasableLock ? (java/util/concurrent/locks/ReadWriteLock ? #()Ljava/util/concurrent/locks/Lock; H ? ? ? $(Ljava/util/concurrent/locks/Lock;)V [ ?
? ? H I ? J ? ? ? J I ? getTranslogPath ()Ljava/nio/file/Path; ? ?
b ? K L ? %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 ? ?
? Y Z ? 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/TranslogHeader ? headerSizeInBytes (Ljava/lang/String;)I ? ?
? ? java/lang/AssertionError ? java/lang/StringBuilder ?
? q unexpected translog file: [ ? append -(Ljava/lang/String;)Ljava/lang/StringBuilder; ? ?
? ? -(Ljava/lang/Object;)Ljava/lang/StringBuilder; ? ?
? ? ] ? toString ()Ljava/lang/String; ? ?
? ? (Ljava/lang/Object;)V [ ?
? ? java/lang/String ? 9com/groupbyinc/flux/index/translog/TranslogDeletionPolicy ? java/util/function/LongSupplier ? 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 [
M N getMinFileGeneration ()J
globalCheckpoint ? ? createWriter 8(JJJ)Lcom/groupbyinc/flux/index/translog/TranslogWriter;"#
$ ,com/groupbyinc/flux/core/internal/io/IOUtils& closeWhileHandlingException (Ljava/lang/Iterable;)V()
'* java/lang/Throwable, ([Ljava/io/Closeable;)V(.
'/
checkpoint /Lcom/groupbyinc/flux/index/translog/Checkpoint; nextTranslogFile currentCheckpointFile success e Ljava/lang/Exception; this -Lcom/groupbyinc/flux/index/translog/Translog; 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;<=
?> acquire =()Lcom/groupbyinc/flux/common/util/concurrent/ReleasableLock;@A
?B 'open uncommitted translog checkpoint {}D debugF ?G minTranslogGenerationI ? ?J
indexSettingsL h
M 'com/groupbyinc/flux/index/IndexSettingsO getIndexVersionCreated ()Lcom/groupbyinc/flux/Version;QR
PS com/groupbyinc/flux/VersionU
V_6_0_0_beta1 Lcom/groupbyinc/flux/Version;WX VY before (Lcom/groupbyinc/flux/Version;)Z[\
V] Lno minTranslogGeneration in checkpoint, but index was created with version [_ #getMinTranslogGenerationForRecoverya
?b
openReader x(Ljava/nio/file/Path;Lcom/groupbyinc/flux/index/translog/Checkpoint;)Lcom/groupbyinc/flux/index/translog/TranslogReader;de
f add (Ljava/lang/Object;)Zhi
oj -translog file doesn't exist with generation: l (J)Ljava/lang/StringBuilder; ?n
?o recovering from: q
checkpoint: s # - translog ids must be consecutiveu readw ?
?x 1com/groupbyinc/flux/index/translog/TranslogReaderz getPrimaryTerm|
{} getAsLong ?? *Primary terms go backwards; current term [? ]translog path [ ? , existing term [? +recovered local translog from checkpoint {}? java/util/Collections? reverse (Ljava/util/List;)V??
?? deleteFilesIgnoringExceptions ([Ljava/nio/file/Path;)V??
'? equals?i
?? 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;??
?? fsync (Ljava/nio/file/Path;Z)V??
'? ATOMIC_MOVE?? ?? move??
?? getParent? ? ?? $closeResource 1(Ljava/lang/Throwable;Ljava/lang/AutoCloseable;)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;??
??? ,()Lorg/apache/logging/log4j/message/Message;? lambda$recoverFromFiles$0 @(Ljava/nio/file/Path;)Lorg/apache/logging/log4j/message/Message;??
?? get E(Ljava/nio/file/Path;)Lorg/apache/logging/log4j/util/MessageSupplier;?? ? G(Lorg/apache/logging/log4j/util/MessageSupplier;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 java/nio/file/OpenOption? java/nio/file/StandardOpenOption? READ "Ljava/nio/file/StandardOpenOption;?? ?? java/nio/channels/FileChannel? open P(Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/nio/channels/FileChannel;??
?? parseIdFromFileName? ?
? expected generation: ? ?(Ljava/nio/channels/FileChannel;Ljava/nio/file/Path;Lcom/groupbyinc/flux/index/translog/Checkpoint;Ljava/lang/String;)Lcom/groupbyinc/flux/index/translog/TranslogReader;??
{? close?.
'? 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;
java/lang/Long parseLong (Ljava/lang/String;)J
Gnumber formatting issue in a file that passed PARSE_STRICT_ID_PATTERN: *(Ljava/lang/String;Ljava/lang/Throwable;)V [
"java/lang/IllegalArgumentException can't parse id from file: !
!Ljava/lang/NumberFormatException; translogFile fileName Ljava/util/regex/Matcher; isOpen?
v)
compareAndSet (ZZ)Z+,
v- 1com/groupbyinc/flux/index/translog/TranslogWriter/ sync1 p
02 #closeFilesIfNoPendingRetentionLocks4 p
5 translog closed7F ?9 currentFileGeneration
getGeneration<
0= ignored stream ()Ljava/util/stream/Stream;@A B &(Ljava/lang/Object;)Ljava/lang/Object;D 5com/groupbyinc/flux/index/translog/BaseTranslogReaderF
G=H E(Lcom/groupbyinc/flux/index/translog/TranslogReader;)Ljava/lang/Long;J apply ()Ljava/util/function/Function;LM N java/util/stream/StreamP map 8(Ljava/util/function/Function;)Ljava/util/stream/Stream;RSQT '(Ljava/lang/Object;Ljava/lang/Object;)IV compareTo (Ljava/lang/Long;)IXY
Z[ #(Ljava/lang/Long;Ljava/lang/Long;)I] compare ()Ljava/util/Comparator;_` a min ,(Ljava/util/Comparator;)Ljava/util/Optional;cdQe java/util/Optionalg ()Ljava/lang/Object;?i
hj (I)Ljava/lang/Object;?l m
{= valueOf (J)Ljava/lang/Long;pq
r
? =the first translog isn't the one with the minimum generation:u totalOperations ()I???????? totalOperationsByMinGen (J)I{|
} sizeInBytes sizeInBytesByMinGen (J)J??
? earliestLastModifiedAge
ensureOpen? p
? java/lang/System? currentTimeMillis?
?? findEarliestLastModifiedAge K(JLjava/lang/Iterable;Lcom/groupbyinc/flux/index/translog/TranslogWriter;)J??
? 4com/groupbyinc/flux/index/translog/TranslogException? shardId )Lcom/groupbyinc/flux/index/shard/ShardId;?? ? EUnable to get the earliest last modified time for the transaction log? >(Lcom/groupbyinc/flux/index/shard/ShardId;Ljava/lang/String;)V [?
?? java/lang/Iterable? iterator ()Ljava/util/Iterator;???? java/util/Iterator? hasNext??? next?i?? getLastModifiedTime?
G? java/lang/Math? (JJ)Jc?
??
0? max??
?? r 7Lcom/groupbyinc/flux/index/translog/BaseTranslogReader; currentTime ILjava/lang/Iterable; Ljava/lang/Iterable; writer earliestTime of -(Ljava/lang/Object;)Ljava/util/stream/Stream;??Q? concat M(Ljava/util/stream/Stream;Ljava/util/stream/Stream;)Ljava/util/stream/Stream;??Q?i lambda$totalOperationsByMinGen$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;??Q? (Ljava/lang/Object;)I? lambda$totalOperationsByMinGen$2??
?? :(Lcom/groupbyinc/flux/index/translog/BaseTranslogReader;)I?
applyAsInt $()Ljava/util/function/ToIntFunction;?? ? mapToInt @(Ljava/util/function/ToIntFunction;)Ljava/util/stream/IntStream;??Q? java/util/stream/IntStream? sum?x??
minGeneration !estimateTotalOperationsFromMinSeq readersAboveMinSeqNo (J)Ljava/util/stream/Stream;??
?wx
G?? ? minSeqNo lambda$sizeInBytesByMinGen$3??
?? ? (Ljava/lang/Object;)J? lambda$sizeInBytesByMinGen$4??
?? :(Lcom/groupbyinc/flux/index/translog/BaseTranslogReader;)J applyAsLong %()Ljava/util/function/ToLongFunction; mapToLong B(Ljava/util/function/ToLongFunction;)Ljava/util/stream/LongStream;Q java/util/stream/LongStream
? 6(J)Lcom/groupbyinc/flux/index/translog/TranslogWriter;
0 A B 4Mismatch translog header size; empty translog size [ , header size [ (I)Ljava/lang/StringBuilder; ?
? fileGeneration getChannelFactory 5()Lcom/groupbyinc/flux/index/translog/ChannelFactory;
getBufferSize 1()Lcom/groupbyinc/flux/common/unit/ByteSizeValue;
b! 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;JJLjava/util/function/LongSupplier;Ljava/util/function/LongSupplier;J)Lcom/groupbyinc/flux/index/translog/TranslogWriter;()
0* "failed to create new translog file, S(Lcom/groupbyinc/flux/index/shard/ShardId;Ljava/lang/String;Ljava/lang/Throwable;)V [.
?/ newFile initialMinTranslogGen initialGlobalCheckpoint o(Lcom/groupbyinc/flux/index/translog/Translog$Operation;)Lcom/groupbyinc/flux/index/translog/Translog$Location; Ecom/groupbyinc/flux/common/apache/lucene/store/AlreadyClosedException5 @com/groupbyinc/flux/common/io/stream/ReleasableBytesStreamOutput7 .(Lcom/groupbyinc/flux/common/util/BigArrays;)V [9
8: position<
8= skip (I)V?@
8A ?com/groupbyinc/flux/index/translog/BufferedChecksumStreamOutputC 6(Lcom/groupbyinc/flux/common/io/stream/StreamOutput;)V [E
DF writeOperationNoSize {(Lcom/groupbyinc/flux/index/translog/BufferedChecksumStreamOutput;Lcom/groupbyinc/flux/index/translog/Translog$Operation;)VHI
J seek (J)VNO
8P writeIntR@
8S bytes B()Lcom/groupbyinc/flux/common/bytes/ReleasablePagedBytesReference;UV
8W primaryTermY Z
0}