hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject incubator-hawq git commit: HAWQ-250. Fix building and packaging issue after removal of deprecated GUCs
Date Mon, 14 Dec 2015 03:35:40 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master 93db9c0d1 -> 2d1bb3488


HAWQ-250. Fix building and packaging issue after removal of deprecated GUCs


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

Branch: refs/heads/master
Commit: 2d1bb3488e134babea604aed4d8c6d2490349a66
Parents: 93db9c0
Author: Ruilong Huo <rhuo@pivotal.io>
Authored: Mon Dec 14 10:47:49 2015 +0800
Committer: Ruilong Huo <rhuo@pivotal.io>
Committed: Mon Dec 14 10:47:49 2015 +0800

----------------------------------------------------------------------
 tools/bin/gppylib/system/faultProberImplGpdb.py | 93 ++++++++++++++++++++
 1 file changed, 93 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/2d1bb348/tools/bin/gppylib/system/faultProberImplGpdb.py
----------------------------------------------------------------------
diff --git a/tools/bin/gppylib/system/faultProberImplGpdb.py b/tools/bin/gppylib/system/faultProberImplGpdb.py
new file mode 100644
index 0000000..a819b4f
--- /dev/null
+++ b/tools/bin/gppylib/system/faultProberImplGpdb.py
@@ -0,0 +1,93 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""
+
+Note that this does NOT pay attention to the current pause state in the db.  It can't do
that right now
+  anyway because gp_fts_probe_pause does not reflect the shared memory variable?
+
+"""
+import os
+import time
+import re
+
+from gppylib.gplog import *
+from gppylib.utils import checkNotNone
+from gppylib.system.faultProberInterface import GpFaultProber
+from gppylib.db import dbconn, catalog
+
+logger = get_default_logger()
+
+class GpFaultProberImplGpdb(GpFaultProber):
+    def __init__(self):
+        self.__isPaused = False
+        self.__masterDbUrl = None
+        self.__conn = None
+
+    #
+    # returns self
+    #
+    def initializeProber( self, masterPort ) :
+        self.__masterDbUrl = dbconn.DbURL(port=masterPort, dbname='template1')
+        return self
+
+    def pauseFaultProber(self):
+        assert not self.__isPaused
+        assert self.__masterDbUrl is not None # must be initialized
+        assert self.__conn is None
+
+        logger.debug("Pausing fault prober")
+        
+        self.__conn = dbconn.connect(self.__masterDbUrl, True) # use utility mode so we don't
do any segment connection stuff
+        dbconn.execSQL( self.__conn, "set gp_fts_probe_pause = on")
+
+        self.__isPaused = True
+
+    def unpauseFaultProber(self):
+        assert self.__isPaused
+        assert self.__masterDbUrl is not None  # must be initialized
+        assert self.__conn is not None
+
+        logger.debug("Unpausing fault prober")
+
+        self.__conn.close() # closing connection will rollback GUC setting and so unpause
prober
+        self.__conn = None
+        self.__isPaused = False
+
+    def isFaultProberPaused(self):
+        return self.__isPaused
+
+    def getFaultProberInterval(self):
+        probe_interval_re = re.compile(r'(?P<val>\d+)(?P<unit>[a-zA-Z]*)')
+        probe_interval_secs = 60
+        
+        conn = None
+        
+        try:
+            conn = dbconn.connect(self.__masterDbUrl, True)
+            fts_probe_interval_value = catalog.getSessionGUC(conn, 'gp_fts_probe_interval')
+            m = probe_interval_re.match(fts_probe_interval_value)
+            if m.group('unit') == 'min':
+                probe_interval_secs = int(m.group('val')) * 60
+            else:
+                probe_interval_secs = int(m.group('val'))
+        except:
+            raise
+        finally:
+            if conn:
+                conn.close()
+                
+        return probe_interval_secs


Mime
View raw message