accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject [accumulo] 03/03: ACCUMULO-4780 Add overflow check to seq num in CommitSession (#360)
Date Wed, 17 Jan 2018 17:35:31 GMT
This is an automated email from the ASF dual-hosted git repository.

kturner pushed a commit to branch 1.7
in repository https://gitbox.apache.org/repos/asf/accumulo.git

commit d99592c150794e609b20696df5a26f3c88086fbc
Author: Mark Owens <jmarkowe@gmail.com>
AuthorDate: Tue Jan 16 11:58:51 2018 -0500

    ACCUMULO-4780 Add overflow check to seq num in CommitSession (#360)
    
    Add overflow check to sequence number in CommitSession.
    
    Ticket suggested adding overflow check to sequence number or converting to long.
    This PR converted the sequence number from and int to long to prevent fear of future
    overflow. The change propagated to several other files that made use of or called
    methods that utilized the sequence number.
    
    Modified the various files and then re-ran tests and integration tests to verify nothing
    had broken. All tests passes.
---
 .../main/java/org/apache/accumulo/tserver/TabletMutations.java    | 6 +++---
 .../src/main/java/org/apache/accumulo/tserver/TabletServer.java   | 4 ++--
 .../src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java  | 8 ++++----
 .../java/org/apache/accumulo/tserver/log/TabletServerLogger.java  | 6 +++---
 .../java/org/apache/accumulo/tserver/tablet/CommitSession.java    | 6 +++---
 .../java/org/apache/accumulo/tserver/tablet/TabletMemory.java     | 2 +-
 6 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletMutations.java
b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletMutations.java
index 21734f9..6a65097 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletMutations.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletMutations.java
@@ -23,11 +23,11 @@ import org.apache.accumulo.core.data.Mutation;
 
 public class TabletMutations {
   private final int tid;
-  private final int seq;
+  private final long seq;
   private final List<Mutation> mutations;
   private final Durability durability;
 
-  public TabletMutations(int tid, int seq, List<Mutation> mutations, Durability durability)
{
+  public TabletMutations(int tid, long seq, List<Mutation> mutations, Durability durability)
{
     this.tid = tid;
     this.seq = seq;
     this.mutations = mutations;
@@ -42,7 +42,7 @@ public class TabletMutations {
     return tid;
   }
 
-  public int getSeq() {
+  public long getSeq() {
     return seq;
   }
 
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
index 305b030..852c611 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
@@ -3005,13 +3005,13 @@ public class TabletServer extends AccumuloServerContext implements
Runnable {
     return durability;
   }
 
-  public void minorCompactionFinished(CommitSession tablet, String newDatafile, int walogSeq)
throws IOException {
+  public void minorCompactionFinished(CommitSession tablet, String newDatafile, long walogSeq)
throws IOException {
     Durability durability = getMincEventDurability(tablet.getExtent());
     totalMinorCompactions.incrementAndGet();
     logger.minorCompactionFinished(tablet, newDatafile, walogSeq, durability);
   }
 
-  public void minorCompactionStarted(CommitSession tablet, int lastUpdateSequence, String
newMapfileLocation) throws IOException {
+  public void minorCompactionStarted(CommitSession tablet, long lastUpdateSequence, String
newMapfileLocation) throws IOException {
     Durability durability = getMincEventDurability(tablet.getExtent());
     logger.minorCompactionStarted(tablet, lastUpdateSequence, newMapfileLocation, durability);
   }
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java
index c6a2593..8fd2b7a 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java
@@ -518,7 +518,7 @@ public class DfsLogger {
       }
   }
 
-  public synchronized void defineTablet(int seq, int tid, KeyExtent tablet) throws IOException
{
+  public synchronized void defineTablet(long seq, int tid, KeyExtent tablet) throws IOException
{
     // write this log to the METADATA table
     final LogFileKey key = new LogFileKey();
     key.event = DEFINE_TABLET;
@@ -539,7 +539,7 @@ public class DfsLogger {
     encryptingLogFile.flush();
   }
 
-  public LoggerOperation log(int seq, int tid, Mutation mutation, Durability durability)
throws IOException {
+  public LoggerOperation log(long seq, int tid, Mutation mutation, Durability durability)
throws IOException {
     return logManyTablets(Collections.singletonList(new TabletMutations(tid, seq, Collections.singletonList(mutation),
durability)));
   }
 
@@ -601,7 +601,7 @@ public class DfsLogger {
     return result;
   }
 
-  public LoggerOperation minorCompactionFinished(int seq, int tid, String fqfn, Durability
durability) throws IOException {
+  public LoggerOperation minorCompactionFinished(long seq, int tid, String fqfn, Durability
durability) throws IOException {
     LogFileKey key = new LogFileKey();
     key.event = COMPACTION_FINISH;
     key.seq = seq;
@@ -609,7 +609,7 @@ public class DfsLogger {
     return logFileData(Collections.singletonList(new Pair<>(key, EMPTY)), durability);
   }
 
-  public LoggerOperation minorCompactionStarted(int seq, int tid, String fqfn, Durability
durability) throws IOException {
+  public LoggerOperation minorCompactionStarted(long seq, int tid, String fqfn, Durability
durability) throws IOException {
     LogFileKey key = new LogFileKey();
     key.event = COMPACTION_START;
     key.seq = seq;
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
index 1cde8a6..3aa0264 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
@@ -395,7 +395,7 @@ public class TabletServerLogger {
     });
   }
 
-  public int log(final CommitSession commitSession, final int tabletSeq, final Mutation m,
final Durability durability) throws IOException {
+  public int log(final CommitSession commitSession, final long tabletSeq, final Mutation
m, final Durability durability) throws IOException {
     if (durability == Durability.NONE) {
       return -1;
     }
@@ -446,7 +446,7 @@ public class TabletServerLogger {
     return seq;
   }
 
-  public void minorCompactionFinished(final CommitSession commitSession, final String fullyQualifiedFileName,
final int walogSeq, final Durability durability)
+  public void minorCompactionFinished(final CommitSession commitSession, final String fullyQualifiedFileName,
final long walogSeq, final Durability durability)
       throws IOException {
 
     long t1 = System.currentTimeMillis();
@@ -464,7 +464,7 @@ public class TabletServerLogger {
     log.debug(" wrote MinC finish  {}: writeTime:{}ms  durability:{}", seq, (t2 - t1), durability);
   }
 
-  public int minorCompactionStarted(final CommitSession commitSession, final int seq, final
String fullyQualifiedFileName, final Durability durability)
+  public long minorCompactionStarted(final CommitSession commitSession, final long seq, final
String fullyQualifiedFileName, final Durability durability)
       throws IOException {
     write(commitSession, false, new Writer() {
       @Override
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CommitSession.java
b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CommitSession.java
index d908f1d..c62c8d5 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CommitSession.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CommitSession.java
@@ -30,21 +30,21 @@ public class CommitSession {
 
   private static final Logger log = LoggerFactory.getLogger(CommitSession.class);
 
-  private final int seq;
+  private final long seq;
   private final InMemoryMap memTable;
   private final TabletCommitter committer;
 
   private int commitsInProgress;
   private long maxCommittedTime = Long.MIN_VALUE;
 
-  CommitSession(TabletCommitter committer, int seq, InMemoryMap imm) {
+  CommitSession(TabletCommitter committer, long seq, InMemoryMap imm) {
     this.seq = seq;
     this.memTable = imm;
     this.committer = committer;
     commitsInProgress = 0;
   }
 
-  public int getWALogSeq() {
+  public long getWALogSeq() {
     return seq;
   }
 
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/TabletMemory.java
b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/TabletMemory.java
index 86f9543..0278e2f 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/TabletMemory.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/TabletMemory.java
@@ -35,7 +35,7 @@ class TabletMemory implements Closeable {
   private InMemoryMap memTable;
   private InMemoryMap otherMemTable;
   private InMemoryMap deletingMemTable;
-  private int nextSeq = 1;
+  private long nextSeq = 1L;
   private CommitSession commitSession;
 
   TabletMemory(TabletCommitter tablet) {

-- 
To stop receiving notification emails like this one, please contact
"commits@accumulo.apache.org" <commits@accumulo.apache.org>.

Mime
View raw message