[SCM] CTDB repository - branch 1.0.112 updated - ctdb-1.0.111-91-g2192c45
Ronnie Sahlberg
sahlberg at samba.org
Tue Jun 1 21:15:54 MDT 2010
The branch, 1.0.112 has been updated
via 2192c45663bde9d5677e28f19adec8713481f4aa (commit)
via 20023ae4ab336e8f19cd15769ad73dff71a84957 (commit)
from cb9456b3b68c428c85dff29dfa4c040147ecacd6 (commit)
http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=1.0.112
- Log -----------------------------------------------------------------
commit 2192c45663bde9d5677e28f19adec8713481f4aa
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed Jun 2 13:13:09 2010 +1000
Add a variable for start/current time to ctdb statistics
and print the time startistics was taken and for how long the statistics have been collected to the "ctdb statistics" output.
commit 20023ae4ab336e8f19cd15769ad73dff71a84957
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed Jun 2 12:47:01 2010 +1000
Prevent clients from connecting to the natgw address.
This address is dedicated for outgoing connections.
BZ62613
-----------------------------------------------------------------------
Summary of changes:
client/ctdb_client.c | 2 ++
config/events.d/11.natgw | 8 ++++++++
include/ctdb_private.h | 2 ++
server/ctdb_control.c | 3 +++
tools/ctdb.c | 15 +++++++++++++++
5 files changed, 30 insertions(+), 0 deletions(-)
Changeset truncated at 500 lines:
diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index 4aad400..4a307c4 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -2757,6 +2757,8 @@ struct ctdb_context *ctdb_init(struct event_context *ev)
return NULL;
}
+ ctdb->statistics.statistics_start_time = timeval_current();
+
return ctdb;
}
diff --git a/config/events.d/11.natgw b/config/events.d/11.natgw
index ae56f23..7ae9c98 100644
--- a/config/events.d/11.natgw
+++ b/config/events.d/11.natgw
@@ -13,6 +13,8 @@ loadconfig
delete_all() {
CTDB_NATGW_PUBLIC_IP_HOST=`echo $CTDB_NATGW_PUBLIC_IP | sed -e "s/\/.*/\/32/"`
+ iptables -D INPUT -p tcp --syn -d $CTDB_NATGW_PUBLIC_IP_HOST -j REJECT 2>/dev/null
+
remove_ip $CTDB_NATGW_PUBLIC_IP $CTDB_NATGW_PUBLIC_IFACE
remove_ip $CTDB_NATGW_PUBLIC_IP_HOST lo
@@ -35,6 +37,12 @@ case "$1" in
exit 1
}
+ # block all incoming connections to the natgw address
+ CTDB_NATGW_PUBLIC_IP_HOST=`echo $CTDB_NATGW_PUBLIC_IP | sed -e "s/\/.*/\/32/"`
+ iptables -D INPUT -p tcp --syn -d $CTDB_NATGW_PUBLIC_IP_HOST -j REJECT 2>/dev/null
+ iptables -I INPUT -p tcp --syn -d $CTDB_NATGW_PUBLIC_IP_HOST -j REJECT 2>/dev/null
+
+
# do not respond to ARPs that are for ip addresses with scope 'host'
echo 3 > /proc/sys/net/ipv4/conf/all/arp_ignore
# do not send out arp requests from loopback addresses
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 6893d67..099182a 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -345,6 +345,8 @@ struct ctdb_statistics {
double max_lockwait_latency;
double max_childwrite_latency;
uint32_t num_recoveries;
+ struct timeval statistics_start_time;
+ struct timeval statistics_current_time;
};
diff --git a/server/ctdb_control.c b/server/ctdb_control.c
index ed7324c..6c10101 100644
--- a/server/ctdb_control.c
+++ b/server/ctdb_control.c
@@ -108,6 +108,8 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
}
}
ctdb->statistics.recovering = (ctdb->recovery_mode == CTDB_RECOVERY_ACTIVE);
+ ctdb->statistics.statistics_current_time = timeval_current();
+
outdata->dptr = (uint8_t *)&ctdb->statistics;
outdata->dsize = sizeof(ctdb->statistics);
return 0;
@@ -128,6 +130,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
case CTDB_CONTROL_STATISTICS_RESET: {
CHECK_CONTROL_DATA_SIZE(0);
ZERO_STRUCT(ctdb->statistics);
+ ctdb->statistics.statistics_start_time = timeval_current();
return 0;
}
diff --git a/tools/ctdb.c b/tools/ctdb.c
index 2939f88..91e8212 100644
--- a/tools/ctdb.c
+++ b/tools/ctdb.c
@@ -158,6 +158,7 @@ static void show_statistics(struct ctdb_statistics *s)
int i;
const char *prefix=NULL;
int preflen=0;
+ int tmp, days, hours, minutes, seconds;
const struct {
const char *name;
uint32_t offset;
@@ -196,7 +197,19 @@ static void show_statistics(struct ctdb_statistics *s)
STATISTICS_FIELD(memory_used),
STATISTICS_FIELD(max_hop_count),
};
+ tmp = s->statistics_current_time.tv_sec - s->statistics_start_time.tv_sec;
+ seconds = tmp%60;
+ tmp /= 60;
+ minutes = tmp%60;
+ tmp /= 60;
+ hours = tmp%24;
+ tmp /= 24;
+ days = tmp;
+
printf("CTDB version %u\n", CTDB_VERSION);
+ printf("Current time of statistics : %s", ctime(&s->statistics_start_time.tv_sec));
+ printf("Statistics collected since : (%03d %02d:%02d:%02d) %s", days, hours, minutes, seconds, ctime(&s->statistics_start_time.tv_sec));
+
for (i=0;i<ARRAY_SIZE(fields);i++) {
if (strchr(fields[i].name, '.')) {
preflen = strcspn(fields[i].name, ".")+1;
@@ -219,6 +232,8 @@ static void show_statistics(struct ctdb_statistics *s)
printf(" %-30s %.6f sec\n", "max_call_latency", s->max_call_latency);
printf(" %-30s %.6f sec\n", "max_lockwait_latency", s->max_lockwait_latency);
printf(" %-30s %.6f sec\n", "max_childwrite_latency", s->max_childwrite_latency);
+ printf(" %-30s %.6f sec\n", "max_childwrite_latency", s->max_childwrite_latency);
+
talloc_free(tmp_ctx);
}
--
CTDB repository
More information about the samba-cvs
mailing list