rrs-commit: r28 - trunk

decibel at decibel.org decibel at decibel.org
Sat Feb 19 15:54:28 CST 2005


Author: decibel
Date: Sat Feb 19 21:54:27 2005
New Revision: 28

Modified:
   trunk/rrs_functions.sql
Log:
Improve the comments a bit

Modified: trunk/rrs_functions.sql
==============================================================================
--- trunk/rrs_functions.sql	(original)
+++ trunk/rrs_functions.sql	Sat Feb 19 21:54:27 2005
@@ -320,17 +320,17 @@
             END IF;
         ELSE
             -- Parent is NOT NULL.
-            -- See what the max end time should be based on our parent. Note that we only round
-            -- down and don''t add an interval because we don''t want to try and populate a bucket
-            -- until all the parent buckets it will need exist
-            -- See what our current max bucket is
+            -- First, find out what our first end time is. If there are already buckets for this RRS, then it will be the
+            -- last bucket for this RRS.
             RAISE DEBUG ''rrs.parent IS NOT NULL'';
             SELECT max(end_time)
                 INTO v_first_end_time
                 FROM rrs.bucket
                 WHERE rrs_id = v_rrs.rrs_id
             ;
-            -- No records? Use the minimum end time of our parent
+            
+            -- If there''s no buckets for this RRS, use the *first* bucket in our parent. We use the first because we want
+            -- to populate this RRS with as much data as possible.
             IF v_first_end_time IS NULL THEN
                 /*
                 debug.f(''update_buckets no buckets found for rrs_id %, checking parent (%) for data''
@@ -346,9 +346,13 @@
             END IF;
 
             IF v_first_end_time IS NULL THEN
+                -- If there's no data for our parent, we don't want to create any buckets, because we'd end up with missing
+                -- data.
                 --debug.f(''update_buckets no data available for rrs_id %, skipping to next RRD'', v_rrs.rrs_id);
                 RAISE LOG ''update_buckets no data available for rrs_id %, skipping to next RRD'', v_rrs.rrs_id;
             ELSE
+                -- If we have our first end time, figure out what the last end time will be. This is just the last end time
+                -- of our parent (and no more, because we don't want to miss any data).
                 SELECT max(end_time)
                     INTO v_last_end_time
                     FROM rrs.bucket


More information about the rrs-commit mailing list