Track outstanding_global_views updates by uid

Currently outstanding_global_views values are only decremented during
the end of epoch cleanup, but not when handle_end_of_result_collection
is called for the specific uid that actually triggered the result
collection (which is specifically NOT a cleanup event).

This changes outstanding_global_views values to be a set of outstanding
uids, instead of a count.  This allows handle_end_of_result_collection
to remove any uids from the set as it sees them.
This commit is contained in:
Justin Azoff 2016-07-29 12:54:20 -04:00
parent 1f7f16be9d
commit f80f2f2a08

View file

@ -237,7 +237,7 @@ global dynamic_requests: set[string] &read_expire=1min;
# to too many intermediate updates. Each sumstat is tracked separately so that # to too many intermediate updates. Each sumstat is tracked separately so that
# one won't overwhelm and degrade other quieter sumstats. # one won't overwhelm and degrade other quieter sumstats.
# Indexed on a sumstat id. # Indexed on a sumstat id.
global outstanding_global_views: table[string] of count &read_expire=1min &default=0; global outstanding_global_views: table[string] of set[string] &read_expire=1min;
const zero_time = double_to_time(0.0); const zero_time = double_to_time(0.0);
# Managers handle logging. # Managers handle logging.
@ -303,12 +303,10 @@ function handle_end_of_result_collection(uid: string, ss_name: string, key: Key,
ss$epoch_result(now, key, ir); ss$epoch_result(now, key, ir);
} }
# Check that there is an outstanding view before subtracting.
# Global views only apply to non-dynamic requests. Dynamic
# requests must be serviced.
if ( outstanding_global_views[ss_name] > 0 )
--outstanding_global_views[ss_name];
} }
# Check if this was an intermediate update
if ( ss_name in outstanding_global_views )
delete outstanding_global_views[ss_name][uid];
delete key_requests[uid]; delete key_requests[uid];
delete done_with[uid]; delete done_with[uid];
@ -444,8 +442,9 @@ event SumStats::cluster_key_intermediate_response(ss_name: string, key: Key)
return; return;
add recent_global_view_keys[ss_name, key]; add recent_global_view_keys[ss_name, key];
if ( ss_name in outstanding_global_views && if ( ss_name !in outstanding_global_views)
|outstanding_global_views[ss_name]| > max_outstanding_global_views ) outstanding_global_views[ss_name] = set();
else if ( |outstanding_global_views[ss_name]| > max_outstanding_global_views )
{ {
# Don't do this intermediate update. Perhaps at some point in the future # Don't do this intermediate update. Perhaps at some point in the future
# we will queue and randomly select from these ignored intermediate # we will queue and randomly select from these ignored intermediate
@ -453,9 +452,8 @@ event SumStats::cluster_key_intermediate_response(ss_name: string, key: Key)
return; return;
} }
++outstanding_global_views[ss_name];
local uid = unique_id(""); local uid = unique_id("");
add outstanding_global_views[ss_name][uid];
done_with[uid] = 0; done_with[uid] = 0;
#print fmt("requesting results for: %s", uid); #print fmt("requesting results for: %s", uid);
event SumStats::cluster_get_result(uid, ss_name, key, F); event SumStats::cluster_get_result(uid, ss_name, key, F);