View Javadoc

1   /**
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.apache.hadoop.hbase.filter;
19  
20  import java.util.ArrayList;
21  import java.util.Arrays;
22  import java.util.Collections;
23  import java.util.Comparator;
24  import java.util.List;
25  
26  import org.apache.hadoop.hbase.Cell;
27  import org.apache.hadoop.hbase.KeyValueUtil;
28  import org.apache.hadoop.hbase.classification.InterfaceAudience;
29  import org.apache.hadoop.hbase.classification.InterfaceStability;
30  import org.apache.hadoop.hbase.exceptions.DeserializationException;
31  import org.apache.hadoop.hbase.protobuf.generated.FilterProtos;
32  import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BytesBytesPair;
33  import org.apache.hadoop.hbase.util.ByteStringer;
34  import org.apache.hadoop.hbase.util.Bytes;
35  import org.apache.hadoop.hbase.util.Pair;
36  import org.apache.hadoop.hbase.util.UnsafeAccess;
37  
38  import com.google.common.annotations.VisibleForTesting;
39  import com.google.protobuf.InvalidProtocolBufferException;
40  
41  /**
42   * This is optimized version of a standard FuzzyRowFilter Filters data based on fuzzy row key.
43   * Performs fast-forwards during scanning. It takes pairs (row key, fuzzy info) to match row keys.
44   * Where fuzzy info is a byte array with 0 or 1 as its values:
45   * <ul>
46   * <li>0 - means that this byte in provided row key is fixed, i.e. row key's byte at same position
47   * must match</li>
48   * <li>1 - means that this byte in provided row key is NOT fixed, i.e. row key's byte at this
49   * position can be different from the one in provided row key</li>
50   * </ul>
51   * Example: Let's assume row key format is userId_actionId_year_month. Length of userId is fixed and
52   * is 4, length of actionId is 2 and year and month are 4 and 2 bytes long respectively. Let's
53   * assume that we need to fetch all users that performed certain action (encoded as "99") in Jan of
54   * any year. Then the pair (row key, fuzzy info) would be the following: row key = "????_99_????_01"
55   * (one can use any value instead of "?") fuzzy info =
56   * "\x01\x01\x01\x01\x00\x00\x00\x00\x01\x01\x01\x01\x00\x00\x00" I.e. fuzzy info tells the matching
57   * mask is "????_99_????_01", where at ? can be any value.
58   */
59  @InterfaceAudience.Public
60  @InterfaceStability.Evolving
61  public class FuzzyRowFilter extends FilterBase {
62    private List<Pair<byte[], byte[]>> fuzzyKeysData;
63    private boolean done = false;
64  
65    /**
66     * The index of a last successfully found matching fuzzy string (in fuzzyKeysData). We will start
67     * matching next KV with this one. If they do not match then we will return back to the one-by-one
68     * iteration over fuzzyKeysData.
69     */
70    private int lastFoundIndex = -1;
71  
72    /**
73     * Row tracker (keeps all next rows after SEEK_NEXT_USING_HINT was returned)
74     */
75    private RowTracker tracker;
76  
77    public FuzzyRowFilter(List<Pair<byte[], byte[]>> fuzzyKeysData) {
78      Pair<byte[], byte[]> p;
79      for (int i = 0; i < fuzzyKeysData.size(); i++) {
80        p = fuzzyKeysData.get(i);
81        if (p.getFirst().length != p.getSecond().length) {
82          Pair<String, String> readable =
83              new Pair<String, String>(Bytes.toStringBinary(p.getFirst()), Bytes.toStringBinary(p
84                  .getSecond()));
85          throw new IllegalArgumentException("Fuzzy pair lengths do not match: " + readable);
86        }
87        // update mask ( 0 -> -1 (0xff), 1 -> 0)
88        p.setSecond(preprocessMask(p.getSecond()));
89        preprocessSearchKey(p);
90      }
91      this.fuzzyKeysData = fuzzyKeysData;
92      this.tracker = new RowTracker();
93    }
94  
95    private void preprocessSearchKey(Pair<byte[], byte[]> p) {
96      if (UnsafeAccess.isAvailable() == false) {
97        // do nothing
98        return;
99      }
100     byte[] key = p.getFirst();
101     byte[] mask = p.getSecond();
102     for (int i = 0; i < mask.length; i++) {
103       // set non-fixed part of a search key to 0.
104       if (mask[i] == 0) key[i] = 0;
105     }
106   }
107 
108   /**
109    * We need to preprocess mask array, as since we treat 0's as unfixed positions and -1 (0xff) as
110    * fixed positions
111    * @param mask
112    * @return mask array
113    */
114   private byte[] preprocessMask(byte[] mask) {
115     if (UnsafeAccess.isAvailable() == false) {
116       // do nothing
117       return mask;
118     }
119     if (isPreprocessedMask(mask)) return mask;
120     for (int i = 0; i < mask.length; i++) {
121       if (mask[i] == 0) {
122         mask[i] = -1; // 0 -> -1
123       } else if (mask[i] == 1) {
124         mask[i] = 0;// 1 -> 0
125       }
126     }
127     return mask;
128   }
129 
130   private boolean isPreprocessedMask(byte[] mask) {
131     for (int i = 0; i < mask.length; i++) {
132       if (mask[i] != -1 && mask[i] != 0) {
133         return false;
134       }
135     }
136     return true;
137   }
138 
139   @Override
140   public ReturnCode filterKeyValue(Cell c) {
141     final int startIndex = lastFoundIndex >= 0 ? lastFoundIndex : 0;
142     final int size = fuzzyKeysData.size();
143     for (int i = startIndex; i < size + startIndex; i++) {
144       final int index = i % size;
145       Pair<byte[], byte[]> fuzzyData = fuzzyKeysData.get(index);
146       SatisfiesCode satisfiesCode =
147           satisfies(isReversed(), c.getRowArray(), c.getRowOffset(), c.getRowLength(),
148             fuzzyData.getFirst(), fuzzyData.getSecond());
149       if (satisfiesCode == SatisfiesCode.YES) {
150         lastFoundIndex = index;
151         return ReturnCode.INCLUDE;
152       }
153     }
154     // NOT FOUND -> seek next using hint
155     lastFoundIndex = -1;
156     return ReturnCode.SEEK_NEXT_USING_HINT;
157 
158   }
159 
160   @Override
161   public Cell getNextCellHint(Cell currentCell) {
162     boolean result = true;
163     if (tracker.needsUpdate()) {
164       result = tracker.updateTracker(currentCell);
165     }
166     if (result == false) {
167       done = true;
168       return null;
169     }
170     byte[] nextRowKey = tracker.nextRow();
171     // We need to compare nextRowKey with currentCell
172     int compareResult =
173         Bytes.compareTo(nextRowKey, 0, nextRowKey.length, currentCell.getRowArray(),
174           currentCell.getRowOffset(), currentCell.getRowLength());
175     if ((reversed && compareResult > 0) || (!reversed && compareResult < 0)) {
176       // This can happen when we have multilpe filters and some other filter
177       // returns next row with hint which is larger (smaller for reverse)
178       // than the current (really?)
179       result = tracker.updateTracker(currentCell);
180       if (result == false) {
181         done = true;
182         return null;
183       } else {
184         nextRowKey = tracker.nextRow();
185       }
186     }
187     return KeyValueUtil.createFirstOnRow(nextRowKey);
188   }
189 
190   /**
191    * If we have multiple fuzzy keys, row tracker should improve overall performance It calculates
192    * all next rows (one per every fuzzy key), sort them accordingly (ascending for regular and
193    * descending for reverse). Next time getNextCellHint is called we check row tracker first and
194    * return next row from the tracker if it exists, if there are no rows in the tracker we update
195    * tracker with a current cell and return first row.
196    */
197   private class RowTracker {
198     private final List<byte[]> nextRows;
199     private int next = -1;
200 
201     RowTracker() {
202       nextRows = new ArrayList<byte[]>();
203     }
204 
205     boolean needsUpdate() {
206       return next == -1 || next == nextRows.size();
207     }
208 
209     byte[] nextRow() {
210       if (next < 0 || next == nextRows.size()) return null;
211       return nextRows.get(next++);
212     }
213 
214     boolean updateTracker(Cell currentCell) {
215       nextRows.clear();
216       for (Pair<byte[], byte[]> fuzzyData : fuzzyKeysData) {
217         byte[] nextRowKeyCandidate =
218             getNextForFuzzyRule(isReversed(), currentCell.getRowArray(),
219               currentCell.getRowOffset(), currentCell.getRowLength(), fuzzyData.getFirst(),
220               fuzzyData.getSecond());
221         if (nextRowKeyCandidate == null) {
222           continue;
223         }
224         nextRows.add(nextRowKeyCandidate);
225       }
226       // Sort all next row candidates
227       Collections.sort(nextRows, new Comparator<byte[]>() {
228         @Override
229         public int compare(byte[] o1, byte[] o2) {
230           if (reversed) {
231             return -Bytes.compareTo(o1, o2);
232           } else {
233             return Bytes.compareTo(o1, o2);
234           }
235         }
236       });
237       next = 0;
238       return nextRows.size() > 0;
239     }
240 
241   }
242 
243   @Override
244   public boolean filterAllRemaining() {
245     return done;
246   }
247 
248   /**
249    * @return The filter serialized using pb
250    */
251   public byte[] toByteArray() {
252     FilterProtos.FuzzyRowFilter.Builder builder = FilterProtos.FuzzyRowFilter.newBuilder();
253     for (Pair<byte[], byte[]> fuzzyData : fuzzyKeysData) {
254       BytesBytesPair.Builder bbpBuilder = BytesBytesPair.newBuilder();
255       bbpBuilder.setFirst(ByteStringer.wrap(fuzzyData.getFirst()));
256       bbpBuilder.setSecond(ByteStringer.wrap(fuzzyData.getSecond()));
257       builder.addFuzzyKeysData(bbpBuilder);
258     }
259     return builder.build().toByteArray();
260   }
261 
262   /**
263    * @param pbBytes A pb serialized {@link FuzzyRowFilter} instance
264    * @return An instance of {@link FuzzyRowFilter} made from <code>bytes</code>
265    * @throws DeserializationException
266    * @see #toByteArray
267    */
268   public static FuzzyRowFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
269     FilterProtos.FuzzyRowFilter proto;
270     try {
271       proto = FilterProtos.FuzzyRowFilter.parseFrom(pbBytes);
272     } catch (InvalidProtocolBufferException e) {
273       throw new DeserializationException(e);
274     }
275     int count = proto.getFuzzyKeysDataCount();
276     ArrayList<Pair<byte[], byte[]>> fuzzyKeysData = new ArrayList<Pair<byte[], byte[]>>(count);
277     for (int i = 0; i < count; ++i) {
278       BytesBytesPair current = proto.getFuzzyKeysData(i);
279       byte[] keyBytes = current.getFirst().toByteArray();
280       byte[] keyMeta = current.getSecond().toByteArray();
281       fuzzyKeysData.add(new Pair<byte[], byte[]>(keyBytes, keyMeta));
282     }
283     return new FuzzyRowFilter(fuzzyKeysData);
284   }
285 
286   @Override
287   public String toString() {
288     final StringBuilder sb = new StringBuilder();
289     sb.append("FuzzyRowFilter");
290     sb.append("{fuzzyKeysData=");
291     for (Pair<byte[], byte[]> fuzzyData : fuzzyKeysData) {
292       sb.append('{').append(Bytes.toStringBinary(fuzzyData.getFirst())).append(":");
293       sb.append(Bytes.toStringBinary(fuzzyData.getSecond())).append('}');
294     }
295     sb.append("}, ");
296     return sb.toString();
297   }
298 
299   // Utility methods
300 
301   static enum SatisfiesCode {
302     /** row satisfies fuzzy rule */
303     YES,
304     /** row doesn't satisfy fuzzy rule, but there's possible greater row that does */
305     NEXT_EXISTS,
306     /** row doesn't satisfy fuzzy rule and there's no greater row that does */
307     NO_NEXT
308   }
309 
310   @VisibleForTesting
311   static SatisfiesCode satisfies(byte[] row, byte[] fuzzyKeyBytes, byte[] fuzzyKeyMeta) {
312     return satisfies(false, row, 0, row.length, fuzzyKeyBytes, fuzzyKeyMeta);
313   }
314 
315   @VisibleForTesting
316   static SatisfiesCode satisfies(boolean reverse, byte[] row, byte[] fuzzyKeyBytes,
317       byte[] fuzzyKeyMeta) {
318     return satisfies(reverse, row, 0, row.length, fuzzyKeyBytes, fuzzyKeyMeta);
319   }
320 
321   static SatisfiesCode satisfies(boolean reverse, byte[] row, int offset, int length,
322       byte[] fuzzyKeyBytes, byte[] fuzzyKeyMeta) {
323 
324     if (UnsafeAccess.isAvailable() == false) {
325       return satisfiesNoUnsafe(reverse, row, offset, length, fuzzyKeyBytes, fuzzyKeyMeta);
326     }
327 
328     if (row == null) {
329       // do nothing, let scan to proceed
330       return SatisfiesCode.YES;
331     }
332     length = Math.min(length, fuzzyKeyBytes.length);
333     int numWords = length / Bytes.SIZEOF_LONG;
334 
335     int j = numWords << 3; // numWords * SIZEOF_LONG;
336 
337     for (int i = 0; i < j; i += Bytes.SIZEOF_LONG) {
338       long fuzzyBytes = UnsafeAccess.toLong(fuzzyKeyBytes, i);
339       long fuzzyMeta = UnsafeAccess.toLong(fuzzyKeyMeta, i);
340       long rowValue = UnsafeAccess.toLong(row, offset + i);
341       if ((rowValue & fuzzyMeta) != (fuzzyBytes)) {
342         // We always return NEXT_EXISTS
343         return SatisfiesCode.NEXT_EXISTS;
344       }
345     }
346 
347     int off = j;
348 
349     if (length - off >= Bytes.SIZEOF_INT) {
350       int fuzzyBytes = UnsafeAccess.toInt(fuzzyKeyBytes, off);
351       int fuzzyMeta = UnsafeAccess.toInt(fuzzyKeyMeta, off);
352       int rowValue = UnsafeAccess.toInt(row, offset + off);
353       if ((rowValue & fuzzyMeta) != (fuzzyBytes)) {
354         // We always return NEXT_EXISTS
355         return SatisfiesCode.NEXT_EXISTS;
356       }
357       off += Bytes.SIZEOF_INT;
358     }
359 
360     if (length - off >= Bytes.SIZEOF_SHORT) {
361       short fuzzyBytes = UnsafeAccess.toShort(fuzzyKeyBytes, off);
362       short fuzzyMeta = UnsafeAccess.toShort(fuzzyKeyMeta, off);
363       short rowValue = UnsafeAccess.toShort(row, offset + off);
364       if ((rowValue & fuzzyMeta) != (fuzzyBytes)) {
365         // We always return NEXT_EXISTS
366         // even if it does not (in this case getNextForFuzzyRule
367         // will return null)
368         return SatisfiesCode.NEXT_EXISTS;
369       }
370       off += Bytes.SIZEOF_SHORT;
371     }
372 
373     if (length - off >= Bytes.SIZEOF_BYTE) {
374       int fuzzyBytes = fuzzyKeyBytes[off] & 0xff;
375       int fuzzyMeta = fuzzyKeyMeta[off] & 0xff;
376       int rowValue = row[offset + off] & 0xff;
377       if ((rowValue & fuzzyMeta) != (fuzzyBytes)) {
378         // We always return NEXT_EXISTS
379         return SatisfiesCode.NEXT_EXISTS;
380       }
381     }
382     return SatisfiesCode.YES;
383   }
384 
385   static SatisfiesCode satisfiesNoUnsafe(boolean reverse, byte[] row, int offset,
386       int length, byte[] fuzzyKeyBytes, byte[] fuzzyKeyMeta) {
387     if (row == null) {
388       // do nothing, let scan to proceed
389       return SatisfiesCode.YES;
390     }
391 
392     Order order = Order.orderFor(reverse);
393     boolean nextRowKeyCandidateExists = false;
394 
395     for (int i = 0; i < fuzzyKeyMeta.length && i < length; i++) {
396       // First, checking if this position is fixed and not equals the given one
397       boolean byteAtPositionFixed = fuzzyKeyMeta[i] == 0;
398       boolean fixedByteIncorrect = byteAtPositionFixed && fuzzyKeyBytes[i] != row[i + offset];
399       if (fixedByteIncorrect) {
400         // in this case there's another row that satisfies fuzzy rule and bigger than this row
401         if (nextRowKeyCandidateExists) {
402           return SatisfiesCode.NEXT_EXISTS;
403         }
404 
405         // If this row byte is less than fixed then there's a byte array bigger than
406         // this row and which satisfies the fuzzy rule. Otherwise there's no such byte array:
407         // this row is simply bigger than any byte array that satisfies the fuzzy rule
408         boolean rowByteLessThanFixed = (row[i + offset] & 0xFF) < (fuzzyKeyBytes[i] & 0xFF);
409         if (rowByteLessThanFixed && !reverse) {
410           return SatisfiesCode.NEXT_EXISTS;
411         } else if (!rowByteLessThanFixed && reverse) {
412           return SatisfiesCode.NEXT_EXISTS;
413         } else {
414           return SatisfiesCode.NO_NEXT;
415         }
416       }
417 
418       // Second, checking if this position is not fixed and byte value is not the biggest. In this
419       // case there's a byte array bigger than this row and which satisfies the fuzzy rule. To get
420       // bigger byte array that satisfies the rule we need to just increase this byte
421       // (see the code of getNextForFuzzyRule below) by one.
422       // Note: if non-fixed byte is already at biggest value, this doesn't allow us to say there's
423       // bigger one that satisfies the rule as it can't be increased.
424       if (fuzzyKeyMeta[i] == 1 && !order.isMax(fuzzyKeyBytes[i])) {
425         nextRowKeyCandidateExists = true;
426       }
427     }
428     return SatisfiesCode.YES;
429   }
430 
431   @VisibleForTesting
432   static byte[] getNextForFuzzyRule(byte[] row, byte[] fuzzyKeyBytes, byte[] fuzzyKeyMeta) {
433     return getNextForFuzzyRule(false, row, 0, row.length, fuzzyKeyBytes, fuzzyKeyMeta);
434   }
435 
436   @VisibleForTesting
437   static byte[] getNextForFuzzyRule(boolean reverse, byte[] row, byte[] fuzzyKeyBytes,
438       byte[] fuzzyKeyMeta) {
439     return getNextForFuzzyRule(reverse, row, 0, row.length, fuzzyKeyBytes, fuzzyKeyMeta);
440   }
441 
442   /** Abstracts directional comparisons based on scan direction. */
443   private enum Order {
444     ASC {
445       public boolean lt(int lhs, int rhs) {
446         return lhs < rhs;
447       }
448 
449       public boolean gt(int lhs, int rhs) {
450         return lhs > rhs;
451       }
452 
453       public byte inc(byte val) {
454         // TODO: what about over/underflow?
455         return (byte) (val + 1);
456       }
457 
458       public boolean isMax(byte val) {
459         return val == (byte) 0xff;
460       }
461 
462       public byte min() {
463         return 0;
464       }
465     },
466     DESC {
467       public boolean lt(int lhs, int rhs) {
468         return lhs > rhs;
469       }
470 
471       public boolean gt(int lhs, int rhs) {
472         return lhs < rhs;
473       }
474 
475       public byte inc(byte val) {
476         // TODO: what about over/underflow?
477         return (byte) (val - 1);
478       }
479 
480       public boolean isMax(byte val) {
481         return val == 0;
482       }
483 
484       public byte min() {
485         return (byte) 0xFF;
486       }
487     };
488 
489     public static Order orderFor(boolean reverse) {
490       return reverse ? DESC : ASC;
491     }
492 
493     /** Returns true when {@code lhs < rhs}. */
494     public abstract boolean lt(int lhs, int rhs);
495 
496     /** Returns true when {@code lhs > rhs}. */
497     public abstract boolean gt(int lhs, int rhs);
498 
499     /** Returns {@code val} incremented by 1. */
500     public abstract byte inc(byte val);
501 
502     /** Return true when {@code val} is the maximum value */
503     public abstract boolean isMax(byte val);
504 
505     /** Return the minimum value according to this ordering scheme. */
506     public abstract byte min();
507   }
508 
509   /**
510    * @return greater byte array than given (row) which satisfies the fuzzy rule if it exists, null
511    *         otherwise
512    */
513   @VisibleForTesting
514   static byte[] getNextForFuzzyRule(boolean reverse, byte[] row, int offset, int length,
515       byte[] fuzzyKeyBytes, byte[] fuzzyKeyMeta) {
516     // To find out the next "smallest" byte array that satisfies fuzzy rule and "greater" than
517     // the given one we do the following:
518     // 1. setting values on all "fixed" positions to the values from fuzzyKeyBytes
519     // 2. if during the first step given row did not increase, then we increase the value at
520     // the first "non-fixed" position (where it is not maximum already)
521 
522     // It is easier to perform this by using fuzzyKeyBytes copy and setting "non-fixed" position
523     // values than otherwise.
524     byte[] result =
525         Arrays.copyOf(fuzzyKeyBytes, length > fuzzyKeyBytes.length ? length : fuzzyKeyBytes.length);
526     if (reverse && length > fuzzyKeyBytes.length) {
527       // we need trailing 0xff's instead of trailing 0x00's
528       for (int i = fuzzyKeyBytes.length; i < result.length; i++) {
529         result[i] = (byte) 0xFF;
530       }
531     }
532     int toInc = -1;
533     final Order order = Order.orderFor(reverse);
534 
535     boolean increased = false;
536     for (int i = 0; i < result.length; i++) {
537       if (i >= fuzzyKeyMeta.length || fuzzyKeyMeta[i] == 0 /* non-fixed */) {
538         result[i] = row[offset + i];
539         if (!order.isMax(row[offset + i])) {
540           // this is "non-fixed" position and is not at max value, hence we can increase it
541           toInc = i;
542         }
543       } else if (i < fuzzyKeyMeta.length && fuzzyKeyMeta[i] == -1 /* fixed */) {
544         if (order.lt((row[i + offset] & 0xFF), (fuzzyKeyBytes[i] & 0xFF))) {
545           // if setting value for any fixed position increased the original array,
546           // we are OK
547           increased = true;
548           break;
549         }
550 
551         if (order.gt((row[i + offset] & 0xFF), (fuzzyKeyBytes[i] & 0xFF))) {
552           // if setting value for any fixed position makes array "smaller", then just stop:
553           // in case we found some non-fixed position to increase we will do it, otherwise
554           // there's no "next" row key that satisfies fuzzy rule and "greater" than given row
555           break;
556         }
557       }
558     }
559 
560     if (!increased) {
561       if (toInc < 0) {
562         return null;
563       }
564       result[toInc] = order.inc(result[toInc]);
565 
566       // Setting all "non-fixed" positions to zeroes to the right of the one we increased so
567       // that found "next" row key is the smallest possible
568       for (int i = toInc + 1; i < result.length; i++) {
569         if (i >= fuzzyKeyMeta.length || fuzzyKeyMeta[i] == 0 /* non-fixed */) {
570           result[i] = order.min();
571         }
572       }
573     }
574 
575     return result;
576   }
577 
578   /**
579    * @return true if and only if the fields of the filter that are serialized are equal to the
580    *         corresponding fields in other. Used for testing.
581    */
582   boolean areSerializedFieldsEqual(Filter o) {
583     if (o == this) return true;
584     if (!(o instanceof FuzzyRowFilter)) return false;
585 
586     FuzzyRowFilter other = (FuzzyRowFilter) o;
587     if (this.fuzzyKeysData.size() != other.fuzzyKeysData.size()) return false;
588     for (int i = 0; i < fuzzyKeysData.size(); ++i) {
589       Pair<byte[], byte[]> thisData = this.fuzzyKeysData.get(i);
590       Pair<byte[], byte[]> otherData = other.fuzzyKeysData.get(i);
591       if (!(Bytes.equals(thisData.getFirst(), otherData.getFirst()) && Bytes.equals(
592         thisData.getSecond(), otherData.getSecond()))) {
593         return false;
594       }
595     }
596     return true;
597   }
598 }