hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Dai <>
Subject Re: Question on CachedStore cache update
Date Thu, 08 Feb 2018 19:41:50 GMT
Hi, Alan,

If database cache is changed locally, we don’t want to bring remote copy to overwrite it
as the remote copy doesn’t carry local changes (ideally, we shall also apply local changes
to the remote copy images we bring in from db, but we are not there yet). That’s why we
skip the update if there’s local changes, and wait for the next iteration to sync with remote.
isDatabaseCacheDirty is initially set to false unless there’s local update, and will be
reset during cache swap, thus give a chance for the next iteration to update the cache if
there’s no local changes.


On 2/6/18, 11:57 AM, "Alan Gates" <> wrote:

    I’m confused by the following code in the CachedStore.  This in in the
    CacheUpdateMasterWork thread, in the updateDatabases method (which is
    called by update()):
    *// Skip background updates if we detect change*
    *if *(*isDatabaseCacheDirty*.compareAndSet(*true*, *false*)) {
      *LOG*.debug(*"Skipping database cache update; the database list we have
    is dirty."*);
    Why are we not updating the cache if we’ve dirtied it?  Also, AFAICT no one
    ever sets isDatabaseCacheDirty to false, meaning once one database is
    created the cache will never be updated.  Am I missing something?

View raw message