trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbirds...@apache.org
Subject [1/2] incubator-trafodion git commit: [TRAFODION-2187] Fix DROP SCHEMA CASCADE when sample tables are present
Date Wed, 14 Sep 2016 16:18:10 GMT
Repository: incubator-trafodion
Updated Branches:
  refs/heads/master c246f49ec -> 023979213


[TRAFODION-2187] Fix DROP SCHEMA CASCADE when sample tables are present


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

Branch: refs/heads/master
Commit: b6d71a2788e475216889011f36a3cbed70f19dcf
Parents: 057ae46
Author: Dave Birdsall <dbirdsall@apache.org>
Authored: Tue Sep 13 18:23:41 2016 +0000
Committer: Dave Birdsall <dbirdsall@apache.org>
Committed: Tue Sep 13 18:23:41 2016 +0000

----------------------------------------------------------------------
 core/sql/common/ComSmallDefs.h           |  1 +
 core/sql/sqlcomp/CmpSeabaseDDL.h         |  1 +
 core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp |  8 ++++++++
 core/sql/sqlcomp/CmpSeabaseDDLschema.cpp | 12 ++++++++----
 core/sql/sqlcomp/CmpSeabaseDDLtable.cpp  |  2 +-
 core/sql/ustat/hs_globals.cpp            |  2 +-
 6 files changed, 20 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b6d71a27/core/sql/common/ComSmallDefs.h
----------------------------------------------------------------------
diff --git a/core/sql/common/ComSmallDefs.h b/core/sql/common/ComSmallDefs.h
index 1a1a3bd..66420eb 100644
--- a/core/sql/common/ComSmallDefs.h
+++ b/core/sql/common/ComSmallDefs.h
@@ -129,6 +129,7 @@ typedef NABoolean               ComBoolean;
 #define SEABASE_OLD_PRIVMGR_SCHEMA         "PRIVMGR_MD"
 #define SEABASE_PRIVMGR_SCHEMA         "_PRIVMGR_MD_"
 #define SEABASE_UDF_SCHEMA             "_UDF_"
+#define TRAF_SAMPLE_PREFIX             "TRAF_SAMPLE_"  // prefix for a sample table used
by update stats
 #define LOB_MD_PREFIX                  "LOBMD_"
 #define LOB_DESC_CHUNK_PREFIX          "LOBDescChunks_"
 #define LOB_DESC_HANDLE_PREFIX         "LOBDescHandle_"

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b6d71a27/core/sql/sqlcomp/CmpSeabaseDDL.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDL.h b/core/sql/sqlcomp/CmpSeabaseDDL.h
index ebbcc45..9dd01a5 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDL.h
+++ b/core/sql/sqlcomp/CmpSeabaseDDL.h
@@ -160,6 +160,7 @@ class CmpSeabaseDDL
   static NABoolean isHbase(const NAString &catName);
 
   static bool isHistogramTable(const NAString &tabName);
+  static bool isSampleTable(const NAString &tabName);
   static NABoolean isLOBDependentNameMatch(const NAString &name);
   static NABoolean isSeabaseMD(const NAString &catName,
 			       const NAString &schName,

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b6d71a27/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp b/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
index 2477c9e..4ef16c5 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
@@ -958,6 +958,14 @@ bool CmpSeabaseDDL::isHistogramTable(const NAString &name)
 
 }
 
+bool CmpSeabaseDDL::isSampleTable(const NAString &name)
+{
+  if (name(0,min((sizeof(TRAF_SAMPLE_PREFIX)-1), name.length())) == TRAF_SAMPLE_PREFIX)
+    return true;
+
+  return false;
+}
+
 NABoolean CmpSeabaseDDL::isLOBDependentNameMatch(const NAString &name)
 {
   if ((name(0,min((sizeof(LOB_MD_PREFIX)-1), name.length())) == LOB_MD_PREFIX) ||

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b6d71a27/core/sql/sqlcomp/CmpSeabaseDDLschema.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLschema.cpp b/core/sql/sqlcomp/CmpSeabaseDDLschema.cpp
index 522a4af..836ea47 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLschema.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLschema.cpp
@@ -684,10 +684,14 @@ void CmpSeabaseDDL::dropSeabaseSchema(StmtDDLDropSchema * dropSchemaNode)
        // drop user objects first
        if (objType == COM_BASE_TABLE_OBJECT_LIT) 
 	 {
-	   // histogram tables have already been dropped
-	   // Avoid any tables that match LOB dependent tablenames.
-	   // (there is no special type for these tables) 
-	   if (!isHistogramTable(objName) && !isLOBDependentNameMatch(objName))
+	   // Histogram tables are dropped later. Sample tables
+	   // are dropped when their corresponding tables are dropped
+	   // so we don't need to drop them directly. Also,
+	   // avoid any tables that match LOB dependent tablenames
+	   // (there is no special type for these tables).
+	   if (!isHistogramTable(objName) &&
+               !isSampleTable(objName) &&
+               !isLOBDependentNameMatch(objName))
 	     {
 	       dirtiedMetadata = TRUE;
 	       if (dropOneTable(cliInterface,(char*)catName.data(), 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b6d71a27/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
index 1ba81c2..0929f56 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
@@ -3670,7 +3670,7 @@ short CmpSeabaseDDL::dropSeabaseTable2(
       if (objectNamePart != "SB_HISTOGRAMS" && 
           objectNamePart != "SB_HISTOGRAM_INTERVALS" &&
           objectNamePart != "SB_PERSISTENT_SAMPLES" &&
-          strncmp(objectNamePart.data(),"TRAF_SAMPLE_",sizeof("TRAF_SAMPLE_")) != 0)
+          strncmp(objectNamePart.data(),TRAF_SAMPLE_PREFIX,sizeof(TRAF_SAMPLE_PREFIX)) !=
0)
           
       {
         if (dropSeabaseStats(cliInterface,

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b6d71a27/core/sql/ustat/hs_globals.cpp
----------------------------------------------------------------------
diff --git a/core/sql/ustat/hs_globals.cpp b/core/sql/ustat/hs_globals.cpp
index a7af0f8..f194c23 100644
--- a/core/sql/ustat/hs_globals.cpp
+++ b/core/sql/ustat/hs_globals.cpp
@@ -3856,7 +3856,7 @@ void HSSample::makeTableName(NABoolean isPersSample)
 
         convertInt64ToAscii(objDef->getObjectUID(), objectIDStr);
         sprintf(timestampStr, "_%u_%u", (UInt32)tv.tv_sec, (UInt32)tv.tv_usec);
-        sampleTable += "TRAF_SAMPLE_";
+        sampleTable += TRAF_SAMPLE_PREFIX;  // "TRAF_SAMPLE_"
         sampleTable += objectIDStr;
         sampleTable += timestampStr;
 


Mime
View raw message