Hi,I need to rename a tagv (hostname, since sometimes our hostname changes). I read about the discussion at https://groups.google.com/forum/#!topic/opentsdb/gBRuaYGUmAo and opentsdb doc about 'dropcaches', and still have some questions.The doc says, "This endpoint purges the in-memory data cached in OpenTSDB. This includes all UID to name and name to UID maps for metrics, tag names and tag values." So the in-memoy data purged by 'dropcaches' is only the uid<->name maps, not including the datapoints that opentsdb received but haven't written into hbase?
Is there a method to list the content of the cache (the in-memory data mentioned above) to be purged by 'dropcaches'?
If 'dropcaches' is not used, will the cache be cleared/refreshed automatically after some timeout?
After the tagk is renamed, before a 'dropcaches' command is not executed, if some agent still report datapoints using the old tagk, the cache (not refreshed) will still map the old tagk to the correct uid (of the new tagk), so the datapoints will actually be written into opentsdb using the new tagk (or, the uid of the new tagk), right? My test on opentsdb 2.2 showed so, and I would like to get confirmed by experts here.
After the tagk is renamed, and 'dropcaches' is not executed, and the agent start sending datapoints to opentsdb using the new tagk, I guess the new tagk will cause a cache miss and opentsdb will check the hbase uid table and get the cache refreshed, and thus these datapoints will be correctly written into opentsdb using the new tagk (or, uid of the new tagk). Is it correct?
In the case above, rolling restarting TSDs is not necessary, right?
On Thursday, January 5, 2017 at 12:37:43 AM UTC-8, Huafeng Lyu wrote:Hi,I need to rename a tagv (hostname, since sometimes our hostname changes). I read about the discussion at https://groups.google.com/forum/#!topic/opentsdb/gBRuaYGUmAo and opentsdb doc about 'dropcaches', and still have some questions.The doc says, "This endpoint purges the in-memory data cached in OpenTSDB. This includes all UID to name and name to UID maps for metrics, tag names and tag values." So the in-memoy data purged by 'dropcaches' is only the uid<->name maps, not including the datapoints that opentsdb received but haven't written into hbase?Right, dropcaches only affects the TSD's memory and doesn't modify the data in storage at all.
Is there a method to list the content of the cache (the in-memory data mentioned above) to be purged by 'dropcaches'?Not right now unfortunately. I'd like to be able to purge selected items at some point. And returning the cache data would be possible but depending on the TSD, it can be huge. (Ours are up to 10GB in size)
If 'dropcaches' is not used, will the cache be cleared/refreshed automatically after some timeout?The current code simply keeps expanding the cache forever and only purges on restarts or when dropcaches is called. I've started work on converting to an LRU cache and that could also be time based.
After the tagk is renamed, before a 'dropcaches' command is not executed, if some agent still report datapoints using the old tagk, the cache (not refreshed) will still map the old tagk to the correct uid (of the new tagk), so the datapoints will actually be written into opentsdb using the new tagk (or, the uid of the new tagk), right? My test on opentsdb 2.2 showed so, and I would like to get confirmed by experts here.Yes, you have that right, which is why renaming is a real pain. Alternatively you may want to look at tagging data with something that never changes, like an asset tag for a host. That way when a hostname changes, you can see new data after the change (since the old data really isn't relevant for the new role) or old data for the old role. But if you really want to look at the specific machine over time, just query for the asset tag.
Thanks ManOLamancha for the explanation. Please see my response in bold below.First, all these discussions (about tagv) also apply to other uids (metric, tagk), right?
Right, dropcaches only affects the TSD's memory and doesn't modify the data in storage at all.I meant the datapoints that opentsdb already received but hasn't written into storage and thus is still in memory (I remember opentsdb will cache those datapoints in memory for up to 1 second?). dropcaches won't affect such datapoints, right?
If 'dropcaches' is not used, will the cache be cleared/refreshed automatically after some timeout?The current code simply keeps expanding the cache forever and only purges on restarts or when dropcaches is called. I've started work on converting to an LRU cache and that could also be time based.Actually I thought this more and found LRU cache may not be a good idea - you cannot control when the cache is purged.With the current cache (keeps expanding until dropcaches is called), we can actually rename a tagv easily - (1) renaming the tagv in opentsdb, and then (2) having the agent report datapoints with the new tagv. The cache will handle the tagv change for us, as you confirmed below. If the cache is LRU, then we're dead if the mapping of the tagk is purged/refreshed after step (1) but before step (2).What do you think?