[LON-CAPA-cvs] cvs: loncom(version_2_11_X) / lond
raeburn
raeburn at source.lon-capa.org
Wed Mar 11 20:37:30 EDT 2015
raeburn Thu Mar 12 00:37:30 2015 EDT
Modified files: (Branch: version_2_11_X)
/loncom lond
Log:
- For 2.11
Backport 1.512, 1.513, 1.514
Index: loncom/lond
diff -u loncom/lond:1.489.2.16 loncom/lond:1.489.2.17
--- loncom/lond:1.489.2.16 Sun Jun 29 03:23:11 2014
+++ loncom/lond Thu Mar 12 00:37:30 2015
@@ -2,7 +2,7 @@
# The LearningOnline Network
# lond "LON Daemon" Server (port "LOND" 5663)
#
-# $Id: lond,v 1.489.2.16 2014/06/29 03:23:11 raeburn Exp $
+# $Id: lond,v 1.489.2.17 2015/03/12 00:37:30 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -61,7 +61,7 @@
my $status='';
my $lastlog='';
-my $VERSION='$Revision: 1.489.2.16 $'; #' stupid emacs
+my $VERSION='$Revision: 1.489.2.17 $'; #' stupid emacs
my $remoteVERSION;
my $currenthostid="default";
my $currentdomainid;
@@ -2812,6 +2812,10 @@
foreach my $pair (@pairs) {
my ($key,$value)=split(/=/,$pair);
if (exists($hashref->{$key})) {
+ if (!&untie_user_hash($hashref)) {
+ &logthis("error: ".($!+0)." untie (GDBM) failed ".
+ "while attempting newput - early out as key exists");
+ }
&Failure($client, "key_exists: ".$key."\n",$userinput);
return 1;
}
@@ -3315,6 +3319,9 @@
# namespace - Name of the database being modified
# rid - Resource keyword to modify.
# what - new value associated with rid.
+# laststore - (optional) version=timestamp
+# for most recent transaction for rid
+# in namespace, when cstore was called
#
# $client - Socket open on the client.
#
@@ -3323,23 +3330,47 @@
# 1 (keep on processing).
# Side-Effects:
# Writes to the client
+# Successful storage will cause either 'ok', or, if $laststore was included
+# in the tail of the request, and the version number for the last transaction
+# is larger than the version in $laststore, delay:$numtrans , where $numtrans
+# is the number of store evevnts recorded for rid in namespace since
+# lonnet::store() was called by the client.
+#
sub store_handler {
my ($cmd, $tail, $client) = @_;
my $userinput = "$cmd:$tail";
- my ($udom,$uname,$namespace,$rid,$what) =split(/:/,$tail);
+ chomp($tail);
+ my ($udom,$uname,$namespace,$rid,$what,$laststore) =split(/:/,$tail);
if ($namespace ne 'roles') {
- chomp($what);
my @pairs=split(/\&/,$what);
my $hashref = &tie_user_hash($udom, $uname, $namespace,
&GDBM_WRCREAT(), "S",
"$rid:$what");
if ($hashref) {
my $now = time;
- my @previouskeys=split(/&/,$hashref->{"keys:$rid"});
- my $key;
+ my $numtrans;
+ if ($laststore) {
+ my ($previousversion,$previoustime) = split(/\=/,$laststore);
+ my ($lastversion,$lasttime) = (0,0);
+ $lastversion = $hashref->{"version:$rid"};
+ if ($lastversion) {
+ $lasttime = $hashref->{"$lastversion:$rid:timestamp"};
+ }
+ if (($previousversion) && ($previousversion !~ /\D/)) {
+ if (($lastversion > $previousversion) && ($lasttime >= $previoustime)) {
+ $numtrans = $lastversion - $previousversion;
+ }
+ } elsif ($lastversion) {
+ $numtrans = $lastversion;
+ }
+ if ($numtrans) {
+ $numtrans =~ s/D//g;
+ }
+ }
+
$hashref->{"version:$rid"}++;
my $version=$hashref->{"version:$rid"};
my $allkeys='';
@@ -3352,7 +3383,11 @@
$allkeys.='timestamp';
$hashref->{"$version:keys:$rid"}=$allkeys;
if (&untie_user_hash($hashref)) {
- &Reply($client, "ok\n", $userinput);
+ my $msg = 'ok';
+ if ($numtrans) {
+ $msg = 'delay:'.$numtrans;
+ }
+ &Reply($client, "$msg\n", $userinput);
} else {
&Failure($client, "error: ".($!+0)." untie(GDBM) Failed ".
"while attempting store\n", $userinput);
@@ -6575,7 +6610,7 @@
&Authen::Krb5::init_context();
my $no_ets;
- if ($dist =~ /^(?:centos|rhes)(\d+)$/) {
+ if ($dist =~ /^(?:centos|rhes|scientific)(\d+)$/) {
if ($1 >= 7) {
$no_ets = 1;
}
@@ -6583,6 +6618,10 @@
if (($1 eq '9.3') || ($1 >= 12.2)) {
$no_ets = 1;
}
+ } elsif ($dist =~ /^sles(\d+)$/) {
+ if ($1 > 11) {
+ $no_ets = 1;
+ }
} elsif ($dist =~ /^fedora(\d+)$/) {
if ($1 < 7) {
$no_ets = 1;
More information about the LON-CAPA-cvs
mailing list