[NO ISSUE][TX] Remove Unused Fields in LogRecord
- user model changes: no
- storage format changes: no
- interface changes: yes
- Remove nodeId from ILogRecord
Details:
- Remove the following fields which are
no longer needed from LogRecord:
- numOfFlushedIndexes
- nodeId
- The removed fields were not persisted
and only used for remote logs.
Change-Id: If293953e51525e27110909203941444c6d7eb344
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2269
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Ian Maxon <imaxon@apache.org>
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/DatasetLifecycleManager.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/DatasetLifecycleManager.java
index 5d3d125..3a70515 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/DatasetLifecycleManager.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/DatasetLifecycleManager.java
@@ -400,8 +400,7 @@
if (dsInfo.isDurable()) {
synchronized (logRecord) {
- TransactionUtil.formFlushLogRecord(logRecord, dsInfo.getDatasetID(), null, logManager.getNodeId(),
- dsInfo.getIndexes().size());
+ TransactionUtil.formFlushLogRecord(logRecord, dsInfo.getDatasetID(), null);
try {
logManager.log(logRecord);
} catch (ACIDException e) {
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/PrimaryIndexOperationTracker.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/PrimaryIndexOperationTracker.java
index 14e91ba..5170310 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/PrimaryIndexOperationTracker.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/PrimaryIndexOperationTracker.java
@@ -129,8 +129,7 @@
* Generate a FLUSH log.
* Flush will be triggered when the log is written to disk by LogFlusher.
*/
- TransactionUtil.formFlushLogRecord(logRecord, datasetID, this, logManager.getNodeId(),
- dsInfo.getDatasetIndexes().size());
+ TransactionUtil.formFlushLogRecord(logRecord, datasetID, this);
try {
logManager.log(logRecord);
} catch (ACIDException e) {
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/transactions/ILogRecord.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/transactions/ILogRecord.java
index 3274849..7ddfdfb 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/transactions/ILogRecord.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/transactions/ILogRecord.java
@@ -128,8 +128,6 @@
public void setPKValue(ITupleReference PKValue);
- public String getNodeId();
-
public void readRemoteLog(ByteBuffer buffer);
public void setLogSource(byte logSource);
@@ -138,8 +136,6 @@
public int getRemoteLogSize();
- public void setNodeId(String nodeId);
-
public int getResourcePartition();
public void setResourcePartition(int resourcePartition);
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/transactions/LogRecord.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/transactions/LogRecord.java
index 6b38aa1..743a3fe 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/transactions/LogRecord.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/transactions/LogRecord.java
@@ -98,8 +98,6 @@
* The fields (numOfFlushedIndexes and nodeId) are used for remote flush logs only
* to indicate the source of the log and how many indexes were flushed using its LSN.
*/
- private int numOfFlushedIndexes;
- private String nodeId;
private final AtomicBoolean replicated;
private boolean replicate = false;
private ILogRequester requester;
@@ -180,9 +178,6 @@
doWriteLogRecord(buffer);
if (logType == LogType.FLUSH) {
buffer.putLong(LSN);
- buffer.putInt(numOfFlushedIndexes);
- buffer.putInt(nodeId.length());
- buffer.put(nodeId.getBytes());
}
}
@@ -359,12 +354,6 @@
if (logType == LogType.FLUSH) {
LSN = buffer.getLong();
- numOfFlushedIndexes = buffer.getInt();
- //read serialized node id
- int nodeIdLength = buffer.getInt();
- byte[] nodeIdBytes = new byte[nodeIdLength];
- buffer.get(nodeIdBytes);
- nodeId = new String(nodeIdBytes);
}
}
@@ -545,10 +534,6 @@
if (logType == LogType.FLUSH) {
//LSN
remoteLogSize += Long.BYTES;
- //num of indexes
- remoteLogSize += Integer.BYTES;
- //serialized node id String
- remoteLogSize += Integer.BYTES + nodeId.length();
}
remoteLogSize -= CHKSUM_LEN;
return remoteLogSize;
@@ -631,16 +616,6 @@
}
@Override
- public String getNodeId() {
- return nodeId;
- }
-
- @Override
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- @Override
public void setLogSource(byte logSource) {
this.logSource = logSource;
}
@@ -650,14 +625,6 @@
return logSource;
}
- public int getNumOfFlushedIndexes() {
- return numOfFlushedIndexes;
- }
-
- public void setNumOfFlushedIndexes(int numOfFlushedIndexes) {
- this.numOfFlushedIndexes = numOfFlushedIndexes;
- }
-
public void setPKFieldCnt(int pKFieldCnt) {
PKFieldCnt = pKFieldCnt;
}
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/TransactionUtil.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/TransactionUtil.java
index be4b47f..c3af0f3 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/TransactionUtil.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/TransactionUtil.java
@@ -45,14 +45,11 @@
logRecord.computeAndSetLogSize();
}
- public static void formFlushLogRecord(LogRecord logRecord, int datasetId, PrimaryIndexOperationTracker opTracker,
- String nodeId, int numberOfIndexes) {
+ public static void formFlushLogRecord(LogRecord logRecord, int datasetId, PrimaryIndexOperationTracker opTracker) {
logRecord.setLogType(LogType.FLUSH);
logRecord.setTxnId(-1);
logRecord.setDatasetId(datasetId);
logRecord.setOpTracker(opTracker);
- logRecord.setNumOfFlushedIndexes(numberOfIndexes);
- logRecord.setNodeId(nodeId);
logRecord.computeAndSetLogSize();
}
diff --git a/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/logging/RemoteLogsProcessor.java b/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/logging/RemoteLogsProcessor.java
index c054e6c..5009614 100644
--- a/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/logging/RemoteLogsProcessor.java
+++ b/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/logging/RemoteLogsProcessor.java
@@ -67,9 +67,7 @@
break;
case LogType.FLUSH:
RemoteLogRecord flushLog = new RemoteLogRecord();
- TransactionUtil
- .formFlushLogRecord(flushLog, reusableLog.getDatasetId(), null, reusableLog.getNodeId(),
- reusableLog.getNumOfFlushedIndexes());
+ TransactionUtil.formFlushLogRecord(flushLog, reusableLog.getDatasetId(), null);
flushLog.setRequester(this);
flushLog.setLogSource(LogSource.REMOTE);
flushLog.setMasterLsn(reusableLog.getLSN());