Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,11 @@ ConcurrentMap<ImmutableByteArray, Long> getOrCreateLowestSequenceIds(byte[] enco
*/
private static long getLowestSequenceId(Map<?, Long> sequenceids) {
long lowest = HConstants.NO_SEQNUM;
for (Long sid: sequenceids.values()) {
for (Map.Entry<? , Long> entry : sequenceids.entrySet()){
if (entry.getKey().toString().equals("METAFAMILY")){
continue;
}
Long sid = entry.getValue();
if (lowest == HConstants.NO_SEQNUM || sid.longValue() < lowest) {
lowest = sid.longValue();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@ public class TestSequenceIdAccounting {

private static final byte [] ENCODED_REGION_NAME = Bytes.toBytes("r");
private static final byte [] FAMILY_NAME = Bytes.toBytes("cf");
private static final byte [] META_FAMILY = Bytes.toBytes("METAFAMILY");
private static final Set<byte[]> FAMILIES;
private static final Set<byte[]> META_FAMILY_SET;
static {
FAMILIES = new HashSet<>();
FAMILIES.add(FAMILY_NAME);
META_FAMILY_SET = new HashSet<>();
META_FAMILY_SET.add(META_FAMILY);
}

@Test
Expand Down Expand Up @@ -123,6 +127,20 @@ public void testAreAllLower() {
sida.update(ENCODED_REGION_NAME, FAMILIES, ++sequenceid, true);
sida.update(ENCODED_REGION_NAME, FAMILIES, ++sequenceid, true);
assertTrue(sida.areAllLower(m, null));
m.put(ENCODED_REGION_NAME, sequenceid);
assertFalse(sida.areAllLower(m, null));

// Test the METAFAMILY is filtered in SequenceIdAccounting.lowestUnflushedSequenceIds
SequenceIdAccounting meta_sida = new SequenceIdAccounting();
Map<byte[], Long> meta_m = new HashMap<>();
meta_sida.getOrCreateLowestSequenceIds(ENCODED_REGION_NAME);
meta_m.put(ENCODED_REGION_NAME, sequenceid);
meta_sida.update(ENCODED_REGION_NAME, META_FAMILY_SET, ++sequenceid, true);
meta_sida.update(ENCODED_REGION_NAME, META_FAMILY_SET, ++sequenceid, true);
meta_sida.update(ENCODED_REGION_NAME, META_FAMILY_SET, ++sequenceid, true);
assertTrue(meta_sida.areAllLower(meta_m, null));
meta_m.put(ENCODED_REGION_NAME, sequenceid);
assertTrue(meta_sida.areAllLower(meta_m, null));
}

@Test
Expand Down