Skip to content

Commit

Permalink
re apache#3724: Tablet Transaction Log
Browse files Browse the repository at this point in the history
* Removed unused methods
* Verified all modifications are synchronized
  • Loading branch information
ivakegg committed Sep 19, 2023
1 parent 20f1d72 commit c8ad44c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -584,12 +584,8 @@ public MetadataUpdateCount getUpdateCount() {
}

public void clearTransactions() {
tabletLog.clearLog();
}

public void resetTransactions() {
synchronized (tablet) {
tabletLog.resetLog(datafileSizes.keySet());
synchronized(tablet) {
tabletLog.clearLog();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@

/**
* This is a transaction log that will maintain the last N transactions. It is used to be able to
* log and review the transactions when issues are detected.
* log and review the transactions when issues are detected. The modifications to this log are
* NOT thread safe. However one can get the list of transactions or dump the log without having
* to synchronize.
*/
public class TabletTransactionLog {
// The tablet extent for which we are logging
Expand All @@ -61,10 +63,6 @@ public Date getInitialDate() {
return this.log.getInitialDate();
}

public int getNumTransactions() {
return this.log.getNumTransactions();
}

public List<TabletTransaction> getTransactions() {
return this.log.getTransactions();
}
Expand Down Expand Up @@ -108,18 +106,10 @@ public String dumpLog() {
return this.log.dumpLog(extent, false);
}

public String dumpAndClearLog() {
return this.log.dumpLog(extent, true);
}

public void clearLog() {
this.log.clear();
}

public void resetLog(Set<StoredTabletFile> files) {
this.log.reset(files);
}

@Override
public String toString() {
return dumpLog();
Expand All @@ -142,8 +132,7 @@ private static class TransactionLog {
private StoredTabletFile[] finalFiles;

public TransactionLog(Set<StoredTabletFile> files) {
this(files.toArray(new StoredTabletFile[0]));
}
this(files.toArray(new StoredTabletFile[0])); }

private TransactionLog(StoredTabletFile[] files) {
this(System.currentTimeMillis(), files, new Ring<>(0), files);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

import com.google.common.collect.Sets;

public class DatafileTransactionLogTest {
public class TabletTransactionLogTest {

private static TestTable FOO = new TestTable("Foo", TableId.of("1"));
private static KeyExtent FOO_EXTENT = new KeyExtent(FOO.getId(), new Text("2"), new Text("1"));
Expand Down

0 comments on commit c8ad44c

Please sign in to comment.