1818package org .apache .hadoop .hbase .regionserver .wal ;
1919
2020import static org .apache .hadoop .hbase .HConstants .REPLICATION_SCOPE_GLOBAL ;
21+ import static org .apache .hadoop .hbase .wal .WALKey .EMPTY_UUIDS ;
2122
2223import java .io .IOException ;
2324import java .util .ArrayList ;
25+ import java .util .List ;
2426import java .util .Map ;
2527import java .util .NavigableMap ;
2628import java .util .TreeMap ;
29+ import java .util .UUID ;
2730import java .util .function .Function ;
2831import org .apache .hadoop .conf .Configuration ;
2932import org .apache .hadoop .fs .FileSystem ;
@@ -75,8 +78,8 @@ private WALUtil() {
7578 public static WALKeyImpl writeCompactionMarker (WAL wal ,
7679 NavigableMap <byte [], Integer > replicationScope , RegionInfo hri , final CompactionDescriptor c ,
7780 MultiVersionConcurrencyControl mvcc ) throws IOException {
78- WALKeyImpl walKey =
79- writeMarker ( wal , replicationScope , hri , WALEdit .createCompaction (hri , c ), mvcc , null );
81+ WALKeyImpl walKey = writeMarker ( wal , replicationScope , hri , EMPTY_UUIDS ,
82+ WALEdit .createCompaction (hri , c ), mvcc , null );
8083 if (LOG .isTraceEnabled ()) {
8184 LOG .trace ("Appended compaction marker " + TextFormat .shortDebugString (c ));
8285 }
@@ -91,7 +94,7 @@ public static WALKeyImpl writeCompactionMarker(WAL wal,
9194 public static WALKeyImpl writeFlushMarker (WAL wal , NavigableMap <byte [], Integer > replicationScope ,
9295 RegionInfo hri , final FlushDescriptor f , boolean sync , MultiVersionConcurrencyControl mvcc )
9396 throws IOException {
94- WALKeyImpl walKey = doFullMarkerAppendTransaction (wal , replicationScope , hri ,
97+ WALKeyImpl walKey = doFullMarkerAppendTransaction (wal , replicationScope , hri , EMPTY_UUIDS ,
9598 WALEdit .createFlushWALEdit (hri , f ), mvcc , null , sync );
9699 if (LOG .isTraceEnabled ()) {
97100 LOG .trace ("Appended flush marker " + TextFormat .shortDebugString (f ));
@@ -106,8 +109,8 @@ public static WALKeyImpl writeFlushMarker(WAL wal, NavigableMap<byte[], Integer>
106109 public static WALKeyImpl writeRegionEventMarker (WAL wal ,
107110 NavigableMap <byte [], Integer > replicationScope , RegionInfo hri , RegionEventDescriptor r ,
108111 MultiVersionConcurrencyControl mvcc ) throws IOException {
109- WALKeyImpl walKey =
110- writeMarker ( wal , replicationScope , hri , WALEdit .createRegionEventWALEdit (hri , r ), mvcc , null );
112+ WALKeyImpl walKey = writeMarker ( wal , replicationScope , hri , EMPTY_UUIDS ,
113+ WALEdit .createRegionEventWALEdit (hri , r ), mvcc , null );
111114 if (LOG .isTraceEnabled ()) {
112115 LOG .trace ("Appended region event marker " + TextFormat .shortDebugString (r ));
113116 }
@@ -127,23 +130,23 @@ public static WALKeyImpl writeRegionEventMarker(WAL wal,
127130 */
128131 public static WALKeyImpl writeBulkLoadMarkerAndSync (final WAL wal ,
129132 final NavigableMap <byte [], Integer > replicationScope , final RegionInfo hri ,
130- final WALProtos .BulkLoadDescriptor desc , final MultiVersionConcurrencyControl mvcc )
131- throws IOException {
132- WALKeyImpl walKey =
133- writeMarker ( wal , replicationScope , hri , WALEdit .createBulkLoadEvent (hri , desc ), mvcc , null );
133+ List < UUID > clusterIds , final WALProtos .BulkLoadDescriptor desc ,
134+ final MultiVersionConcurrencyControl mvcc ) throws IOException {
135+ WALKeyImpl walKey = writeMarker ( wal , replicationScope , hri , clusterIds ,
136+ WALEdit .createBulkLoadEvent (hri , desc ), mvcc , null );
134137 if (LOG .isTraceEnabled ()) {
135138 LOG .trace ("Appended Bulk Load marker " + TextFormat .shortDebugString (desc ));
136139 }
137140 return walKey ;
138141 }
139142
140143 private static WALKeyImpl writeMarker (final WAL wal ,
141- NavigableMap <byte [], Integer > replicationScope , RegionInfo hri , WALEdit edit ,
142- MultiVersionConcurrencyControl mvcc , Map <String , byte []> extendedAttributes )
144+ NavigableMap <byte [], Integer > replicationScope , RegionInfo hri , List < UUID > clusterIds ,
145+ WALEdit edit , MultiVersionConcurrencyControl mvcc , Map <String , byte []> extendedAttributes )
143146 throws IOException {
144147 // If sync == true in below, then timeout is not used; safe to pass UNSPECIFIED_TIMEOUT
145- return doFullMarkerAppendTransaction (wal , replicationScope , hri , edit , mvcc , extendedAttributes ,
146- true );
148+ return doFullMarkerAppendTransaction (wal , replicationScope , hri , clusterIds , edit , mvcc ,
149+ extendedAttributes , true );
147150 }
148151
149152 /**
@@ -155,12 +158,12 @@ private static WALKeyImpl writeMarker(final WAL wal,
155158 * @return WALKeyImpl that was added to the WAL.
156159 */
157160 private static WALKeyImpl doFullMarkerAppendTransaction (WAL wal ,
158- NavigableMap <byte [], Integer > replicationScope , RegionInfo hri , final WALEdit edit ,
159- MultiVersionConcurrencyControl mvcc , Map <String , byte []> extendedAttributes , boolean sync )
160- throws IOException {
161+ NavigableMap <byte [], Integer > replicationScope , RegionInfo hri , final List < UUID > clusterIds ,
162+ final WALEdit edit , MultiVersionConcurrencyControl mvcc , Map <String , byte []> extendedAttributes ,
163+ boolean sync ) throws IOException {
161164 // TODO: Pass in current time to use?
162165 WALKeyImpl walKey = new WALKeyImpl (hri .getEncodedNameAsBytes (), hri .getTable (),
163- EnvironmentEdgeManager .currentTime (), mvcc , replicationScope , extendedAttributes );
166+ EnvironmentEdgeManager .currentTime (), clusterIds , mvcc , replicationScope , extendedAttributes );
164167 long trx = MultiVersionConcurrencyControl .NONE ;
165168 try {
166169 trx = wal .appendMarker (hri , walKey , edit );
@@ -232,7 +235,7 @@ public static void writeReplicationMarkerAndSync(WAL wal, MultiVersionConcurrenc
232235 RegionInfo regionInfo , byte [] rowKey , long timestamp ) throws IOException {
233236 NavigableMap <byte [], Integer > replicationScope = new TreeMap <>(Bytes .BYTES_COMPARATOR );
234237 replicationScope .put (WALEdit .METAFAMILY , REPLICATION_SCOPE_GLOBAL );
235- writeMarker (wal , replicationScope , regionInfo ,
238+ writeMarker (wal , replicationScope , regionInfo , EMPTY_UUIDS ,
236239 WALEdit .createReplicationMarkerEdit (rowKey , timestamp ), mvcc , null );
237240 }
238241}
0 commit comments