carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipes...@apache.org
Subject [1/2] incubator-carbondata git commit: correcting the test case.
Date Thu, 08 Sep 2016 04:26:44 GMT
Repository: incubator-carbondata
Updated Branches:
  refs/heads/master 69a2fe6df -> 9c39710b8


correcting the test case.


Project: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/commit/244e759d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/tree/244e759d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/diff/244e759d

Branch: refs/heads/master
Commit: 244e759dfabab19a5f66099c70603fb0cae9bdcb
Parents: 69a2fe6
Author: ravikiran <ravikiran.sn042@gmail.com>
Authored: Wed Sep 7 04:46:59 2016 -0700
Committer: ravipesala <ravi.pesala@gmail.com>
Committed: Thu Sep 8 09:55:00 2016 +0530

----------------------------------------------------------------------
 .../datacompaction/DataCompactionLockTest.scala | 40 ++++++++++----------
 1 file changed, 20 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/244e759d/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/datacompaction/DataCompactionLockTest.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/datacompaction/DataCompactionLockTest.scala
b/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/datacompaction/DataCompactionLockTest.scala
index b01e66b..48a1231 100644
--- a/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/datacompaction/DataCompactionLockTest.scala
+++ b/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/datacompaction/DataCompactionLockTest.scala
@@ -41,7 +41,7 @@ class DataCompactionLockTest extends QueryTest with BeforeAndAfterAll {
   val absoluteTableIdentifier: AbsoluteTableIdentifier = new
       AbsoluteTableIdentifier(
         CarbonProperties.getInstance.getProperty(CarbonCommonConstants.STORE_LOCATION),
-        new CarbonTableIdentifier("default", "compactionLockTestTable", "1")
+        new CarbonTableIdentifier("default", "compactionlocktesttable", "1")
       )
   val carbonTablePath: CarbonTablePath = CarbonStorePath
     .getCarbonTablePath(absoluteTableIdentifier.getStorePath,
@@ -50,16 +50,18 @@ class DataCompactionLockTest extends QueryTest with BeforeAndAfterAll
{
   val dataPath: String = carbonTablePath.getMetadataDirectoryPath
 
   val carbonLock: ICarbonLock =
-    CarbonLockFactory.getCarbonLockObj(absoluteTableIdentifier.getCarbonTableIdentifier,
LockUsage.TABLE_STATUS_LOCK)
+    CarbonLockFactory
+      .getCarbonLockObj(absoluteTableIdentifier.getCarbonTableIdentifier, LockUsage.COMPACTION_LOCK)
 
 
   override def beforeAll {
-    CarbonProperties.getInstance().addProperty("carbon.enable.load.merge", "true")
-    sql("drop table if exists  compactionLockTestTable")
+    CarbonProperties.getInstance()
+      .addProperty(CarbonCommonConstants.ENABLE_CONCURRENT_COMPACTION, "true")
+    sql("drop table if exists  compactionlocktesttable")
     CarbonProperties.getInstance()
       .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "mm/dd/yyyy")
     sql(
-      "CREATE TABLE IF NOT EXISTS compactionLockTestTable (country String, ID Int, date "
+
+      "CREATE TABLE IF NOT EXISTS compactionlocktesttable (country String, ID Int, date "
+
         "Timestamp, name " +
         "String, " +
         "phonetype String, serialname String, salary Int) STORED BY 'org.apache.carbondata"
+
@@ -73,15 +75,15 @@ class DataCompactionLockTest extends QueryTest with BeforeAndAfterAll
{
     var csvFilePath2 = currentDirectory + "/src/test/resources/compaction/compaction2.csv"
     var csvFilePath3 = currentDirectory + "/src/test/resources/compaction/compaction3.csv"
 
-    sql("LOAD DATA LOCAL INPATH '" + csvFilePath1 + "' INTO TABLE compactionLockTestTable
" +
+    sql("LOAD DATA LOCAL INPATH '" + csvFilePath1 + "' INTO TABLE compactionlocktesttable
" +
       "OPTIONS" +
       "('DELIMITER'= ',', 'QUOTECHAR'= '\"')"
     )
-    sql("LOAD DATA LOCAL INPATH '" + csvFilePath2 + "' INTO TABLE compactionLockTestTable
 " +
+    sql("LOAD DATA LOCAL INPATH '" + csvFilePath2 + "' INTO TABLE compactionlocktesttable
 " +
       "OPTIONS" +
       "('DELIMITER'= ',', 'QUOTECHAR'= '\"')"
     )
-    sql("LOAD DATA LOCAL INPATH '" + csvFilePath3 + "' INTO TABLE compactionLockTestTable
 " +
+    sql("LOAD DATA LOCAL INPATH '" + csvFilePath3 + "' INTO TABLE compactionlocktesttable
 " +
       "OPTIONS" +
       "('DELIMITER'= ',', 'QUOTECHAR'= '\"')"
     )
@@ -89,17 +91,19 @@ class DataCompactionLockTest extends QueryTest with BeforeAndAfterAll
{
     carbonLock.lockWithRetries()
 
     // compaction should happen here.
-    sql("alter table compactionLockTestTable compact 'major'"
-    )
+    try{
+      sql("alter table compactionlocktesttable compact 'major'")
+    }
+    catch {
+      case e : Exception =>
+        assert(true)
+    }
   }
 
   /**
     * Compaction should fail as lock is being held purposefully
     */
   test("check if compaction is failed or not.") {
-    var status = true
-    var noOfRetries = 0
-    while (status && noOfRetries < 10) {
 
       val segmentStatusManager: SegmentStatusManager = new SegmentStatusManager(
         absoluteTableIdentifier
@@ -107,20 +111,16 @@ class DataCompactionLockTest extends QueryTest with BeforeAndAfterAll
{
       val segments = segmentStatusManager.getValidSegments().listOfValidSegments.asScala.toList
 
       if (!segments.contains("0.1")) {
-        // wait for 2 seconds for compaction to complete.
-        Thread.sleep(2000)
-        noOfRetries += 1
+        assert(true)
       }
       else {
-        status = false
+        assert(false)
       }
-    }
-    assert(status)
   }
 
 
   override def afterAll {
-    /* sql("drop table compactionLockTestTable") */
+    /* sql("drop table compactionlocktesttable") */
     CarbonProperties.getInstance()
       .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "dd-MM-yyyy")
     carbonLock.unlock()


Mime
View raw message