Github user narendragoyal commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1457#discussion_r171364980
--- Diff: core/sqf/monitor/linux/zclient.cxx ---
@@ -1524,6 +1763,108 @@ int CZClient::WatchNode( const char *nodeName )
return(rc);
}
+int CZClient::WatchNodeMasterDelete( const char *nodeName )
+{
+ const char method_name[] = "CZClient::WatchMasterDelete";
+ TRACE_ENTRY;
+
+ int rc = -1;
+ stringstream newpath;
+ newpath.str( "" );
+ newpath << zkRootNode_.c_str()
+ << zkRootNodeInstance_.c_str()
+ << ZCLIENT_MASTER_ZNODE
+ << nodeName;
+
+ string monZnode = newpath.str( );
+
+ if (trace_settings & (TRACE_INIT | TRACE_RECOVERY))
+ {
+ trace_printf( "%s@%d zoo_delete(%s)\n"
+ , method_name, __LINE__
+ , monZnode.c_str() );
+ }
+
+ rc = zoo_delete( ZHandle
+ , monZnode.c_str( )
+ , -1 );
+ if ( rc == ZOK )
+ {
+ if (trace_settings & (TRACE_INIT | TRACE_RECOVERY))
+ {
+ trace_printf( "%s@%d (MasterMonitor) WatchNodeMasterDelete
deleted %s, with rc == ZOK\n"
+ , method_name, __LINE__
+ , nodeName );
+ }
+ char buf[MON_STRING_BUF_SIZE];
+ snprintf( buf, sizeof(buf)
+ , "[%s], znode (%s) deleted!\n"
+ , method_name, nodeName );
+ mon_log_write(MON_ZCLIENT_WATCHMASTERNODEDELETE_1, SQ_LOG_INFO,
buf);
+ }
+ else if ( rc == ZNONODE )
+ {
+ // This is fine since we call it indiscriminately
+ if (trace_settings & (TRACE_INIT | TRACE_RECOVERY))
+ {
+ trace_printf( "%s@%d (MasterMonitor) WatchNodeMasterDelete
deleted %s, with rc == ZNONODE (fine)\n"
+ , method_name, __LINE__
+ , nodeName );
+ }
+ }
+ else if ( rc == ZCONNECTIONLOSS ||
+ rc == ZOPERATIONTIMEOUT )
+ {
+ if (trace_settings & (TRACE_INIT | TRACE_RECOVERY))
+ {
+ trace_printf( "%s@%d (MasterMonitor) WatchNodeMasterDelete
deleted %s, with rc == ZOK\n"
+ , method_name, __LINE__
+ , nodeName );
+ }
+ rc = ZOK;
+ char buf[MON_STRING_BUF_SIZE];
+ snprintf( buf, sizeof(buf)
+ , "[%s], znode (%s) already deleted or cannot be
accessed!\n"
+ , method_name, nodeName );
+ mon_log_write(MON_ZCLIENT_WATCHMASTERNODEDELETE_2, SQ_LOG_INFO,
buf);
+ }
+ else
+ {
+ if (trace_settings & (TRACE_INIT | TRACE_RECOVERY))
+ {
+ trace_printf( "%s@%d (MasterMonitor) WatchNodeMasterDelete
deleted %s, with rc == ZOK\n"
--- End diff --
Similat comment as on line 1820
---