From 532afaaf9137a8a991473117899dcd0220665f2e Mon Sep 17 00:00:00 2001 From: James Lee Date: Fri, 6 Feb 2015 14:48:47 +0900 Subject: [PATCH 1/3] Reformat codes --- checkstyle.xml | 134 +++++++++--------- pom.xml | 9 +- .../vcnc/haeinsa/ForwardingHaeinsaTable.java | 1 + .../co/vcnc/haeinsa/HaeinsaColumnTracker.java | 19 +-- .../kr/co/vcnc/haeinsa/HaeinsaConstants.java | 3 +- .../kr/co/vcnc/haeinsa/HaeinsaDelete.java | 20 +-- .../co/vcnc/haeinsa/HaeinsaDeleteTracker.java | 47 +++--- .../java/kr/co/vcnc/haeinsa/HaeinsaGet.java | 5 +- .../kr/co/vcnc/haeinsa/HaeinsaIntraScan.java | 9 +- .../kr/co/vcnc/haeinsa/HaeinsaKeyValue.java | 6 +- .../vcnc/haeinsa/HaeinsaKeyValueScanner.java | 3 - .../kr/co/vcnc/haeinsa/HaeinsaMutation.java | 12 +- .../kr/co/vcnc/haeinsa/HaeinsaOperation.java | 3 +- .../java/kr/co/vcnc/haeinsa/HaeinsaPut.java | 6 +- .../java/kr/co/vcnc/haeinsa/HaeinsaQuery.java | 4 +- .../kr/co/vcnc/haeinsa/HaeinsaResult.java | 2 +- .../co/vcnc/haeinsa/HaeinsaResultScanner.java | 3 +- .../vcnc/haeinsa/HaeinsaRowTransaction.java | 2 - .../java/kr/co/vcnc/haeinsa/HaeinsaScan.java | 8 +- .../java/kr/co/vcnc/haeinsa/HaeinsaTable.java | 134 +++++++----------- .../kr/co/vcnc/haeinsa/HaeinsaTableIface.java | 17 ++- .../haeinsa/HaeinsaTableIfaceFactory.java | 2 - .../haeinsa/HaeinsaTableIfaceInternal.java | 19 +-- .../kr/co/vcnc/haeinsa/HaeinsaTablePool.java | 24 ++-- .../vcnc/haeinsa/HaeinsaTableTransaction.java | 3 +- .../co/vcnc/haeinsa/HaeinsaTransaction.java | 71 ++++------ .../haeinsa/HaeinsaTransactionManager.java | 18 +-- .../haeinsa/exception/ConflictException.java | 1 - .../exception/DanglingRowLockException.java | 2 - .../exception/NotExpiredYetException.java | 4 +- .../RecoverableConflictException.java | 4 +- .../kr/co/vcnc/haeinsa/thrift/TRowLocks.java | 5 +- .../kr/co/vcnc/haeinsa/Haeinsa67BugTest.java | 4 +- .../kr/co/vcnc/haeinsa/HaeinsaUnitTest.java | 4 - 34 files changed, 249 insertions(+), 359 deletions(-) diff --git a/checkstyle.xml b/checkstyle.xml index b404f4b..d2d98cc 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -17,118 +17,118 @@ --> - - + "-//Puppy Crawl//DTD Check Configuration 1.3//EN" + "http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> + + - - - + + + - + - + - - + + - - + + - - + + - - + + - - + + - - - + + + - + - - + + - - - - - - - - - - + + + + + + + + + + - - + + - + - - - + + + - - + + - - - - - - + + + + + + - + - + - + - - - - - - + + + + + + + MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, SL, SL_ASSIGN, SR_ASSIGN, STAR, STAR_ASSIGN"/> - + - - - + + + - - - + + + - \ No newline at end of file + diff --git a/pom.xml b/pom.xml index bdd23cf..fd8ec45 100644 --- a/pom.xml +++ b/pom.xml @@ -15,7 +15,8 @@ limitations under the License. --> - + 4.0.0 org.sonatype.oss @@ -318,7 +319,7 @@ - + @@ -331,7 +332,7 @@ - + @@ -449,7 +450,7 @@ java8 - 1.8 + 1.8 diff --git a/src/main/java/kr/co/vcnc/haeinsa/ForwardingHaeinsaTable.java b/src/main/java/kr/co/vcnc/haeinsa/ForwardingHaeinsaTable.java index 27e0425..99ac534 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/ForwardingHaeinsaTable.java +++ b/src/main/java/kr/co/vcnc/haeinsa/ForwardingHaeinsaTable.java @@ -36,6 +36,7 @@ public class ForwardingHaeinsaTable extends ForwardingObject implements HaeinsaT /** * Constructor + * * @param haeinsaTable HaeinsaTable */ public ForwardingHaeinsaTable(HaeinsaTableIface haeinsaTable) { diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaColumnTracker.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaColumnTracker.java index d274ca1..13dd90f 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaColumnTracker.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaColumnTracker.java @@ -22,6 +22,7 @@ import org.apache.hadoop.hbase.util.Bytes; +import com.google.common.collect.Maps; import com.google.common.collect.Sets; /** @@ -32,8 +33,7 @@ */ public class HaeinsaColumnTracker { // { family -> qualifier } - private final Map> familyMap = - new TreeMap>(Bytes.BYTES_COMPARATOR); + private final Map> familyMap = Maps.newTreeMap(Bytes.BYTES_COMPARATOR); private final byte[] minColumn; private final boolean minColumnInclusive; @@ -46,17 +46,10 @@ public class HaeinsaColumnTracker { * If this ColumnTracker track {@link HaeinsaScan}, minColumn, maxColumn * should be null and minColumnInclusive, maxColumnInclusive should be * false. - * - * @param familyMap - * - * @param minColumn - * @param minColumnInclusive - * @param maxColumn - * @param maxColumnInclusive */ public HaeinsaColumnTracker(Map> familyMap, - byte[] minColumn, boolean minColumnInclusive, - byte[] maxColumn, boolean maxColumnInclusive) { + byte[] minColumn, boolean minColumnInclusive, + byte[] maxColumn, boolean maxColumnInclusive) { this.minColumn = minColumn; this.maxColumn = maxColumn; this.minColumnInclusive = minColumnInclusive; @@ -76,9 +69,6 @@ public HaeinsaColumnTracker(Map> familyMap, * Return true if qualifier of kv is placed between minColumn and maxColumn. *

* Using lexicographical ordering to compare byte[] - * - * @param kv - * @return */ public boolean isColumnInclusive(HaeinsaKeyValue kv) { int cmpMin = 1; @@ -121,7 +111,6 @@ public boolean isColumnInclusive(HaeinsaKeyValue kv) { * * * @param kv HaeinsaKeyValue which will be checked. - * @return */ public boolean isMatched(HaeinsaKeyValue kv) { // If familyMap is empty, then Haeinsa transaction assumes diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaConstants.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaConstants.java index fb1a32f..13808fa 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaConstants.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaConstants.java @@ -26,8 +26,7 @@ * Static Class of Constants for Haeinsa */ public final class HaeinsaConstants { - private HaeinsaConstants() { - } + private HaeinsaConstants() {} /** * Haeinsa protocol version of this release. diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDelete.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDelete.java index 499af6f..add7f15 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDelete.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDelete.java @@ -113,16 +113,16 @@ public TMutation toTMutation() { TRemove newTRemove = new TRemove(); for (HaeinsaKeyValue kv : Iterables.concat(familyMap.values())) { switch (kv.getType()) { - case DeleteColumn: { - newTRemove.addToRemoveCells(new TCellKey().setFamily(kv.getFamily()).setQualifier(kv.getQualifier())); - break; - } - case DeleteFamily: { - newTRemove.addToRemoveFamilies(ByteBuffer.wrap(kv.getFamily())); - break; - } - default: - break; + case DeleteColumn: { + newTRemove.addToRemoveCells(new TCellKey().setFamily(kv.getFamily()).setQualifier(kv.getQualifier())); + break; + } + case DeleteFamily: { + newTRemove.addToRemoveFamilies(ByteBuffer.wrap(kv.getFamily())); + break; + } + default: + break; } } newTMutation.setRemove(newTRemove); diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDeleteTracker.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDeleteTracker.java index 9fcd490..0805c6b 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDeleteTracker.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDeleteTracker.java @@ -39,38 +39,35 @@ public class HaeinsaDeleteTracker { */ public void add(HaeinsaKeyValue kv, long sequenceID) { switch (kv.getType()) { - case DeleteFamily: { - Long previous = families.get(kv.getFamily()); - if (previous == null || previous.compareTo(sequenceID) > 0) { - // sequenceId is lower than previous one. - families.put(kv.getFamily(), sequenceID); + case DeleteFamily: { + Long previous = families.get(kv.getFamily()); + if (previous == null || previous.compareTo(sequenceID) > 0) { + // sequenceId is lower than previous one. + families.put(kv.getFamily(), sequenceID); + } + break; } - break; - } - case DeleteColumn: { - NavigableMap cellMap = cells.get(kv.getFamily()); - if (cellMap == null) { - cellMap = Maps.newTreeMap(Bytes.BYTES_COMPARATOR); - cells.put(kv.getFamily(), cellMap); - } - Long previous = families.get(kv.getQualifier()); - if (previous == null || previous.compareTo(sequenceID) > 0) { - // sequenceId is lower than previous one. - cellMap.put(kv.getQualifier(), sequenceID); + case DeleteColumn: { + NavigableMap cellMap = cells.get(kv.getFamily()); + if (cellMap == null) { + cellMap = Maps.newTreeMap(Bytes.BYTES_COMPARATOR); + cells.put(kv.getFamily(), cellMap); + } + Long previous = families.get(kv.getQualifier()); + if (previous == null || previous.compareTo(sequenceID) > 0) { + // sequenceId is lower than previous one. + cellMap.put(kv.getQualifier(), sequenceID); + } + break; } - break; - } - default: - break; + default: + break; } } /** - * - * @param kv - * @param sequenceID * @return Return true if kv is deleted after sequenceID (lower sequenceID), - * return false otherwise. + * return false otherwise. */ public boolean isDeleted(HaeinsaKeyValue kv, long sequenceID) { // check family diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaGet.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaGet.java index 86b074f..9ffba12 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaGet.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaGet.java @@ -23,6 +23,8 @@ import org.apache.hadoop.hbase.client.Get; import org.apache.hadoop.hbase.util.Bytes; +import com.google.common.collect.Maps; + /** * HaeinsaGet can be analogous to {@link Get} class in HBase. *

@@ -30,8 +32,7 @@ */ public class HaeinsaGet extends HaeinsaQuery { private byte[] row; - private Map> familyMap = - new TreeMap>(Bytes.BYTES_COMPARATOR); + private Map> familyMap = Maps.newTreeMap(Bytes.BYTES_COMPARATOR); /** * Create a Get operation for the specified row. diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaIntraScan.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaIntraScan.java index 0c2645c..a2a7e81 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaIntraScan.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaIntraScan.java @@ -16,11 +16,12 @@ package kr.co.vcnc.haeinsa; import java.util.NavigableSet; -import java.util.TreeSet; import org.apache.hadoop.hbase.filter.ColumnRangeFilter; import org.apache.hadoop.hbase.util.Bytes; +import com.google.common.collect.Sets; + /** * Custom integration of {@link ColumnRangeFilter} in Haeinsa. In contrast to * {@link HaeinsaScan}, HaeinsaIntraScan can be used to retrieve range of column @@ -40,11 +41,11 @@ public class HaeinsaIntraScan extends HaeinsaQuery { private int batch = 32; // if this set is empty, then scan every family - private final NavigableSet families = new TreeSet(Bytes.BYTES_COMPARATOR); + private final NavigableSet families = Sets.newTreeSet(Bytes.BYTES_COMPARATOR); public HaeinsaIntraScan(final byte[] row, - final byte[] minColumn, boolean minColumnInclusive, - final byte[] maxColumn, boolean maxColumnInclusive) { + final byte[] minColumn, boolean minColumnInclusive, + final byte[] maxColumn, boolean maxColumnInclusive) { this.row = row; this.minColumn = minColumn; this.minColumnInclusive = minColumnInclusive; diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaKeyValue.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaKeyValue.java index 76f0d80..504d4af 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaKeyValue.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaKeyValue.java @@ -45,9 +45,9 @@ public class HaeinsaKeyValue { @Override public int compare(HaeinsaKeyValue o1, HaeinsaKeyValue o2) { return ComparisonChain.start() - .compare(o1.getRow(), o2.getRow(), new NullableComparator(Bytes.BYTES_COMPARATOR)) - .compare(o1.getFamily(), o2.getFamily(), new NullableComparator(Bytes.BYTES_COMPARATOR)) - .compare(o1.getQualifier(), o2.getQualifier(), new NullableComparator(Bytes.BYTES_COMPARATOR)) + .compare(o1.getRow(), o2.getRow(), new NullableComparator<>(Bytes.BYTES_COMPARATOR)) + .compare(o1.getFamily(), o2.getFamily(), new NullableComparator<>(Bytes.BYTES_COMPARATOR)) + .compare(o1.getQualifier(), o2.getQualifier(), new NullableComparator<>(Bytes.BYTES_COMPARATOR)) .compare(o2.getType().getCode() & 0xFF, o1.getType().getCode() & 0xFF) .result(); } diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaKeyValueScanner.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaKeyValueScanner.java index b4186e1..179ae19 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaKeyValueScanner.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaKeyValueScanner.java @@ -35,7 +35,6 @@ */ public interface HaeinsaKeyValueScanner { Comparator COMPARATOR = new Comparator() { - @Override public int compare(HaeinsaKeyValueScanner o1, HaeinsaKeyValueScanner o2) { return ComparisonChain.start() @@ -60,9 +59,7 @@ public int compare(HaeinsaKeyValueScanner o1, HaeinsaKeyValueScanner o2) { HaeinsaKeyValue next() throws IOException; /** - * * @return Return TRowLock if exist in HaeinsaKeyValue. Otherwise, return null - * @throws IOException */ TRowLock peekLock() throws IOException; diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaMutation.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaMutation.java index 43ad237..a43278d 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaMutation.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaMutation.java @@ -29,6 +29,7 @@ import org.apache.hadoop.hbase.util.Bytes; import com.google.common.collect.Iterables; +import com.google.common.collect.Maps; /** * HaeinsaMutation is abstract class equivalent to auto-generated thrift class {@link TMutation}. @@ -46,8 +47,7 @@ public abstract class HaeinsaMutation extends HaeinsaOperation { protected byte[] row; // { family -> HaeinsaKeyValue } - protected Map> familyMap = - new TreeMap>(Bytes.BYTES_COMPARATOR); + protected Map> familyMap = Maps.newTreeMap(Bytes.BYTES_COMPARATOR); /** * Method for retrieving the put's familyMap @@ -106,8 +106,7 @@ public int compareTo(final Row d) { * Return {@link #HaeinsaKeyValueScanner} interface for single row. * * @param sequenceID sequence id represent which Scanner is newer one. Lower - * id is newer one. - * @return + * id is newer one. */ public HaeinsaKeyValueScanner getScanner(final long sequenceID) { return new MutationScanner(sequenceID); @@ -136,7 +135,7 @@ private class MutationScanner implements HaeinsaKeyValueScanner { * of values. Otherwise, the way to generate iterator should be changed. * * @param sequenceID sequence id represent which Scanner is newer one. - * Lower id is newer one. + * Lower id is newer one. */ public MutationScanner(long sequenceID) { this.sequenceID = sequenceID; @@ -172,7 +171,6 @@ public TRowLock peekLock() throws IOException { } @Override - public void close() { - } + public void close() {} } } diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaOperation.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaOperation.java index 6897822..41547d3 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaOperation.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaOperation.java @@ -15,5 +15,4 @@ */ package kr.co.vcnc.haeinsa; -public abstract class HaeinsaOperation { -} +public abstract class HaeinsaOperation {} diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaPut.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaPut.java index 66044b6..4677a2f 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaPut.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaPut.java @@ -17,7 +17,6 @@ import java.util.Map; import java.util.NavigableSet; -import java.util.TreeMap; import kr.co.vcnc.haeinsa.thrift.generated.TCellKey; import kr.co.vcnc.haeinsa.thrift.generated.TKeyValue; @@ -32,6 +31,7 @@ import com.google.common.base.Preconditions; import com.google.common.collect.Iterables; +import com.google.common.collect.Maps; import com.google.common.collect.Sets; /** @@ -54,7 +54,7 @@ public HaeinsaPut(byte[] row) { */ public HaeinsaPut(HaeinsaPut putToCopy) { this(putToCopy.getRow()); - this.familyMap = new TreeMap>(Bytes.BYTES_COMPARATOR); + this.familyMap = Maps.newTreeMap(Bytes.BYTES_COMPARATOR); for (Map.Entry> entry : putToCopy.getFamilyMap().entrySet()) { this.familyMap.put(entry.getKey(), entry.getValue()); } @@ -98,7 +98,7 @@ private HaeinsaKeyValue createPutKeyValue(byte[] family, byte[] qualifier, byte[ * * @param family column family * @return a set of KeyValue objects, returns an empty set if one doesn't - * exist. + * exist. */ private NavigableSet getKeyValueSet(byte[] family) { NavigableSet set = familyMap.get(family); diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaQuery.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaQuery.java index dbaa112..76d3a65 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaQuery.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaQuery.java @@ -29,7 +29,7 @@ public abstract class HaeinsaQuery extends HaeinsaOperation { * cache is disabled for that family or entirely). * * @param cacheBlocks if false, default settings are overridden and blocks - * will not be cached + * will not be cached */ public void setCacheBlocks(boolean cacheBlocks) { this.cacheBlocks = cacheBlocks; @@ -39,7 +39,7 @@ public void setCacheBlocks(boolean cacheBlocks) { * Get whether blocks should be cached for this Scan. * * @return true if default setting of block caching should be used, false if - * blocks should not be cached + * blocks should not be cached */ public boolean getCacheBlocks() { return cacheBlocks; diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaResult.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaResult.java index 191df74..313956d 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaResult.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaResult.java @@ -59,7 +59,7 @@ public HaeinsaKeyValue apply(KeyValue kv) { * Construct HaeinsaResultImpl from sorted list of HaeinsaKeyValue * * @param sortedKVs - Assumed that {@link HaeinsaKeyValue}s in sortedKVs - * have same row with first element and sorted in ascending order. + * have same row with first element and sorted in ascending order. */ public HaeinsaResult(List sortedKVs) { this.sortedKVs = sortedKVs; diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaResultScanner.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaResultScanner.java index bad6676..2b56067 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaResultScanner.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaResultScanner.java @@ -31,7 +31,7 @@ public interface HaeinsaResultScanner extends Closeable, Iterable * Grab the next row's worth of values. The scanner will return a Result. * * @return Result object if there is another row, null if the scanner is - * exhausted. + * exhausted. * @throws IOException e */ HaeinsaResult next() throws IOException; @@ -48,5 +48,4 @@ public interface HaeinsaResultScanner extends Closeable, Iterable */ @Override void close(); - } diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaRowTransaction.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaRowTransaction.java index 7dab930..b6d3e46 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaRowTransaction.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaRowTransaction.java @@ -82,8 +82,6 @@ public HaeinsaTableTransaction getTableTransaction() { * Return list of {@link HaeinsaKeyValueScanner}s which wrap mutations - * (Put & Delete) contained inside instance. Also assign sequenceID to every * {@link HaeinsaMutation#MutationScanner}. - * - * @return */ public List getScanners() { List result = Lists.newArrayList(); diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaScan.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaScan.java index 8b0319c..1b90b25 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaScan.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaScan.java @@ -26,6 +26,8 @@ import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.util.Bytes; +import com.google.common.collect.Maps; + /** * HaeinsaScan is analogous to {@link Scan} class in HBase. HaeinsaScan can be * used to retrieve range of row with specific family or (family, qualifier) @@ -43,8 +45,7 @@ public class HaeinsaScan extends HaeinsaQuery { private int caching = -1; // { family -> qualifier } - private Map> familyMap = - new TreeMap>(Bytes.BYTES_COMPARATOR); + private Map> familyMap = Maps.newTreeMap(Bytes.BYTES_COMPARATOR); /** * Create a HaeinsaScan instance. @@ -52,8 +53,7 @@ public class HaeinsaScan extends HaeinsaQuery { * If row is not specified for HaeinsaScan, the Scanner will start from the * beginning of the table. */ - public HaeinsaScan() { - } + public HaeinsaScan() {} /** * Create a Scan operation starting at the specified row. diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTable.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTable.java index 8c69ab2..dacaf56 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTable.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTable.java @@ -99,10 +99,6 @@ public HTableDescriptor getTableDescriptor() throws IOException { * Get data from HBase without transaction. * {@link HaeinsaTransaction#commit()} to check or mutate lock column of the row scanned by this method. * This method can be used when read performance is important or strict consistency of the result is not matter. - * - * @param get - * @return - * @throws IOException */ private HaeinsaResult getWithoutTx(HaeinsaGet get) throws IOException { Get hGet = new Get(get.getRow()); @@ -272,8 +268,6 @@ public HaeinsaResultScanner getScanner(@Nullable HaeinsaTransaction tx, HaeinsaS * {@link HaeinsaTransaction#commit()} to check or mutate lock column of the row scanned by this method. * This method can be used when read performance is important or strict consistency of the result is not matter. * - * @param scan - * @return * @throws IOException IOException from HBase. */ private HaeinsaResultScanner getScannerWithoutTx(HaeinsaScan scan) throws IOException { @@ -313,7 +307,7 @@ public HaeinsaResultScanner getScanner(@Nullable HaeinsaTransaction tx, HaeinsaI } // scan from startRow ( inclusive ) to startRow + 0x00 ( exclusive ) - Scan hScan = new Scan(intraScan.getRow(), Bytes.add(intraScan.getRow(), new byte[] { 0x00 })); + Scan hScan = new Scan(intraScan.getRow(), Bytes.add(intraScan.getRow(), new byte[]{0x00})); hScan.setBatch(intraScan.getBatch()); hScan.setCacheBlocks(intraScan.getCacheBlocks()); @@ -348,12 +342,10 @@ public HaeinsaResultScanner getScanner(@Nullable HaeinsaTransaction tx, HaeinsaI * {@link HaeinsaTransaction#commit()} to check or mutate lock column of the row scanned by this method. * This method can be used when read performance is important or strict consistency of the result is not matter. * - * @param intraScan - * @return * @throws IOException IOException from HBase. */ private HaeinsaResultScanner getScannerWithoutTx(HaeinsaIntraScan intraScan) throws IOException { - Scan hScan = new Scan(intraScan.getRow(), Bytes.add(intraScan.getRow(), new byte[] { 0x00 })); + Scan hScan = new Scan(intraScan.getRow(), Bytes.add(intraScan.getRow(), new byte[]{0x00})); hScan.setBatch(intraScan.getBatch()); for (byte[] family : intraScan.getFamilies()) { @@ -393,16 +385,11 @@ public void put(HaeinsaTransaction tx, HaeinsaPut put) throws IOException { * By calling this method proper time, {@link RowTransaction} inside {@link HaeinsaTransaction} can have * {@link TRowLock} of the row when this method was called first time in the context of the transaction. * - * @param tx - * @param row - * @param tableState - * @param rowState - * @return * @throws IOException ConflictException, HBase IOException */ private HaeinsaRowTransaction checkOrRecoverLock(HaeinsaTransaction tx, - byte[] row, HaeinsaTableTransaction tableState, - @Nullable HaeinsaRowTransaction rowState) throws IOException { + byte[] row, HaeinsaTableTransaction tableState, + @Nullable HaeinsaRowTransaction rowState) throws IOException { if (rowState != null && rowState.getCurrent() != null) { // return rowState itself if rowState already exist and contains TRowLock return rowState; @@ -438,11 +425,10 @@ private HaeinsaRowTransaction checkOrRecoverLock(HaeinsaTransaction tx, * Return false if rowLock is in {@link TRowLockState#STABLE} state. * Throw {@link ConflictException} if rowLock is not in stable state and not expired yet. * - * @param rowLock * @return true - when lock is established but expired. / false - when there - * is no lock ( {@link TRowLockState#STABLE} ) + * is no lock ( {@link TRowLockState#STABLE} ) * @throws IOException {@link NotExpiredYetException} if lock is established and - * not expired. + * not expired. */ private boolean checkAndIsShouldRecover(TRowLock rowLock) throws IOException { if (rowLock.getState() != TRowLockState.STABLE) { @@ -459,8 +445,6 @@ private boolean checkAndIsShouldRecover(TRowLock rowLock) throws IOException { * Abort or recover when there is failed transaction on the row, * throw {@link ConflictException} when there is ongoing transaction. * - * @param tx - * @param row * @throws IOException ConflictException, HBase IOException */ private void recover(HaeinsaTransaction tx, byte[] row) throws IOException { @@ -541,11 +525,9 @@ public void commitSingleRowPutOnly(HaeinsaRowTransaction rowState, byte[] row) t * If TRowLock is changed, it means transaction is failed, so throw * {@link ConflictException}. * - * @param prevRowLock - * @param row * @throws IOException ConflictException, HBase IOException. * @throws NullPointException if oldLock is null (haven't read lock from - * HBase) + * HBase) */ @Override public void checkSingleRowLock(HaeinsaRowTransaction rowState, byte[] row) throws IOException { @@ -643,45 +625,45 @@ public void applyMutations(HaeinsaRowTransaction rowTxState, byte[] row) throws TMutation mutation = remaining.get(i); switch (mutation.getType()) { - case PUT: { - TRowLock newRowLock = rowTxState.getCurrent().deepCopy(); - newRowLock.setCurrentTimestamp(mutationTimestamp); - newRowLock.setMutations(remaining.subList(mutationOffset, remaining.size())); - // Maintain prewritten state and extend lock by ROW_LOCK_TIMEOUT - newRowLock.setExpiry(tx.getExpiry()); - Put put = new Put(row); - put.add(LOCK_FAMILY, LOCK_QUALIFIER, newRowLock.getCurrentTimestamp(), TRowLocks.serialize(newRowLock)); - for (TKeyValue kv : mutation.getPut().getValues()) { - put.add(kv.getKey().getFamily(), kv.getKey().getQualifier(), newRowLock.getCurrentTimestamp(), kv.getValue()); - } - if (!table.checkAndPut(row, LOCK_FAMILY, LOCK_QUALIFIER, currentRowLockBytes, put)) { - // Consider as conflict because another transaction might acquire lock of this row. - throw new ConflictException("can't acquire row's lock"); - } else { - rowTxState.setCurrent(newRowLock); - } - break; - } - case REMOVE: { - Delete delete = new Delete(row); - if (mutation.getRemove().getRemoveFamiliesSize() > 0) { - for (ByteBuffer removeFamily : mutation.getRemove().getRemoveFamilies()) { - delete.deleteFamily(removeFamily.array(), mutationTimestamp); + case PUT: { + TRowLock newRowLock = rowTxState.getCurrent().deepCopy(); + newRowLock.setCurrentTimestamp(mutationTimestamp); + newRowLock.setMutations(remaining.subList(mutationOffset, remaining.size())); + // Maintain prewritten state and extend lock by ROW_LOCK_TIMEOUT + newRowLock.setExpiry(tx.getExpiry()); + Put put = new Put(row); + put.add(LOCK_FAMILY, LOCK_QUALIFIER, newRowLock.getCurrentTimestamp(), TRowLocks.serialize(newRowLock)); + for (TKeyValue kv : mutation.getPut().getValues()) { + put.add(kv.getKey().getFamily(), kv.getKey().getQualifier(), newRowLock.getCurrentTimestamp(), kv.getValue()); } - } - if (mutation.getRemove().getRemoveCellsSize() > 0) { - for (TCellKey removeCell : mutation.getRemove().getRemoveCells()) { - delete.deleteColumns(removeCell.getFamily(), removeCell.getQualifier(), mutationTimestamp); + if (!table.checkAndPut(row, LOCK_FAMILY, LOCK_QUALIFIER, currentRowLockBytes, put)) { + // Consider as conflict because another transaction might acquire lock of this row. + throw new ConflictException("can't acquire row's lock"); + } else { + rowTxState.setCurrent(newRowLock); } + break; } - if (!table.checkAndDelete(row, LOCK_FAMILY, LOCK_QUALIFIER, currentRowLockBytes, delete)) { - // Consider as conflict because another transaction might acquire lock of this row. - throw new ConflictException("can't acquire row's lock"); + case REMOVE: { + Delete delete = new Delete(row); + if (mutation.getRemove().getRemoveFamiliesSize() > 0) { + for (ByteBuffer removeFamily : mutation.getRemove().getRemoveFamilies()) { + delete.deleteFamily(removeFamily.array(), mutationTimestamp); + } + } + if (mutation.getRemove().getRemoveCellsSize() > 0) { + for (TCellKey removeCell : mutation.getRemove().getRemoveCells()) { + delete.deleteColumns(removeCell.getFamily(), removeCell.getQualifier(), mutationTimestamp); + } + } + if (!table.checkAndDelete(row, LOCK_FAMILY, LOCK_QUALIFIER, currentRowLockBytes, delete)) { + // Consider as conflict because another transaction might acquire lock of this row. + throw new ConflictException("can't acquire row's lock"); + } + break; } - break; - } - default: - break; + default: + break; } } } @@ -879,29 +861,21 @@ private class ClientScanner implements HaeinsaResultScanner { private long maxSeqID = Long.MAX_VALUE; /** - * - * @param tx - * @param scanners - * @param familyMap * @param lockInclusive - whether scanners contains {@link TRowLock} inside. - * If not, should bring from {@link RowTransaction} or get from HBase directly. + * If not, should bring from {@link RowTransaction} or get from HBase directly. */ public ClientScanner(HaeinsaTransaction tx, Iterable scanners, - Map> familyMap, boolean lockInclusive) { + Map> familyMap, boolean lockInclusive) { this(tx, scanners, familyMap, null, lockInclusive); } /** - * - * @param tx - * @param scanners - * @param familyMap * @param intraScan - To support to use {@link ColumnRangeFilter} * @param lockInclusive - whether scanners contains {@link TRowLock} inside. - * If not, should bring from {@link RowTransaction} or get from HBase directly. + * If not, should bring from {@link RowTransaction} or get from HBase directly. */ public ClientScanner(HaeinsaTransaction tx, Iterable scanners, - Map> familyMap, HaeinsaIntraScan intraScan, boolean lockInclusive) { + Map> familyMap, HaeinsaIntraScan intraScan, boolean lockInclusive) { this.tx = tx; this.tableState = tx.createOrGetTableState(getTableName()); for (HaeinsaKeyValueScanner kvScanner : scanners) { @@ -927,8 +901,6 @@ public ClientScanner(HaeinsaTransaction tx, Iterable sca * the way {@link #nextScanner()} implemented is removing {@link HaeinsaKeyValueScanner} one by one form scanners. * {@link #close()} method needs to close every {@link ClientScanner} when called, * so some other variable should preserve every scanner when ClientScanner created. - * - * @throws IOException */ private void initialize() throws IOException { try { @@ -998,10 +970,8 @@ public boolean hasNext() { * So proper operation is guaranteed only when every scanner in {@link #scanners} return * smaller or equal row key when {@link HaeinsaKeyValueScanner#peek()} is called. * - * @param row * @return null if there is no TRowLock information inside scanners, - * return rowLock otherwise. - * @throws IOException + * return rowLock otherwise. */ private TRowLock peekLock(byte[] row) throws IOException { for (HaeinsaKeyValueScanner scanner : scanners) { @@ -1101,8 +1071,8 @@ public HaeinsaResult next() throws IOException { deleteTracker.add(currentKV, currentScanner.getSequenceID()); } else if (prevKV == currentKV || !(Bytes.equals(prevKV.getRow(), currentKV.getRow()) - && Bytes.equals(prevKV.getFamily(), currentKV.getFamily()) - && Bytes.equals(prevKV.getQualifier(), currentKV.getQualifier()))) { + && Bytes.equals(prevKV.getFamily(), currentKV.getFamily()) + && Bytes.equals(prevKV.getQualifier(), currentKV.getQualifier()))) { // if reference of prevKV and currentKV is same, the currentKV have new row. // Ignore when prevKV and currentKV is different but row, family, // qualifier of currentKv and prevKv is all same. (not likely) @@ -1143,9 +1113,6 @@ public HaeinsaResult next() throws IOException { * Moving index of scanner of currentScanner by one. If there is no more * element at the scanner, remove currentScanner from scanners * (NavigableSet) - * - * @param currentScanner - * @throws IOException */ private void nextScanner(HaeinsaKeyValueScanner currentScanner) throws IOException { scanners.remove(currentScanner); @@ -1366,7 +1333,6 @@ public long getSequenceID() { } @Override - public void close() { - } + public void close() {} } } diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIface.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIface.java index 81071d3..5f327c5 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIface.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIface.java @@ -61,12 +61,12 @@ public interface HaeinsaTableIface extends Closeable { * Extracts certain cells from a given row. * * @param tx HaeinsaTransaction which this operation is participated in. - * It can be null if user don't want to execute get inside transaction. + * It can be null if user don't want to execute get inside transaction. * @param get The object that specifies what data to fetch and from which row. * @return The data coming from the specified row, if it exists. If the row - * specified doesn't exist, the {@link HaeinsaResult} instance returned - * won't contain any {@link HaeinsaKeyValue}, as indicated by - * {@link HaeinsaResult#isEmpty()}. + * specified doesn't exist, the {@link HaeinsaResult} instance returned + * won't contain any {@link HaeinsaKeyValue}, as indicated by + * {@link HaeinsaResult#isEmpty()}. * @throws IOException if a remote or network exception occurs. */ HaeinsaResult get(@Nullable HaeinsaTransaction tx, HaeinsaGet get) throws IOException; @@ -76,7 +76,7 @@ public interface HaeinsaTableIface extends Closeable { * Similar with {@link HaeinsaTableIface#getScanner(HaeinsaTransaction, HaeinsaScan)}. * * @param tx HaeinsaTransaction which this operation is participated in. - * It can be null if user don't want to execute scan inside transaction. + * It can be null if user don't want to execute scan inside transaction. * @param family The column family to scan. * @return A scanner. * @throws IOException if a remote or network exception occurs. @@ -88,7 +88,7 @@ public interface HaeinsaTableIface extends Closeable { * Similar with {@link HaeinsaTableIface#getScanner(HaeinsaTransaction, HaeinsaScan)}. * * @param tx HaeinsaTransaction which this operation is participated in. - * It can be null if user don't want to execute scan inside transaction. + * It can be null if user don't want to execute scan inside transaction. * @param family The column family to scan. * @param qualifier The column qualifier to scan. * @return A scanner. @@ -102,7 +102,7 @@ HaeinsaResultScanner getScanner(@Nullable HaeinsaTransaction tx, byte[] family, * object. * * @param tx HaeinsaTransaction which this operation is participated in. - It can be null if user don't want to execute scan inside transaction. + * It can be null if user don't want to execute scan inside transaction. * @param scan A configured {@link HaeinsaScan} object. * @return A scanner. * @throws IOException if a remote or network exception occurs. @@ -114,7 +114,7 @@ HaeinsaResultScanner getScanner(@Nullable HaeinsaTransaction tx, byte[] family, * object. * * @param tx HaeinsaTransaction which this operation is participated in. - * It can be null if user don't want to execute scan inside transaction. + * It can be null if user don't want to execute scan inside transaction. * @param intraScan A configured {@link HaeinsaIntraScan} object. * @return A scanner. * @throws IOException if a remote or network exception occurs. @@ -168,5 +168,4 @@ HaeinsaResultScanner getScanner(@Nullable HaeinsaTransaction tx, byte[] family, */ @Override void close() throws IOException; - } diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIfaceFactory.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIfaceFactory.java index b57a071..8936e4b 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIfaceFactory.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIfaceFactory.java @@ -35,8 +35,6 @@ public interface HaeinsaTableIfaceFactory { /** * Release the HaeinsaTable resource represented by the table. - * @param table */ void releaseHaeinsaTableIface(final HaeinsaTableIface table) throws IOException; - } diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIfaceInternal.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIfaceInternal.java index 7330498..89a86c1 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIfaceInternal.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIfaceInternal.java @@ -40,8 +40,6 @@ interface HaeinsaTableIfaceInternal extends HaeinsaTableIface { * If TRowLock is changed and checkAndPut failed, it means transaction is * failed so throw {@link ConflictException}. * - * @param rowState - * @param row * @throws IOException ConflictException, HBase IOException. */ void commitSingleRowPutOnly(HaeinsaRowTransaction rowState, byte[] row) throws IOException; @@ -51,11 +49,9 @@ interface HaeinsaTableIfaceInternal extends HaeinsaTableIface { * If TRowLock is changed, it means transaction is failed, so throw * {@link ConflictException}. * - * @param prevRowLock - * @param row * @throws IOException ConflictException, HBase IOException. * @throws NullPointException if oldLock is null (haven't read lock from - * HBase) + * HBase) */ void checkSingleRowLock(HaeinsaRowTransaction rowState, byte[] row) throws IOException; @@ -72,9 +68,6 @@ interface HaeinsaTableIfaceInternal extends HaeinsaTableIface { *

* Add list of secondary rows in secondaries field if this row is primary row, add key of primary row in primary field otherwise. * - * @param rowState - * @param row - * @param isPrimary * @throws IOException ConflictException, HBase IOException */ void prewrite(HaeinsaRowTransaction rowState, byte[] row, boolean isPrimary) throws IOException; @@ -93,8 +86,6 @@ interface HaeinsaTableIfaceInternal extends HaeinsaTableIface { * However this is not an issue for transaction consistency because new client will execute idempotent remove operations one more time * on same timestamp which are already used during previous transaction attempt. * - * @param rowTxState - * @param row * @throws IOException ConflictException, HBase IOException. */ void applyMutations(HaeinsaRowTransaction rowTxState, byte[] row) throws IOException; @@ -104,8 +95,6 @@ interface HaeinsaTableIfaceInternal extends HaeinsaTableIface { * Use commitTimestamp field of {@link TRowLock} as timestamp on HBase. * Only {@link TRowLock#version}, {@link TRowLock#state} and {@link TRowLock#commitTimestamp} fields are written. * - * @param tx - * @param row * @throws IOException ConflictException, HBase IOException. */ void makeStable(HaeinsaRowTransaction rowTxState, byte[] row) throws IOException; @@ -118,8 +107,6 @@ interface HaeinsaTableIfaceInternal extends HaeinsaTableIface { * failed-over client will call this method again to extend lock expiry on primary row. * In this case, {@link TRowLock} is remained in {@link TRowLockState#COMMITTED}. * - * @param tx - * @param row * @throws IOException ConflictException, HBase IOException. */ void commitPrimary(HaeinsaRowTransaction rowTxState, byte[] row) throws IOException; @@ -141,8 +128,6 @@ interface HaeinsaTableIfaceInternal extends HaeinsaTableIface { * or {@link TRowLockState#ABORTED} to another {@link TRowLockState#ABORTED}. * Later is when different client failed again during cleaning up aborted transaction. * - * @param tx - * @param row * @throws IOException ConflictException, HBase IOException. */ void abortPrimary(HaeinsaRowTransaction rowTxState, byte[] row) throws IOException; @@ -156,8 +141,6 @@ interface HaeinsaTableIfaceInternal extends HaeinsaTableIface { * Because Haeinsa uses {@link HTableInterface#checkAndDelete()} to delete prewrittens, * {@link TRowLock} is not changed. It will throw {@link ConflictException} if failed to acquire lock in checkAndDelete. * - * @param rowTxState - * @param row * @throws IOException ConflictException, HBase IOException. */ void deletePrewritten(HaeinsaRowTransaction rowTxState, byte[] row) throws IOException; diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTablePool.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTablePool.java index 64d7d11..371c828 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTablePool.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTablePool.java @@ -79,7 +79,7 @@ public HaeinsaTablePool(final Configuration config, final int maxSize, final Hae * @param config configuration * @param maxSize maximum number of references to keep for each table * @param poolType pool type which is one of {@link PoolType#Reusable} or - * {@link PoolType#ThreadLocal} + * {@link PoolType#ThreadLocal} */ public HaeinsaTablePool(final Configuration config, final int maxSize, final PoolType poolType) { this(config, maxSize, null, poolType); @@ -96,10 +96,10 @@ public HaeinsaTablePool(final Configuration config, final int maxSize, final Poo * @param maxSize maximum number of references to keep for each table * @param tableFactory table factory * @param poolType pool type which is one of {@link PoolType#Reusable} or - * {@link PoolType#ThreadLocal} + * {@link PoolType#ThreadLocal} */ public HaeinsaTablePool(final Configuration config, final int maxSize, - final HaeinsaTableIfaceFactory tableFactory, PoolType poolType) { + final HaeinsaTableIfaceFactory tableFactory, PoolType poolType) { // Make a new configuration instance so I can safely cleanup when // done with the pool. this.config = config == null ? new Configuration() : config; @@ -109,13 +109,13 @@ public HaeinsaTablePool(final Configuration config, final int maxSize, this.poolType = PoolType.Reusable; } else { switch (poolType) { - case Reusable: - case ThreadLocal: - this.poolType = poolType; - break; - default: - this.poolType = PoolType.Reusable; - break; + case Reusable: + case ThreadLocal: + this.poolType = poolType; + break; + default: + this.poolType = PoolType.Reusable; + break; } } this.tables = new PoolMap(this.poolType, this.maxSize); @@ -237,8 +237,6 @@ private void release(HaeinsaTableIface table) throws IOException { * Note: this is a 'shutdown' of the given table pool and different from * {@link #putTable(HaeinsaTableIface)}, that is used to return the table * instance to the pool for future re-use. - * - * @param tableName */ public void closeTablePool(final String tableName) throws IOException { Collection tables = this.tables.values(tableName); @@ -252,8 +250,6 @@ public void closeTablePool(final String tableName) throws IOException { /** * See {@link #closeTablePool(String)}. - * - * @param tableName */ public void closeTablePool(final byte[] tableName) throws IOException { closeTablePool(Bytes.toString(tableName)); diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableTransaction.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableTransaction.java index e1f08ea..2166387 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableTransaction.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableTransaction.java @@ -60,9 +60,8 @@ public HaeinsaTransaction getTransaction() { * - Use {@link TRowLocks#serialize(null)} method to set default {@link TRowLock} to current field of rowTransaction. * * - * @param row * @return RowTransaction - {@link HaeinsaRowTransaction} which contained in - * this instance. + * this instance. */ public HaeinsaRowTransaction createOrGetRowState(byte[] row) { HaeinsaRowTransaction rowState = rowStates.get(row); diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTransaction.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTransaction.java index ec4bfd9..177eea4 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTransaction.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTransaction.java @@ -168,7 +168,6 @@ HaeinsaTransactionLocals getLocals() { * If there is no {@link HaeinsaTableTransaction} have this name, * then create one instance for it and save inside {@link #tableStates} and return. * - * @param tableName * @return instance of {@link HaeinsaTableTransaction} */ protected HaeinsaTableTransaction createOrGetTableState(byte[] tableName) { @@ -251,23 +250,23 @@ public void commit() throws IOException { CommitMethod method = txStates.determineCommitMethod(); switch (method) { - case READ_ONLY: { - commitReadOnly(); - break; - } - case SINGLE_ROW_PUT_ONLY: { - commitSingleRowPutOnly(); - break; - } - case MULTI_ROW_MUTATIONS: { - commitMultiRowsMutation(); - break; - } - case NOTHING: { - break; - } - default: - break; + case READ_ONLY: { + commitReadOnly(); + break; + } + case SINGLE_ROW_PUT_ONLY: { + commitSingleRowPutOnly(); + break; + } + case MULTI_ROW_MUTATIONS: { + commitMultiRowsMutation(); + break; + } + case NOTHING: { + break; + } + default: + break; } } @@ -309,8 +308,6 @@ private void commitReadOnly() throws IOException { /** * Commit single row & PUT only (possibly include get/scan, but not Delete) * Transaction. - * - * @throws IOException */ private void commitSingleRowPutOnly() throws IOException { HaeinsaTableTransaction primaryTableState = createOrGetTableState(primary.getTableName()); @@ -424,7 +421,6 @@ private void makeStable() throws IOException { * or abort by calling {@link #abort()} otherwise. * * @param ignoreExpiry ignore row lock's expiry - * @throws IOException */ protected void recover(boolean ignoreExpiry) throws IOException { boolean onRecovery = true; @@ -443,18 +439,18 @@ protected void recover(boolean ignoreExpiry) throws IOException { extendExpiry(); switch (primaryRowTx.getCurrent().getState()) { - case ABORTED: - case PREWRITTEN: { - abort(); - break; - } - case COMMITTED: { - // Transaction is already succeeded. - makeStable(); - break; - } - default: - throw new ConflictException(); + case ABORTED: + case PREWRITTEN: { + abort(); + break; + } + case COMMITTED: { + // Transaction is already succeeded. + makeStable(); + break; + } + default: + throw new ConflictException(); } } @@ -515,6 +511,7 @@ protected void abort() throws IOException { /** * for unit test code + * * @param onRecovery onRecovery */ void classifyAndSortRows(boolean onRecovery) { @@ -546,7 +543,7 @@ public NavigableMap getTableStates() { * This method returns false only if there is no changes on data in the transaction. * * @return true if one or more row state has mutation, - * false if any row does not contains mutation. + * false if any row does not contains mutation. */ public boolean hasChanges() { for (HaeinsaTableTransaction tableState : tableStates.values()) { @@ -566,8 +563,6 @@ public boolean hasChanges() { *

* Transaction of single row with at least one of {@link HaeinsaDelete} * will be considered as {@link CommitMethod#MULTI_ROW_MUTATIONS}. - * - * @return */ public CommitMethod determineCommitMethod() { int count = 0; @@ -606,8 +601,6 @@ public CommitMethod determineCommitMethod() { /** * Return mutation rows which is hash-sorted by TRowKey(table, row). - * - * @return */ public NavigableMap getMutationRowStates() { Preconditions.checkNotNull(mutationRowStates, "Should call classifyAndSortRows first."); @@ -616,8 +609,6 @@ public NavigableMap getMutationRowStates() { /** * Return read-only rows which is hash-sorted by TRowKey(table, row). - * - * @return */ public NavigableMap getReadOnlyRowStates() { Preconditions.checkNotNull(readOnlyRowStates, "Should call classifyAndSortRows first."); diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTransactionManager.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTransactionManager.java index dbfbafe..2fdf499 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTransactionManager.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTransactionManager.java @@ -70,8 +70,7 @@ public HaeinsaTransaction begin() { * @param tableName TableName of Transaction to recover. * @param row Row of Transaction to recover. * @return Transaction instance if there is any ongoing Transaction on row, - * return null otherwise. - * @throws IOException + * return null otherwise. */ @Nullable protected HaeinsaTransaction getTransaction(byte[] tableName, byte[] row) throws IOException { @@ -108,7 +107,7 @@ protected HaeinsaTransaction getTransaction(byte[] tableName, byte[] row) throws * @param tableName Table name of the row * @param row Row key of the row * @return null if TRowLock is {@link TRowLockState#STABLE}, otherwise - * return rowLock from HBase. + * return rowLock from HBase. * @throws IOException When error occurs in HBase. */ private TRowLock getUnstableRowLock(byte[] tableName, byte[] row) throws IOException { @@ -146,7 +145,7 @@ private TRowLock getRowLock(byte[] tableName, byte[] row) throws IOException { * @param row Row of Transaction to check dangling RowLock. * @param rowLock RowLock to check if it is dangling * @throws IOException When error occurs. Especially throw - * {@link DanglingRowLockException}if given RowLock is dangling. + * {@link DanglingRowLockException}if given RowLock is dangling. */ private void checkDanglingRowLockOrThrow(byte[] tableName, byte[] row, TRowLock rowLock) throws IOException { TRowLock previousRowLock = rowLock; @@ -170,11 +169,6 @@ private void checkDanglingRowLockOrThrow(byte[] tableName, byte[] row, TRowLock * Recover TRowLocks of failed HaeinsaTransaction from primary row on HBase. * Transaction information about secondary rows are recovered with {@link #addSecondaryRowLock()}. * HaeinsaTransaction made by this method do not assign proper values on mutations variable. - * - * @param rowKey - * @param primaryRowLock - * @return - * @throws IOException */ private HaeinsaTransaction getTransactionFromPrimary(TRowKey rowKey, TRowLock primaryRowLock) throws IOException { HaeinsaTransaction transaction = new HaeinsaTransaction(this); @@ -202,13 +196,9 @@ private HaeinsaTransaction getTransactionFromPrimary(TRowKey rowKey, TRowLock pr *

* As similar to {@link #getTransactionFromPrimary()}, rowTransaction added by this method do not have * proper mutations variable. - * - * @param transaction - * @param rowKey - * @throws IOException */ private void addSecondaryRowLock(HaeinsaTransaction transaction, TRowKey primaryRowKey, - TRowLock primaryRowLock, TRowKey secondaryRowKey) throws IOException { + TRowLock primaryRowLock, TRowKey secondaryRowKey) throws IOException { TRowLock secondaryRowLock = getRowLock(secondaryRowKey.getTableName(), secondaryRowKey.getRow()); if (secondaryRowLock.getCommitTimestamp() > transaction.getCommitTimestamp()) { // this row isn't a part of this transaction or already aborted. diff --git a/src/main/java/kr/co/vcnc/haeinsa/exception/ConflictException.java b/src/main/java/kr/co/vcnc/haeinsa/exception/ConflictException.java index 7164451..2ece88e 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/exception/ConflictException.java +++ b/src/main/java/kr/co/vcnc/haeinsa/exception/ConflictException.java @@ -23,7 +23,6 @@ * explicitly distinguish between failure on HBase IO and conflict. */ public class ConflictException extends IOException { - private static final long serialVersionUID = -6181950952954013762L; public ConflictException() { diff --git a/src/main/java/kr/co/vcnc/haeinsa/exception/DanglingRowLockException.java b/src/main/java/kr/co/vcnc/haeinsa/exception/DanglingRowLockException.java index d2ef570..0d7f736 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/exception/DanglingRowLockException.java +++ b/src/main/java/kr/co/vcnc/haeinsa/exception/DanglingRowLockException.java @@ -27,7 +27,6 @@ * exception if there is fatal consistency error in Haeinsa. */ public class DanglingRowLockException extends ConflictException { - private static final long serialVersionUID = -9220580990865263679L; private final TRowKey danglingRowKey; @@ -51,5 +50,4 @@ public DanglingRowLockException(TRowKey danglingRowKey, String message) { public TRowKey getDanglingRowKey() { return danglingRowKey; } - } diff --git a/src/main/java/kr/co/vcnc/haeinsa/exception/NotExpiredYetException.java b/src/main/java/kr/co/vcnc/haeinsa/exception/NotExpiredYetException.java index 34ce270..53aeedf 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/exception/NotExpiredYetException.java +++ b/src/main/java/kr/co/vcnc/haeinsa/exception/NotExpiredYetException.java @@ -20,11 +20,9 @@ * This exception extends {@link ConflictException} */ public class NotExpiredYetException extends ConflictException { - private static final long serialVersionUID = -5160271558362505568L; - public NotExpiredYetException() { - } + public NotExpiredYetException() {} public NotExpiredYetException(String message) { super(message); diff --git a/src/main/java/kr/co/vcnc/haeinsa/exception/RecoverableConflictException.java b/src/main/java/kr/co/vcnc/haeinsa/exception/RecoverableConflictException.java index c77fd08..e516724 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/exception/RecoverableConflictException.java +++ b/src/main/java/kr/co/vcnc/haeinsa/exception/RecoverableConflictException.java @@ -22,11 +22,9 @@ * because this occurs on failure of write by other transaction. */ public class RecoverableConflictException extends ConflictException { - private static final long serialVersionUID = 3720142235607540830L; - public RecoverableConflictException() { - } + public RecoverableConflictException() {} public RecoverableConflictException(String message) { super(message); diff --git a/src/main/java/kr/co/vcnc/haeinsa/thrift/TRowLocks.java b/src/main/java/kr/co/vcnc/haeinsa/thrift/TRowLocks.java index 507d94d..9f8816a 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/thrift/TRowLocks.java +++ b/src/main/java/kr/co/vcnc/haeinsa/thrift/TRowLocks.java @@ -37,6 +37,8 @@ * TRowLock(commitTimestamp = Long.MIN_VALUE) <=> byte[] null */ public final class TRowLocks { + private TRowLocks() {} + private static final TProtocolFactory PROTOCOL_FACTORY = new TCompactProtocol.Factory(); private static TSerializer createSerializer() { @@ -47,9 +49,6 @@ private static TDeserializer createDeserializer() { return new TDeserializer(PROTOCOL_FACTORY); } - private TRowLocks() { - } - public static TRowLock deserialize(byte[] rowLockBytes) throws IOException { if (rowLockBytes == null) { return new TRowLock(ROW_LOCK_VERSION, TRowLockState.STABLE, Long.MIN_VALUE); diff --git a/src/test/java/kr/co/vcnc/haeinsa/Haeinsa67BugTest.java b/src/test/java/kr/co/vcnc/haeinsa/Haeinsa67BugTest.java index 93fe37d..32ff3b4 100644 --- a/src/test/java/kr/co/vcnc/haeinsa/Haeinsa67BugTest.java +++ b/src/test/java/kr/co/vcnc/haeinsa/Haeinsa67BugTest.java @@ -46,8 +46,8 @@ public void testRecover() throws Exception { TRowKey secondaryRowKey = new TRowKey().setTableName(testTable.getTableName()).setRow(Bytes.toBytes("Brad")); TRowLock secondaryRowLock = new TRowLock(HaeinsaConstants.ROW_LOCK_VERSION, TRowLockState.STABLE, 1380504156137L); TRowLock primaryRowLock = new TRowLock(HaeinsaConstants.ROW_LOCK_VERSION, TRowLockState.PREWRITTEN, 1380504157100L) - .setCurrentTimestamp(1380504156000L) - .setExpiry(1380504160000L); + .setCurrentTimestamp(1380504156000L) + .setExpiry(1380504160000L); primaryRowLock.addToSecondaries(secondaryRowKey); Put primaryPut = new Put(primaryRowKey.getRow()); primaryPut.add(HaeinsaConstants.LOCK_FAMILY, HaeinsaConstants.LOCK_QUALIFIER, diff --git a/src/test/java/kr/co/vcnc/haeinsa/HaeinsaUnitTest.java b/src/test/java/kr/co/vcnc/haeinsa/HaeinsaUnitTest.java index 9a8976f..ab1561d 100644 --- a/src/test/java/kr/co/vcnc/haeinsa/HaeinsaUnitTest.java +++ b/src/test/java/kr/co/vcnc/haeinsa/HaeinsaUnitTest.java @@ -580,8 +580,6 @@ public void testConflictAndRecover() throws Exception { /** * Unit test for multiple mutations for any rows in {@link HaeinsaTransaction}. - * - * @throws Exception */ @Test public void testMultipleMutations() throws Exception { @@ -669,8 +667,6 @@ public void testMultipleMutations() throws Exception { /** * Unit test for check get/scan without transaction. - * - * @throws Exception */ @Test public void testHaeinsaTableWithoutTx() throws Exception { From 94edbeba16d2d40d92fda17cfa3c25586317b632 Mon Sep 17 00:00:00 2001 From: James Lee Date: Fri, 6 Feb 2015 15:23:29 +0900 Subject: [PATCH 2/3] Fix switch-case statement indent --- .../kr/co/vcnc/haeinsa/HaeinsaDelete.java | 21 +++--- .../co/vcnc/haeinsa/HaeinsaDeleteTracker.java | 43 +++++------ .../java/kr/co/vcnc/haeinsa/HaeinsaTable.java | 71 ++++++++++--------- .../kr/co/vcnc/haeinsa/HaeinsaTablePool.java | 16 +++-- .../co/vcnc/haeinsa/HaeinsaTransaction.java | 59 +++++++-------- 5 files changed, 108 insertions(+), 102 deletions(-) diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDelete.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDelete.java index add7f15..457f9ba 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDelete.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDelete.java @@ -113,16 +113,17 @@ public TMutation toTMutation() { TRemove newTRemove = new TRemove(); for (HaeinsaKeyValue kv : Iterables.concat(familyMap.values())) { switch (kv.getType()) { - case DeleteColumn: { - newTRemove.addToRemoveCells(new TCellKey().setFamily(kv.getFamily()).setQualifier(kv.getQualifier())); - break; - } - case DeleteFamily: { - newTRemove.addToRemoveFamilies(ByteBuffer.wrap(kv.getFamily())); - break; - } - default: - break; + case DeleteColumn: { + newTRemove.addToRemoveCells(new TCellKey().setFamily(kv.getFamily()).setQualifier(kv.getQualifier())); + break; + } + case DeleteFamily: { + newTRemove.addToRemoveFamilies(ByteBuffer.wrap(kv.getFamily())); + break; + } + default: { + break; + } } } newTMutation.setRemove(newTRemove); diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDeleteTracker.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDeleteTracker.java index 0805c6b..dd7b2b2 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDeleteTracker.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDeleteTracker.java @@ -39,29 +39,30 @@ public class HaeinsaDeleteTracker { */ public void add(HaeinsaKeyValue kv, long sequenceID) { switch (kv.getType()) { - case DeleteFamily: { - Long previous = families.get(kv.getFamily()); - if (previous == null || previous.compareTo(sequenceID) > 0) { - // sequenceId is lower than previous one. - families.put(kv.getFamily(), sequenceID); - } - break; + case DeleteFamily: { + Long previous = families.get(kv.getFamily()); + if (previous == null || previous.compareTo(sequenceID) > 0) { + // sequenceId is lower than previous one. + families.put(kv.getFamily(), sequenceID); } - case DeleteColumn: { - NavigableMap cellMap = cells.get(kv.getFamily()); - if (cellMap == null) { - cellMap = Maps.newTreeMap(Bytes.BYTES_COMPARATOR); - cells.put(kv.getFamily(), cellMap); - } - Long previous = families.get(kv.getQualifier()); - if (previous == null || previous.compareTo(sequenceID) > 0) { - // sequenceId is lower than previous one. - cellMap.put(kv.getQualifier(), sequenceID); - } - break; + break; + } + case DeleteColumn: { + NavigableMap cellMap = cells.get(kv.getFamily()); + if (cellMap == null) { + cellMap = Maps.newTreeMap(Bytes.BYTES_COMPARATOR); + cells.put(kv.getFamily(), cellMap); + } + Long previous = families.get(kv.getQualifier()); + if (previous == null || previous.compareTo(sequenceID) > 0) { + // sequenceId is lower than previous one. + cellMap.put(kv.getQualifier(), sequenceID); } - default: - break; + break; + } + default: { + break; + } } } diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTable.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTable.java index dacaf56..c0be65b 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTable.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTable.java @@ -625,45 +625,46 @@ public void applyMutations(HaeinsaRowTransaction rowTxState, byte[] row) throws TMutation mutation = remaining.get(i); switch (mutation.getType()) { - case PUT: { - TRowLock newRowLock = rowTxState.getCurrent().deepCopy(); - newRowLock.setCurrentTimestamp(mutationTimestamp); - newRowLock.setMutations(remaining.subList(mutationOffset, remaining.size())); - // Maintain prewritten state and extend lock by ROW_LOCK_TIMEOUT - newRowLock.setExpiry(tx.getExpiry()); - Put put = new Put(row); - put.add(LOCK_FAMILY, LOCK_QUALIFIER, newRowLock.getCurrentTimestamp(), TRowLocks.serialize(newRowLock)); - for (TKeyValue kv : mutation.getPut().getValues()) { - put.add(kv.getKey().getFamily(), kv.getKey().getQualifier(), newRowLock.getCurrentTimestamp(), kv.getValue()); - } - if (!table.checkAndPut(row, LOCK_FAMILY, LOCK_QUALIFIER, currentRowLockBytes, put)) { - // Consider as conflict because another transaction might acquire lock of this row. - throw new ConflictException("can't acquire row's lock"); - } else { - rowTxState.setCurrent(newRowLock); - } - break; + case PUT: { + TRowLock newRowLock = rowTxState.getCurrent().deepCopy(); + newRowLock.setCurrentTimestamp(mutationTimestamp); + newRowLock.setMutations(remaining.subList(mutationOffset, remaining.size())); + // Maintain prewritten state and extend lock by ROW_LOCK_TIMEOUT + newRowLock.setExpiry(tx.getExpiry()); + Put put = new Put(row); + put.add(LOCK_FAMILY, LOCK_QUALIFIER, newRowLock.getCurrentTimestamp(), TRowLocks.serialize(newRowLock)); + for (TKeyValue kv : mutation.getPut().getValues()) { + put.add(kv.getKey().getFamily(), kv.getKey().getQualifier(), newRowLock.getCurrentTimestamp(), kv.getValue()); } - case REMOVE: { - Delete delete = new Delete(row); - if (mutation.getRemove().getRemoveFamiliesSize() > 0) { - for (ByteBuffer removeFamily : mutation.getRemove().getRemoveFamilies()) { - delete.deleteFamily(removeFamily.array(), mutationTimestamp); - } - } - if (mutation.getRemove().getRemoveCellsSize() > 0) { - for (TCellKey removeCell : mutation.getRemove().getRemoveCells()) { - delete.deleteColumns(removeCell.getFamily(), removeCell.getQualifier(), mutationTimestamp); - } + if (!table.checkAndPut(row, LOCK_FAMILY, LOCK_QUALIFIER, currentRowLockBytes, put)) { + // Consider as conflict because another transaction might acquire lock of this row. + throw new ConflictException("can't acquire row's lock"); + } else { + rowTxState.setCurrent(newRowLock); + } + break; + } + case REMOVE: { + Delete delete = new Delete(row); + if (mutation.getRemove().getRemoveFamiliesSize() > 0) { + for (ByteBuffer removeFamily : mutation.getRemove().getRemoveFamilies()) { + delete.deleteFamily(removeFamily.array(), mutationTimestamp); } - if (!table.checkAndDelete(row, LOCK_FAMILY, LOCK_QUALIFIER, currentRowLockBytes, delete)) { - // Consider as conflict because another transaction might acquire lock of this row. - throw new ConflictException("can't acquire row's lock"); + } + if (mutation.getRemove().getRemoveCellsSize() > 0) { + for (TCellKey removeCell : mutation.getRemove().getRemoveCells()) { + delete.deleteColumns(removeCell.getFamily(), removeCell.getQualifier(), mutationTimestamp); } - break; } - default: - break; + if (!table.checkAndDelete(row, LOCK_FAMILY, LOCK_QUALIFIER, currentRowLockBytes, delete)) { + // Consider as conflict because another transaction might acquire lock of this row. + throw new ConflictException("can't acquire row's lock"); + } + break; + } + default: { + break; + } } } } diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTablePool.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTablePool.java index 371c828..2b3dc61 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTablePool.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTablePool.java @@ -109,13 +109,15 @@ public HaeinsaTablePool(final Configuration config, final int maxSize, this.poolType = PoolType.Reusable; } else { switch (poolType) { - case Reusable: - case ThreadLocal: - this.poolType = poolType; - break; - default: - this.poolType = PoolType.Reusable; - break; + case Reusable: + case ThreadLocal: { + this.poolType = poolType; + break; + } + default: { + this.poolType = PoolType.Reusable; + break; + } } } this.tables = new PoolMap(this.poolType, this.maxSize); diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTransaction.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTransaction.java index 177eea4..ebb9f36 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTransaction.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTransaction.java @@ -250,23 +250,24 @@ public void commit() throws IOException { CommitMethod method = txStates.determineCommitMethod(); switch (method) { - case READ_ONLY: { - commitReadOnly(); - break; - } - case SINGLE_ROW_PUT_ONLY: { - commitSingleRowPutOnly(); - break; - } - case MULTI_ROW_MUTATIONS: { - commitMultiRowsMutation(); - break; - } - case NOTHING: { - break; - } - default: - break; + case READ_ONLY: { + commitReadOnly(); + break; + } + case SINGLE_ROW_PUT_ONLY: { + commitSingleRowPutOnly(); + break; + } + case MULTI_ROW_MUTATIONS: { + commitMultiRowsMutation(); + break; + } + case NOTHING: { + break; + } + default: { + break; + } } } @@ -439,18 +440,18 @@ protected void recover(boolean ignoreExpiry) throws IOException { extendExpiry(); switch (primaryRowTx.getCurrent().getState()) { - case ABORTED: - case PREWRITTEN: { - abort(); - break; - } - case COMMITTED: { - // Transaction is already succeeded. - makeStable(); - break; - } - default: - throw new ConflictException(); + case ABORTED: + case PREWRITTEN: { + abort(); + break; + } + case COMMITTED: { + // Transaction is already succeeded. + makeStable(); + break; + } + default: + throw new ConflictException(); } } From 19ea6f0848f1d401899c988d9d04f32b3811c0ab Mon Sep 17 00:00:00 2001 From: James Lee Date: Fri, 6 Feb 2015 16:47:50 +0900 Subject: [PATCH 3/3] Fix javadoc warnings in intellij --- .../vcnc/haeinsa/ForwardingHaeinsaTable.java | 5 ---- .../co/vcnc/haeinsa/HaeinsaColumnTracker.java | 3 +- .../kr/co/vcnc/haeinsa/HaeinsaDelete.java | 2 +- .../co/vcnc/haeinsa/HaeinsaDeleteTracker.java | 10 +++---- .../kr/co/vcnc/haeinsa/HaeinsaKeyValue.java | 2 +- .../kr/co/vcnc/haeinsa/HaeinsaMutation.java | 4 +-- .../java/kr/co/vcnc/haeinsa/HaeinsaPut.java | 2 +- .../vcnc/haeinsa/HaeinsaRowTransaction.java | 6 ++-- .../java/kr/co/vcnc/haeinsa/HaeinsaTable.java | 28 +++++++++---------- .../haeinsa/HaeinsaTableIfaceInternal.java | 9 +++--- .../kr/co/vcnc/haeinsa/HaeinsaTablePool.java | 2 +- .../vcnc/haeinsa/HaeinsaTableTransaction.java | 5 ++-- .../co/vcnc/haeinsa/HaeinsaTransaction.java | 12 ++++---- .../haeinsa/HaeinsaTransactionManager.java | 5 ++-- 14 files changed, 44 insertions(+), 51 deletions(-) diff --git a/src/main/java/kr/co/vcnc/haeinsa/ForwardingHaeinsaTable.java b/src/main/java/kr/co/vcnc/haeinsa/ForwardingHaeinsaTable.java index 99ac534..12909e2 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/ForwardingHaeinsaTable.java +++ b/src/main/java/kr/co/vcnc/haeinsa/ForwardingHaeinsaTable.java @@ -34,11 +34,6 @@ public class ForwardingHaeinsaTable extends ForwardingObject implements HaeinsaTableIfaceInternal { private final HaeinsaTableIfaceInternal delegate; - /** - * Constructor - * - * @param haeinsaTable HaeinsaTable - */ public ForwardingHaeinsaTable(HaeinsaTableIface haeinsaTable) { Preconditions.checkArgument(haeinsaTable instanceof HaeinsaTableIfaceInternal); this.delegate = (HaeinsaTableIfaceInternal) haeinsaTable; diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaColumnTracker.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaColumnTracker.java index 13dd90f..68f6ade 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaColumnTracker.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaColumnTracker.java @@ -44,8 +44,7 @@ public class HaeinsaColumnTracker { * Constructor of HaeinsaColumnTracker. *

* If this ColumnTracker track {@link HaeinsaScan}, minColumn, maxColumn - * should be null and minColumnInclusive, maxColumnInclusive should be - * false. + * should be null and minColumnInclusive, maxColumnInclusive should be false. */ public HaeinsaColumnTracker(Map> familyMap, byte[] minColumn, boolean minColumnInclusive, diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDelete.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDelete.java index 457f9ba..fe109b8 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDelete.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDelete.java @@ -32,7 +32,7 @@ import com.google.common.collect.Sets; /** - * Implementation of {@link HaeinsaMuation} which only contains HaeinsaKeyValue + * Implementation of {@link HaeinsaMutation} which only contains HaeinsaKeyValue * with {@link Type#DeleteFamily} and {@link Type#DeleteColumn} identifier. * HaeinsaPut can be analogous to {@link Delete} class in HBase. *

diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDeleteTracker.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDeleteTracker.java index dd7b2b2..9139e2d 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDeleteTracker.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaDeleteTracker.java @@ -31,11 +31,10 @@ public class HaeinsaDeleteTracker { private final NavigableMap> cells = Maps.newTreeMap(Bytes.BYTES_COMPARATOR); /** - * Update family map or column map if kv is not exist in map or sequenceId - * is lower. + * Update family map or column map if kv is not exist in map or sequenceId is lower. * - * @param kv - HaeinsaKeyValue to track - * @param sequenceID - sequence ID, lower is newer. + * @param kv HaeinsaKeyValue to track + * @param sequenceID sequence ID, lower is newer. */ public void add(HaeinsaKeyValue kv, long sequenceID) { switch (kv.getType()) { @@ -67,8 +66,7 @@ public void add(HaeinsaKeyValue kv, long sequenceID) { } /** - * @return Return true if kv is deleted after sequenceID (lower sequenceID), - * return false otherwise. + * @return Return true if kv is deleted after sequenceID (lower sequenceID), return false otherwise. */ public boolean isDeleted(HaeinsaKeyValue kv, long sequenceID) { // check family diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaKeyValue.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaKeyValue.java index 504d4af..e5199f2 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaKeyValue.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaKeyValue.java @@ -36,7 +36,7 @@ * same Enum with {@link org.apache.hadoop.hbase.KeyValue.Type}. *

* HaeinsaKeyValue has public static comparator which can be used in - * navigableMap. This comparator is ComparisionChain of {@link NullableCompator} + * navigableMap. This comparator is ComparisionChain of {@link NullableComparator} * wrapped {@link org.apache.hadoop.hbase.util.Bytes#BYTES_COMPARATOR}. The * order of comparisonChain is row, family, qualifier, value and type. */ diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaMutation.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaMutation.java index a43278d..ffd88a5 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaMutation.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaMutation.java @@ -42,7 +42,7 @@ * These late Get/Scan operations can see the mutated view of specific row * even before those mutations are committed to HBase. *

- * HaeinsaMutation provides {@link HaeinsaKeyValueScanner} interface by {@link #getScanner()} method. + * HaeinsaMutation provides {@link HaeinsaKeyValueScanner} interface by {@link #getScanner(long)} method. */ public abstract class HaeinsaMutation extends HaeinsaOperation { protected byte[] row; @@ -103,7 +103,7 @@ public int compareTo(final Row d) { public abstract TMutation toTMutation(); /** - * Return {@link #HaeinsaKeyValueScanner} interface for single row. + * Return {@link HaeinsaKeyValueScanner} interface for single row. * * @param sequenceID sequence id represent which Scanner is newer one. Lower * id is newer one. diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaPut.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaPut.java index 4677a2f..f91a5f7 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaPut.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaPut.java @@ -35,7 +35,7 @@ import com.google.common.collect.Sets; /** - * Implementation of {@link HaeinsaMuation} which only contains HaeinsaKeyValue + * Implementation of {@link HaeinsaMutation} which only contains HaeinsaKeyValue * with {@link Type#Put} identifier. HaeinsaPut can be analogous to {@link Put} * class in HBase. *

diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaRowTransaction.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaRowTransaction.java index b6d3e46..c64a27f 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaRowTransaction.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaRowTransaction.java @@ -79,9 +79,9 @@ public HaeinsaTableTransaction getTableTransaction() { } /** - * Return list of {@link HaeinsaKeyValueScanner}s which wrap mutations - - * (Put & Delete) contained inside instance. Also assign sequenceID to every - * {@link HaeinsaMutation#MutationScanner}. + * Return list of {@link HaeinsaKeyValueScanner}s which wrap mutations + * (Put and Delete) contained inside instance. Also assign sequenceID to every + * MutationScanner of {@link HaeinsaMutation}. */ public List getScanners() { List result = Lists.newArrayList(); diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTable.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTable.java index c0be65b..70a994b 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTable.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTable.java @@ -200,7 +200,7 @@ public HaeinsaResultScanner getScanner(@Nullable HaeinsaTransaction tx, byte[] f /** * Haeinsa implementation of {@link Scan}. * Scan range of row inside defined by {@link HaeinsaScan} in the context of transaction(tx). - * Return {@link #ClientScanner} which related to {@link HaeinsaTable} and {@link HaeinsaTransaction}. + * Return ClientScanner which related to {@link HaeinsaTable} and {@link HaeinsaTransaction}. *

* Return {@link SimpleClientScanner} which do not support transaction if tx is null. * User can use this feature if specific scan operation does not require strong consistency @@ -291,7 +291,7 @@ private HaeinsaResultScanner getScannerWithoutTx(HaeinsaScan scan) throws IOExce /** * Haeinsa implementation of {@link ColumnRangeFilter}. * Scan range of column inside single row defined by {@link HaeinsaIntraScan} in the context of transaction(tx). - * Return {@link #ClientScanner} which related to {@link HaeinsaTable} and {@link HaeinsaTransaction}. + * Return {@link ClientScanner} which related to {@link HaeinsaTable} and {@link HaeinsaTransaction}. *

* Return {@link SimpleClientScanner} which do not support transaction if tx is null. * User can use this feature if specific intra-scan operation does not require strong consistency. @@ -380,9 +380,9 @@ public void put(HaeinsaTransaction tx, HaeinsaPut put) throws IOException { * Check rowState and whether it contains {@link TRowLock} already, create one if not. *

* Get {@link TRowLock} of the row from HBase if rowState does not contains it. - * If lock is not in stable state, try to recover it first by {@link HaeinsaTrasaction#recover()}. + * If lock is not in stable state, try to recover it first by {@link HaeinsaTransaction#recover(boolean)}. *

- * By calling this method proper time, {@link RowTransaction} inside {@link HaeinsaTransaction} can have + * By calling this method proper time, {@link HaeinsaRowTransaction} inside {@link HaeinsaTransaction} can have * {@link TRowLock} of the row when this method was called first time in the context of the transaction. * * @throws IOException ConflictException, HBase IOException @@ -441,7 +441,7 @@ private boolean checkAndIsShouldRecover(TRowLock rowLock) throws IOException { } /** - * Call {@link HaeinsaTransaction#recover()}. + * Call {@link HaeinsaTransaction#recover(boolean)}. * Abort or recover when there is failed transaction on the row, * throw {@link ConflictException} when there is ongoing transaction. * @@ -526,8 +526,7 @@ public void commitSingleRowPutOnly(HaeinsaRowTransaction rowState, byte[] row) t * {@link ConflictException}. * * @throws IOException ConflictException, HBase IOException. - * @throws NullPointException if oldLock is null (haven't read lock from - * HBase) + * @throws NullPointerException if oldLock is null (haven't read lock from HBase) */ @Override public void checkSingleRowLock(HaeinsaRowTransaction rowState, byte[] row) throws IOException { @@ -781,7 +780,7 @@ protected HTableInterface getHTable() { } /** - * Implementation of {@link HaeinsaReulstScanner} which is used when scan without transaction. + * Implementation of {@link HaeinsaResultScanner} which is used when scan without transaction. */ private class SimpleClientScanner implements HaeinsaResultScanner { private final ResultScanner scanner; @@ -863,7 +862,7 @@ private class ClientScanner implements HaeinsaResultScanner { /** * @param lockInclusive - whether scanners contains {@link TRowLock} inside. - * If not, should bring from {@link RowTransaction} or get from HBase directly. + * If not, should bring from {@link HaeinsaRowTransaction} or get from HBase directly. */ public ClientScanner(HaeinsaTransaction tx, Iterable scanners, Map> familyMap, boolean lockInclusive) { @@ -873,7 +872,7 @@ public ClientScanner(HaeinsaTransaction tx, Iterable sca /** * @param intraScan - To support to use {@link ColumnRangeFilter} * @param lockInclusive - whether scanners contains {@link TRowLock} inside. - * If not, should bring from {@link RowTransaction} or get from HBase directly. + * If not, should bring from {@link HaeinsaRowTransaction} or get from HBase directly. */ public ClientScanner(HaeinsaTransaction tx, Iterable scanners, Map> familyMap, HaeinsaIntraScan intraScan, boolean lockInclusive) { @@ -899,7 +898,8 @@ public ClientScanner(HaeinsaTransaction tx, Iterable sca * Only can be called one time for every ClientScanner. *

* The reason why there are different variables for {@link #scannerList} and {@link #scanners} is that - * the way {@link #nextScanner()} implemented is removing {@link HaeinsaKeyValueScanner} one by one form scanners. + * the way {@link #nextScanner(HaeinsaKeyValueScanner)} implemented is removing + * {@link HaeinsaKeyValueScanner} one by one form scanners. * {@link #close()} method needs to close every {@link ClientScanner} when called, * so some other variable should preserve every scanner when ClientScanner created. */ @@ -963,7 +963,7 @@ public boolean hasNext() { } /** - * Return {@link TRowLock} for specific row from {@link IOException#scanners}. + * Return {@link TRowLock} for specific row from {@link #scanners}. * Return null if there is no proper {@link TRowLock}. *

* If one of these {@link #scanners} has row key which is smaller than given row, @@ -1269,8 +1269,8 @@ public void close() { * So {@link #peek()} method or {@link #next()} method will return value from same row. *

* HBaseGetScanner is now used in two cases. - * First, inside {@link HaeinsaTable#get()}, {@link HaeinsaKeyValue}s returned by this class will - * always have sequenceId of Long.MAX_VALUE. + * First, inside {@link HaeinsaTable#get(HaeinsaTransaction, HaeinsaGet)}, {@link HaeinsaKeyValue}s + * returned by this class will always have sequenceId of Long.MAX_VALUE. * Second is used inside {@link ClientScanner}. In this case, HBaseGetScanner recover failed transaction and * get recovered data from HBase. * Recovered {@link HaeinsaKeyValue} should have smaller sequenceId contained in ClientScanner so far diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIfaceInternal.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIfaceInternal.java index 89a86c1..ae9aa4d 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIfaceInternal.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableIfaceInternal.java @@ -50,8 +50,7 @@ interface HaeinsaTableIfaceInternal extends HaeinsaTableIface { * {@link ConflictException}. * * @throws IOException ConflictException, HBase IOException. - * @throws NullPointException if oldLock is null (haven't read lock from - * HBase) + * @throws NullPointerException if oldLock is null (haven't read lock from HBase) */ void checkSingleRowLock(HaeinsaRowTransaction rowState, byte[] row) throws IOException; @@ -61,7 +60,7 @@ interface HaeinsaTableIfaceInternal extends HaeinsaTableIface { * If first mutation in rowState is {@link HaeinsaPut}, then apply consequent Puts in the same RPC which changes lock to * {@link TRowLockState#PREWRITTEN}. * Remaining mutations which is not applied with first RPC is remained in {@link TRowLock#mutations}. - * This field will be used in {@link #applyMutations()} stage. + * This field will be used in {@link #applyMutations(HaeinsaRowTransaction, byte[])} stage. * Columns written in prewritten stage will be recorded in {@link TRowLock#prewritten} field, * which will be used in {@link HaeinsaTransaction#recover(boolean)} to clean up dirty data * if transaction failed. @@ -134,11 +133,11 @@ interface HaeinsaTableIfaceInternal extends HaeinsaTableIface { /** * Delete columns that are prewritten to the specific row during prewritten stage. + *

* Haeinsa can infer prewritten columns to clean up by parsing prewritten field in {@link TRowLock}. * Should remove column which have {@link TRowLock#currentTimestamp} as timestamp. - * This is possible by using {@link Delete#deleteColumn()} instead of {@link Delete#deleteColumns()}. *

- * Because Haeinsa uses {@link HTableInterface#checkAndDelete()} to delete prewrittens, + * Because Haeinsa uses {@link HTableInterface#checkAndDelete(byte[], byte[], byte[], byte[], Delete)} to delete prewrittens, * {@link TRowLock} is not changed. It will throw {@link ConflictException} if failed to acquire lock in checkAndDelete. * * @throws IOException ConflictException, HBase IOException. diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTablePool.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTablePool.java index 2b3dc61..0a5ec35 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTablePool.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTablePool.java @@ -237,7 +237,7 @@ private void release(HaeinsaTableIface table) throws IOException { * table pool. *

* Note: this is a 'shutdown' of the given table pool and different from - * {@link #putTable(HaeinsaTableIface)}, that is used to return the table + * {@link #release(HaeinsaTableIface)}, that is used to return the table * instance to the pool for future re-use. */ public void closeTablePool(final String tableName) throws IOException { diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableTransaction.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableTransaction.java index 2166387..2964958 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableTransaction.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTableTransaction.java @@ -18,6 +18,7 @@ import java.util.NavigableMap; import kr.co.vcnc.haeinsa.thrift.TRowLocks; +import kr.co.vcnc.haeinsa.thrift.generated.TRowLock; import org.apache.hadoop.hbase.util.Bytes; @@ -55,9 +56,9 @@ public HaeinsaTransaction getTransaction() { *

  • When get {@link HaeinsaRowTransaction} which is already contained in rowStates * - Should not change {@link HaeinsaRowTransaction#current} manually.
  • *
  • When rowTransaction is newly created by this method and {@link TRowLock} associated with the row exists - * - Use {@link HaeinsaRowTransaction#setCurrent()} to set current field of rowTransaction. + * - Use {@link HaeinsaRowTransaction#setCurrent(TRowLock)} to set current field of rowTransaction. *
  • When rowTransaction is newly created by this method and there is no associated {@link TRowLock}
  • - * - Use {@link TRowLocks#serialize(null)} method to set default {@link TRowLock} to current field of rowTransaction. + * - Use {@link TRowLocks#serialize(TRowLock)} method to set default {@link TRowLock} to current field of rowTransaction. * * * @return RowTransaction - {@link HaeinsaRowTransaction} which contained in diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTransaction.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTransaction.java index ebb9f36..5b2b072 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTransaction.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTransaction.java @@ -44,7 +44,7 @@ * and have reference to {@link HaeinsaTransactionManager} which created this instance. *

    * HaeinsaTransaction can be generated via calling {@link HaeinsaTransactionManager#begin()} - * or {@link HaeinsaTransactionManager#getTransaction()}. + * or {@link HaeinsaTransactionManager#getTransaction(byte[], byte[])}. * Former is used when start new transaction, later is used when try to roll back or retry failed transaction. *

    * One {@link HaeinsaTransaction} can't be used after calling {@link #commit()} or {@link #rollback()} is called. @@ -166,7 +166,7 @@ HaeinsaTransactionLocals getLocals() { /** * Bring {@link HaeinsaTableTransaction} which have name of tableName. * If there is no {@link HaeinsaTableTransaction} have this name, - * then create one instance for it and save inside {@link #tableStates} and return. + * then create one instance for it and save inside {@link #txStates} and return. * * @return instance of {@link HaeinsaTableTransaction} */ @@ -272,7 +272,7 @@ public void commit() throws IOException { } /** - * Use {@link HaeinsaTable#checkSingleRowLock()} to check RowLock on HBase + * Use {@link HaeinsaTable#checkSingleRowLock(HaeinsaRowTransaction, byte[])} to check RowLock on HBase * of read-only rows of tx. If all lock-checking by get was success, * read-only tx was success. Throws ConflictException otherwise. * @@ -371,7 +371,7 @@ private void commitMultiRowsMutation() throws IOException { * 1. In case of {@link #commitMultiRowsMutation()}, after changing primary row to * {@link TRowLockState#COMMITTED} and applying all mutations in primary row and secondary rows. *

    - * 2. When try to {@link #recover()} failed transaction in the middle of execution. + * 2. When try to {@link #recover(boolean)} failed transaction in the middle of execution. * This method should be called only when primary row is in the state of {@link TRowLockState#COMMITTED}. * * @throws IOException ConflictException, HBase IOException. @@ -417,7 +417,7 @@ private void makeStable() throws IOException { } /** - * Reload information of failed transaction and complete it by calling {@link #makStable()} + * Reload information of failed transaction and complete it by calling {@link #makeStable()} * if already completed one, ( when primaryRow have {@link TRowLockState#COMMITTED} state } * or abort by calling {@link #abort()} otherwise. * @@ -467,7 +467,7 @@ protected void recover(boolean ignoreExpiry) throws IOException { *

    * Aborting is executed by following order. *

      - *
    1. Abort primary row by calling {@link HaeinsaTableIfaceInternal#abortPrimary()}.
    2. + *
    3. Abort primary row by calling {@link HaeinsaTableIfaceInternal#abortPrimary(HaeinsaRowTransaction, byte[])}.
    4. *
    5. Visit all secondary rows and change from prewritten to stable state. * Prewritten data on rows are removed at this state.
    6. *
    7. Change primary row to stable state.
    8. diff --git a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTransactionManager.java b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTransactionManager.java index 2fdf499..ac927fb 100644 --- a/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTransactionManager.java +++ b/src/main/java/kr/co/vcnc/haeinsa/HaeinsaTransactionManager.java @@ -167,7 +167,8 @@ private void checkDanglingRowLockOrThrow(byte[] tableName, byte[] row, TRowLock /** * Recover TRowLocks of failed HaeinsaTransaction from primary row on HBase. - * Transaction information about secondary rows are recovered with {@link #addSecondaryRowLock()}. + * Transaction information about secondary rows are recovered with + * {@link #addSecondaryRowLock(HaeinsaTransaction, TRowKey, TRowLock, TRowKey)}. * HaeinsaTransaction made by this method do not assign proper values on mutations variable. */ private HaeinsaTransaction getTransactionFromPrimary(TRowKey rowKey, TRowLock primaryRowLock) throws IOException { @@ -194,7 +195,7 @@ private HaeinsaTransaction getTransactionFromPrimary(TRowKey rowKey, TRowLock pr * Secondary row is not included in recovered transaction neither when commitTimestamp is different with primary row's, * because it implicates that the row is locked by other transaction. *

      - * As similar to {@link #getTransactionFromPrimary()}, rowTransaction added by this method do not have + * As similar to {@link #getTransactionFromPrimary(TRowKey, TRowLock)}, rowTransaction added by this method do not have * proper mutations variable. */ private void addSecondaryRowLock(HaeinsaTransaction transaction, TRowKey primaryRowKey,