public FileListCacheKey(String indexName, final int affinitySegmentId) { this.indexName = indexName; this.affinitySegmentId = affinitySegmentId; this.hashCode = generatedHashCode(); }
public SingleChunkIndexInput(final IndexInputContext iic) { super(iic.fileKey.getFileName()); ChunkCacheKey key = new ChunkCacheKey(iic.fileKey.getIndexName(), iic.fileKey.getFileName(), 0, iic.fileMetadata.getBufferSize(), iic.affinitySegmentId); byte[] b = (byte[]) iic.chunksCache.get(key); if (b == null) { buffer = new byte[0]; } else { buffer = b; } bufferPosition = 0; }
@Override public void cacheManagerStarting(GlobalComponentRegistry gcr, GlobalConfiguration globalCfg) { Map<Integer,AdvancedExternalizer<?>> externalizerMap = globalCfg.serialization().advancedExternalizers(); externalizerMap.put(ExternalizerIds.CHUNK_CACHE_KEY, new ChunkCacheKey.Externalizer()); externalizerMap.put(ExternalizerIds.FILE_CACHE_KEY, new FileCacheKey.Externalizer()); externalizerMap.put(ExternalizerIds.FILE_LIST_CACHE_KEY, new FileListCacheKey.Externalizer()); externalizerMap.put(ExternalizerIds.FILE_METADATA, new FileMetadata.Externalizer()); externalizerMap.put(ExternalizerIds.FILE_READLOCK_KEY, new FileReadLockKey.Externalizer()); }
private void setBufferToCurrentChunkIfPossible() { ChunkCacheKey key = new ChunkCacheKey(fileKey.getIndexName(), filename, currentLoadedChunk, chunkSize); buffer = (byte[]) chunksCache.get(key); if (buffer == null) { currentLoadedChunk--; bufferPosition = chunkSize; } else { currentBufferSize = buffer.length; } }
public void testReadLockEqualsWithNullOrNotEqualObj() { FileReadLockKey key = new FileReadLockKey("poems and songs, 3000AC-2000DC", "brushed steel lock", -1); AssertJUnit.assertNotNull(key); AssertJUnit.assertFalse(new FileReadLockKey("poems and songs, 3000AC-2000DC", "brushed lock", -1) .equals(mapper.getKeyMapping("RL|brushed steel lock|poems and songs, 3000AC-2000DC|-1"))); }
@Test public void testFileCacheKeyExternalizer() throws IOException { FileCacheKey key = new FileCacheKey("myIndex", "fileA.idx", 7); verifyExternalizerForType(key, FileCacheKey.Externalizer.class); }
@Test public void testFileReadLockKeyExternalizer() throws IOException { FileReadLockKey key = new FileReadLockKey("myIndex", "index.lock", 7); verifyExternalizerForType(key, FileReadLockKey.Externalizer.class); }
/** * Lucene 5 creates temporary "pending_segments_n" files during commit that get renamed to "segment_n", and since the * NoopSegmentReadLocker never deletes files, some garbage are left behind */ void verifyIgnoringFiles(Cache cache,Set<String> ignoring) { DirectoryIntegrityCheck.verifyDirectoryStructure(cache, INDEX_NAME, ignoring); }
@Override public Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command) throws Throwable { return handleDefaultCheckingAssertion(ctx, command); }
protected InfinispanDirectoryThread(CountDownLatch latch, Directory dir, boolean isWritingThread) throws Exception { this.latch = latch; this.dir = dir; this.isWritingThread = isWritingThread; document = CacheTestSupport.createDummyDocToIndex("document.lucene", 10000); }
@Override protected void createCacheManagers() { startClusterNode(); startClusterNode(); }
void assertFileNotExists(String fileName) throws InterruptedException { DirectoryIntegrityCheck.assertFileNotExists(cache0, INDEX_NAME, fileName, 10000L, -1); DirectoryIntegrityCheck.assertFileNotExists(cache1, INDEX_NAME, fileName, 10000L, -1); }
void assertFileExistsHavingRLCount(String fileName, int expectedReadcount, boolean expectRegisteredInFat) { DirectoryIntegrityCheck.assertFileExistsHavingRLCount(cache0, fileName, INDEX_NAME, expectedReadcount, CHUNK_SIZE, expectRegisteredInFat, -1); DirectoryIntegrityCheck.assertFileExistsHavingRLCount(cache1, fileName, INDEX_NAME, expectedReadcount, CHUNK_SIZE, expectRegisteredInFat, -1); }
public SingleChunkIndexInput(final IndexInputContext iic) { super(iic.fileKey.getFileName()); ChunkCacheKey key = new ChunkCacheKey(iic.fileKey.getIndexName(), iic.fileKey.getFileName(), 0, iic.fileMetadata.getBufferSize(), iic.affinitySegmentId); byte[] b = (byte[]) iic.chunksCache.get(key); if (b == null) { buffer = Util.EMPTY_BYTE_ARRAY; } else { buffer = b; } bufferPosition = 0; }
public FileListCacheKey(String indexName, final int affinitySegmentId) { this.indexName = indexName; this.affinitySegmentId = affinitySegmentId; this.hashCode = generatedHashCode(); }
@Override public Object visitPutMapCommand(InvocationContext ctx, PutMapCommand command) throws Throwable { return handleDefaultCheckingAssertion(ctx, command); }
public SingleChunkIndexInput(final IndexInputContext iic) { super(iic.fileKey.getFileName()); ChunkCacheKey key = new ChunkCacheKey(iic.fileKey.getIndexName(), iic.fileKey.getFileName(), 0, iic.fileMetadata.getBufferSize()); byte[] b = (byte[]) iic.chunksCache.get(key); if (b == null) { buffer = new byte[0]; } else { buffer = b; } bufferPosition = 0; }