Murtadha Hubail has submitted this change and it was merged. Change subject: [NO ISSUE][TX] Remove Unused Fields in LogRecord ......................................................................
[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 <[email protected]> Integration-Tests: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Contrib: Jenkins <[email protected]> Reviewed-by: Ian Maxon <[email protected]> --- M asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/DatasetLifecycleManager.java M asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/PrimaryIndexOperationTracker.java M asterixdb/asterix-common/src/main/java/org/apache/asterix/common/transactions/ILogRecord.java M asterixdb/asterix-common/src/main/java/org/apache/asterix/common/transactions/LogRecord.java M asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/TransactionUtil.java M asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/logging/RemoteLogsProcessor.java 6 files changed, 4 insertions(+), 48 deletions(-) Approvals: Anon. E. Moose #1000171: Jenkins: Verified; No violations found; ; Verified Ian Maxon: Looks good to me, approved 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); @@ -137,8 +135,6 @@ public byte getLogSource(); public int getRemoteLogSize(); - - public void setNodeId(String nodeId); public int getResourcePartition(); 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; } @@ -648,14 +623,6 @@ @Override public byte getLogSource() { return logSource; - } - - public int getNumOfFlushedIndexes() { - return numOfFlushedIndexes; - } - - public void setNumOfFlushedIndexes(int numOfFlushedIndexes) { - this.numOfFlushedIndexes = numOfFlushedIndexes; } public void setPKFieldCnt(int 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()); -- To view, visit https://asterix-gerrit.ics.uci.edu/2269 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: merged Gerrit-Change-Id: If293953e51525e27110909203941444c6d7eb344 Gerrit-PatchSet: 2 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Murtadha Hubail <[email protected]> Gerrit-Reviewer: Anon. E. Moose #1000171 Gerrit-Reviewer: Ian Maxon <[email protected]> Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Murtadha Hubail <[email protected]> Gerrit-Reviewer: Till Westmann <[email protected]> Gerrit-Reviewer: abdullah alamoudi <[email protected]>
