You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Mikhail Stepura (JIRA)" <ji...@apache.org> on 2013/12/04 07:29:35 UTC

[jira] [Comment Edited] (CASSANDRA-6413) Saved KeyCache prints success to log; but no file present

    [ https://issues.apache.org/jira/browse/CASSANDRA-6413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13838642#comment-13838642 ] 

Mikhail Stepura edited comment on CASSANDRA-6413 at 12/4/13 6:29 AM:
---------------------------------------------------------------------

Silly me :) The bug is so obvious, but only manifests itself if both Key cache AND row cache are enabled

{code:title=org.apache.cassandra.cache.AutoSavingCache.java|borderStyle=solid}
        private void deleteOldCacheFiles()
        {
            File savedCachesDir = new File(DatabaseDescriptor.getSavedCachesLocation());

            if (savedCachesDir.exists() && savedCachesDir.isDirectory())
            {
                for (File file : savedCachesDir.listFiles())
                {
                    if (file.isFile() && file.getName().endsWith(cacheType.toString()))
                    {
                        if (!file.delete())
                            logger.warn("Failed to delete {}", file.getAbsolutePath());
                    }

                    if (file.isFile() && file.getName().endsWith(CURRENT_VERSION + ".db"))
                    {
                        if (!file.delete())
                            logger.warn("Failed to delete {}", file.getAbsolutePath());
                    }
                }
            }
        }
{code}

So, each cache deletes FILES FROM ALL CACHES from the {{saved_caches}} and then happily writes its files.
The last save wins, 


was (Author: mishail):
Silly me :) The bug is so obvious, but only manifests itself if both Key cache AND row cache are enabled

{code:title=org.apache.cassandra.cache.AutoSavingCache.java|borderStyle=solid}
        private void deleteOldCacheFiles()
        {
            File savedCachesDir = new File(DatabaseDescriptor.getSavedCachesLocation());

            if (savedCachesDir.exists() && savedCachesDir.isDirectory())
            {
                for (File file : savedCachesDir.listFiles())
                {
                    if (file.isFile() && file.getName().endsWith(cacheType.toString()))
                    {
                        if (!file.delete())
                            logger.warn("Failed to delete {}", file.getAbsolutePath());
                    }

                    if (file.isFile() && file.getName().endsWith(CURRENT_VERSION + ".db"))
                    {
                        if (!file.delete())
                            logger.warn("Failed to delete {}", file.getAbsolutePath());
                    }
                }
            }
        }
{code}

So, each cache deletes FILES FROM ALL CACHES from the {{saved_caches}} and then happily writes its own single file.
The last save wins, 

> Saved KeyCache prints success to log; but no file present
> ---------------------------------------------------------
>
>                 Key: CASSANDRA-6413
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-6413
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>         Environment: 1.2.11
>            Reporter: Chris Burroughs
>            Assignee: Mikhail Stepura
>
> Cluster has a single keyspace with 3 CFs.  All used to have ROWS_ONLY, two were switched to KEYS_ONLY about 2 days ago.  Row cache continues to save fine, but there is no saved key cache file present on any node in the cluster.
> {noformat}
> 6925: INFO [CompactionExecutor:12] 2013-11-27 10:12:02,284 AutoSavingCache.java (line 289) Saved RowCache (50000 items) in 118 ms
> 6941:DEBUG [CompactionExecutor:14] 2013-11-27 10:17:02,163 AutoSavingCache.java (line 233) Deleting old RowCache files.
> 6942: INFO [CompactionExecutor:14] 2013-11-27 10:17:02,310 AutoSavingCache.java (line 289) Saved RowCache (50000 items) in 146 ms
> 8745:DEBUG [CompactionExecutor:6] 2013-11-27 10:37:25,140 AutoSavingCache.java (line 233) Deleting old RowCache files.
> 8746: INFO [CompactionExecutor:6] 2013-11-27 10:37:25,283 AutoSavingCache.java (line 289) Saved RowCache (50000 items) in 143 ms
> 8747:DEBUG [CompactionExecutor:6] 2013-11-27 10:37:25,283 AutoSavingCache.java (line 233) Deleting old KeyCache files.
> 8748: INFO [CompactionExecutor:6] 2013-11-27 10:37:25,625 AutoSavingCache.java (line 289) Saved KeyCache (21181 items) in 342 ms
> 8749:DEBUG [CompactionExecutor:6] 2013-11-27 10:37:25,625 AutoSavingCache.java (line 233) Deleting old RowCache files.
> 8750: INFO [CompactionExecutor:6] 2013-11-27 10:37:25,759 AutoSavingCache.java (line 289) Saved RowCache (50000 items) in 134 ms
> 8751:DEBUG [CompactionExecutor:6] 2013-11-27 10:37:25,759 AutoSavingCache.java (line 233) Deleting old RowCache files.
> 8752: INFO [CompactionExecutor:6] 2013-11-27 10:37:25,893 AutoSavingCache.java (line 289) Saved RowCache (50000 items) in 133 ms
> 8753:DEBUG [CompactionExecutor:6] 2013-11-27 10:37:25,893 AutoSavingCache.java (line 233) Deleting old RowCache files.
> 8754: INFO [CompactionExecutor:6] 2013-11-27 10:37:26,026 AutoSavingCache.java (line 289) Saved RowCache (50000 items) in 133 ms
> 9915:DEBUG [CompactionExecutor:18] 2013-11-27 10:42:01,851 AutoSavingCache.java (line 233) Deleting old KeyCache files.
> 9916: INFO [CompactionExecutor:18] 2013-11-27 10:42:02,185 AutoSavingCache.java (line 289) Saved KeyCache (22067 items) in 334 ms
> 9917:DEBUG [CompactionExecutor:17] 2013-11-27 10:42:02,279 AutoSavingCache.java (line 233) Deleting old RowCache files.
> 9918: INFO [CompactionExecutor:17] 2013-11-27 10:42:02,411 AutoSavingCache.java (line 289) Saved RowCache (50000 items) in 131 ms
> {noformat}
> {noformat}
> $ ll ~/shared/saved_caches/
> total 3472
> -rw-rw-r-- 1 cassandra cassandra 3551608 Nov 27 10:42 Foo-Bar-RowCache-b.db
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.1#6144)