cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Pyykkö <daniel.pyy...@sitevision.se>
Subject Incorrect override of manifest.json?
Date Thu, 16 Apr 2015 13:29:16 GMT
Hi all,

In Cassandra 2.1.3 the code below is located in the class CassandraFamilyStore.java which
is called when you do a snapshot. What I can se happens is that it first creates a snapshot
manifest file correctly for a column family but than the loop returns a index which overrides
the data that was written in the first iteration. Isn´t the code incorrect and the JSONArray
should be located before the outer for-loop or some other solution so it does´t override
content that has once been written?

From the call "concatWithIndexes()" I see it returns [CFS(Keyspace=’X', ColumnFamily='tempState'),
CFS(Keyspace=’X', ColumnFamily='tempState.tempState_current_idx’)] and the first iteration
writes correct data to the manifest.json and the second iteration overrides the data with
a empty "filesJSONArr”.

Can somebody please confirm if this is a bug, or if I should write one?


//Kind Regards, Daniel



public void snapshotWithoutFlush(String snapshotName, Predicate<SSTableReader> predicate)
    {
        for (ColumnFamilyStore cfs : concatWithIndexes())
        {
            final JSONArray filesJSONArr = new JSONArray();
            try (RefViewFragment currentView = cfs.selectAndReference(ALL_SSTABLES))
            {
                for (SSTableReader ssTable : currentView.sstables)
                {
                    if (ssTable.openReason == SSTableReader.OpenReason.EARLY || (predicate
!= null && !predicate.apply(ssTable)))
                    {
                        continue;
                    }

                    File snapshotDirectory = Directories.getSnapshotDirectory(ssTable.descriptor,
snapshotName);
                    ssTable.createLinks(snapshotDirectory.getPath()); // hard links
                    filesJSONArr.add(ssTable.descriptor.relativeFilenameFor(Component.DATA));
                    if (logger.isDebugEnabled())
                        logger.debug("Snapshot for {} keyspace data file {} created in {}",
keyspace, ssTable.getFilename(), snapshotDirectory);
                }

                writeSnapshotManifest(filesJSONArr, snapshotName);
            }
        }
    }
Mime
View raw message