You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mh...@apache.org on 2018/03/09 16:34:50 UTC
asterixdb git commit: [NO ISSUE][TX] Fix WAIT_LOG Reading
Repository: asterixdb
Updated Branches:
refs/heads/master 2e4f34e00 -> 5cc4e7a3f
[NO ISSUE][TX] Fix WAIT_LOG Reading
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- Fix WAIT_LOG reading.
- Add test case.
Change-Id: I6a8b75152466f96a4b00cc6f2d25582ba65e6013
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2466
Reviewed-by: Michael Blow <mb...@apache.org>
Tested-by: Michael Blow <mb...@apache.org>
Sonar-Qube: Jenkins <je...@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <je...@fulliautomatix.ics.uci.edu>
Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/5cc4e7a3
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/5cc4e7a3
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/5cc4e7a3
Branch: refs/heads/master
Commit: 5cc4e7a3fa19dacfef96647362075c05ff19536f
Parents: 2e4f34e
Author: Michael Blow <mb...@apache.org>
Authored: Fri Mar 9 08:07:40 2018 -0800
Committer: Murtadha Hubail <mh...@apache.org>
Committed: Fri Mar 9 08:34:23 2018 -0800
----------------------------------------------------------------------
.../apache/asterix/test/txn/LogManagerTest.java | 24 ++++++++++++++++++++
.../asterix/common/transactions/LogRecord.java | 5 ----
2 files changed, 24 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cc4e7a3/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/txn/LogManagerTest.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/txn/LogManagerTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/txn/LogManagerTest.java
index 6a70a29..1c8ac62 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/txn/LogManagerTest.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/txn/LogManagerTest.java
@@ -19,6 +19,7 @@
package org.apache.asterix.test.txn;
import java.lang.reflect.Method;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
@@ -36,6 +37,7 @@ import org.apache.asterix.common.transactions.ILogManager;
import org.apache.asterix.common.transactions.ITransactionContext;
import org.apache.asterix.common.transactions.ITransactionManager;
import org.apache.asterix.common.transactions.LogRecord;
+import org.apache.asterix.common.transactions.LogSource;
import org.apache.asterix.common.transactions.LogType;
import org.apache.asterix.common.transactions.TransactionOptions;
import org.apache.asterix.common.transactions.TxnId;
@@ -43,6 +45,7 @@ import org.apache.asterix.common.utils.TransactionUtil;
import org.apache.asterix.metadata.entities.Dataset;
import org.apache.asterix.test.common.TestTupleReference;
import org.apache.asterix.transaction.management.service.logging.LogManager;
+import org.apache.asterix.transaction.management.service.transaction.TransactionContextFactory;
import org.apache.asterix.transaction.management.service.transaction.TransactionManagementConstants.LockManagerConstants;
import org.apache.hyracks.storage.am.common.impls.NoOpOperationCallback;
import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndex;
@@ -164,6 +167,27 @@ public class LogManagerTest {
interruptedLogPageSwitch();
}
+ @Test
+ public void waitLogTest() throws Exception {
+ final INcApplicationContext ncAppCtx = (INcApplicationContext) integrationUtil.ncs[0].getApplicationContext();
+ LogRecord logRecord = new LogRecord();
+ final long txnId = 1;
+ logRecord.setTxnCtx(TransactionContextFactory.create(new TxnId(txnId),
+ new TransactionOptions(ITransactionManager.AtomicityLevel.ENTITY_LEVEL)));
+ logRecord.setLogSource(LogSource.LOCAL);
+ logRecord.setLogType(LogType.WAIT);
+ logRecord.setTxnId(txnId);
+ logRecord.isFlushed(false);
+ logRecord.computeAndSetLogSize();
+ Thread transactor = new Thread(() -> {
+ final LogManager logManager = (LogManager) ncAppCtx.getTransactionSubsystem().getLogManager();
+ logManager.log(logRecord);
+ });
+ transactor.start();
+ transactor.join(TimeUnit.SECONDS.toMillis(30));
+ Assert.assertTrue(logRecord.isFlushed());
+ }
+
private static ITransactionContext beingTransaction(INcApplicationContext ncAppCtx, ILSMIndex index,
long resourceId) {
final TxnId txnId = new TxnId(1);
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cc4e7a3/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/transactions/LogRecord.java
----------------------------------------------------------------------
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 7e61266..d85fd70 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
@@ -255,11 +255,6 @@ public class LogRecord implements ILogRecord {
computeAndSetLogSize();
break;
case LogType.WAIT:
- if (buffer.remaining() < ILogRecord.DS_LEN) {
- return RecordReadStatus.TRUNCATED;
- }
- datasetId = buffer.getInt();
- resourceId = 0l;
computeAndSetLogSize();
break;
case LogType.JOB_COMMIT: