Skip to content

Commit

Permalink
add a trace log line (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
tpetracca authored and leonz committed Jul 18, 2019
1 parent 36d74a3 commit f859494
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public RowIndexEntry append(AbstractCompactedRow row)
boolean save = false;
for (SSTableReader reader : transaction.originals())
{
if (reader.getCachedPosition(row.key, false) != null)
if (reader.getCachedPosition(row.key, false, true) != null)
{
save = true;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1540,11 +1540,33 @@ public void cacheKey(DecoratedKey key, RowIndexEntry info)

public RowIndexEntry getCachedPosition(DecoratedKey key, boolean updateStats)
{
return getCachedPosition(new KeyCacheKey(metadata.ksAndCFName, descriptor, key.getKey()), updateStats);
return getCachedPosition(key, updateStats, false);
}

public RowIndexEntry getCachedPosition(DecoratedKey key, boolean updateStats, boolean isSstableRewrite)
{
return getCachedPosition(
new KeyCacheKey(metadata.ksAndCFName, descriptor, key.getKey()),
updateStats,
isSstableRewrite);
}

protected RowIndexEntry getCachedPosition(KeyCacheKey unifiedKey, boolean updateStats)
{
return getCachedPosition(unifiedKey, updateStats, false);
}

protected RowIndexEntry getCachedPosition(KeyCacheKey unifiedKey, boolean updateStats, boolean isSstableRewrite)
{
//Lock contention in the cache causes unnecessary overhead during compactions that slows the overall compaction
//speed to a crawl. We don't need to update the cache on the basis of values read during a compaction anyway
//because they don't represent real read load.
if (isSstableRewrite && Boolean.getBoolean("palantir_cassandra.disable_sstablerewrite_keycache"))
{
logger.trace("Not returning cached position of row for SSTable rewrite");
return null;
}

if (keyCache != null && keyCache.getCapacity() > 0 && metadata.getCaching().keyCache.isEnabled()) {
if (updateStats)
{
Expand Down

0 comments on commit f859494

Please sign in to comment.