You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by hz...@apache.org on 2017/02/06 23:16:41 UTC
[1/2] incubator-trafodion git commit: Improve concurrency of drop
constraint, log memory pressure
Repository: incubator-trafodion
Updated Branches:
refs/heads/master 8ad3a10f2 -> 09f3c9d8b
Improve concurrency of drop constraint, log memory pressure
Two minor changes found as result of some experiments:
Add a cardinality hint to a join query used during drop constraint.
This should cause us to use a nested join, reducing the chances of
a write conflict during commit processing.
Also added debugging support for memory pressure, setting an environment
variable allows to log the parameters to a file. It's best to use
this with a single sqlci tool, like this:
export SQL_MEMMONITOR_LOGFILE=mylogfile
sqlci
Sample output:
Fri Feb 3 01:33:42 2017: pctFree=0.274771, pageFaultRate=24.115740, (free*normpagefault*commitratio) = (-0.099085 * 0.246121 * 0.535585), pressure=0
Fri Feb 3 01:33:48 2017: pctFree=0.274772, pageFaultRate=25.187914, (free*normpagefault*commitratio) = (-0.099086 * 0.257064 * 0.535585), pressure=0
Fri Feb 3 01:33:54 2017: pctFree=0.274771, pageFaultRate=25.458275, (free*normpagefault*commitratio) = (-0.099085 * 0.259823 * 0.535587), pressure=0
Fri Feb 3 01:34:00 2017: pctFree=0.274785, pageFaultRate=20.749832, (free*normpagefault*commitratio) = (-0.099139 * 0.211769 * 0.535575), pressure=0
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/01fcd3cc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/01fcd3cc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/01fcd3cc
Branch: refs/heads/master
Commit: 01fcd3cc8b1eee5cb2fc608fc30475e943a3dc60
Parents: a5e5c24
Author: Hans Zeller <hz...@apache.org>
Authored: Fri Feb 3 01:39:29 2017 +0000
Committer: Hans Zeller <hz...@apache.org>
Committed: Fri Feb 3 01:39:29 2017 +0000
----------------------------------------------------------------------
core/sql/cli/memorymonitor.cpp | 29 ++++++++++++++++++++++++++++
core/sql/cli/memorymonitor.h | 1 +
core/sql/sqlcomp/CmpSeabaseDDLtable.cpp | 4 +++-
3 files changed, 33 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/01fcd3cc/core/sql/cli/memorymonitor.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/memorymonitor.cpp b/core/sql/cli/memorymonitor.cpp
index a7c0efd..f9d4af2 100644
--- a/core/sql/cli/memorymonitor.cpp
+++ b/core/sql/cli/memorymonitor.cpp
@@ -130,6 +130,14 @@ MemoryMonitor::MemoryMonitor(Lng32 windowSize,
return;
}
+ // log info to a file, if requested
+ char *lv_logfile = getenv("SQL_MEMMONITOR_LOGFILE");
+ if (lv_logfile) {
+ fd_logfile_ = fopen(lv_logfile, "a");
+ }
+ else
+ fd_logfile_ = NULL;
+
ULng32 pageSize = 0;
fd_vmstat_ = fopen("/proc/vmstat", "r");
@@ -277,6 +285,27 @@ void MemoryMonitor::update(float &scale) {
float normalizedPageFaultRate = pageFaultRate_ / physKBytesRatio_;
pressure_ = MAXOF(MINOF(((1 - 4 * percentFree) * (normalizedPageFaultRate / 25) * commitPhysRatio_), 100), 0);
scale = 1 + (100 - pressure_) * 0.05;
+
+ if (fd_logfile_) {
+ time_t now = time(0);
+ char timebuf[32];
+ char* dt = ctime_r(&now, timebuf);
+ size_t dtLen = strlen(timebuf);
+
+ // remove trailing \n from timebuf
+ if (dtLen > 1)
+ timebuf[dtLen-1] = '\0';
+ fprintf(fd_logfile_,
+ "%s: pctFree=%f, pageFaultRate=%f, (free*normpagefault*commitratio) = (%f * %f * %f), pressure=%d\n",
+ timebuf,
+ percentFree,
+ pageFaultRate_,
+ (1 - 4 * percentFree),
+ (normalizedPageFaultRate / 25),
+ commitPhysRatio_,
+ pressure_);
+ fflush(fd_logfile_);
+ }
return;
}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/01fcd3cc/core/sql/cli/memorymonitor.h
----------------------------------------------------------------------
diff --git a/core/sql/cli/memorymonitor.h b/core/sql/cli/memorymonitor.h
index d9751b8..9ddefc0 100644
--- a/core/sql/cli/memorymonitor.h
+++ b/core/sql/cli/memorymonitor.h
@@ -123,6 +123,7 @@ private:
static ULng32 threadId_;
FILE* fd_meminfo_;
FILE* fd_vmstat_;
+ FILE* fd_logfile_;
};
#endif
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/01fcd3cc/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
index 93f16be..ad28bd1 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
@@ -9270,7 +9270,9 @@ void CmpSeabaseDDL::alterSeabaseTableDropConstraint(
// find the index that corresponds to this constraint
char query[1000];
- str_sprintf(query, "select I.keytag, I.is_explicit from %s.\"%s\".%s T, %s.\"%s\".%s I where T.table_uid = %Ld and T.constraint_uid = %Ld and T.table_uid = I.base_table_uid and T.index_uid = I.index_uid ",
+ // the cardinality hint should force a nested join with
+ // TABLE_CONSTRAINTS as the outer and INDEXES as the inner
+ str_sprintf(query, "select I.keytag, I.is_explicit from %s.\"%s\".%s T, %s.\"%s\".%s I /*+ cardinality 1e9 */ where T.table_uid = %Ld and T.constraint_uid = %Ld and T.table_uid = I.base_table_uid and T.index_uid = I.index_uid ",
getSystemCatalog(), SEABASE_MD_SCHEMA, SEABASE_TABLE_CONSTRAINTS,
getSystemCatalog(), SEABASE_MD_SCHEMA, SEABASE_INDEXES,
naTable->objectUid().castToInt64(),
[2/2] incubator-trafodion git commit: Merge Improve concurrency of
drop constraint, log memory pressure PR-944
Posted by hz...@apache.org.
Merge Improve concurrency of drop constraint, log memory pressure PR-944
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/09f3c9d8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/09f3c9d8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/09f3c9d8
Branch: refs/heads/master
Commit: 09f3c9d8b9ed7d6e3371300b6f0d5b315eb2e49a
Parents: 8ad3a10 01fcd3c
Author: Hans Zeller <hz...@apache.org>
Authored: Mon Feb 6 23:15:39 2017 +0000
Committer: Hans Zeller <hz...@apache.org>
Committed: Mon Feb 6 23:15:39 2017 +0000
----------------------------------------------------------------------
core/sql/cli/memorymonitor.cpp | 29 ++++++++++++++++++++++++++++
core/sql/cli/memorymonitor.h | 1 +
core/sql/sqlcomp/CmpSeabaseDDLtable.cpp | 4 +++-
3 files changed, 33 insertions(+), 1 deletion(-)
----------------------------------------------------------------------