Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
public class RetinaServerImpl extends RetinaWorkerServiceGrpc.RetinaWorkerServiceImplBase
{
private static final Logger logger = LogManager.getLogger(RetinaServerImpl.class);

private final MetadataService metadataService;
private final IndexService indexService;
private final RetinaResourceManager retinaResourceManager;
Expand Down
12 changes: 12 additions & 0 deletions pixels-daemon/src/main/resources/log4j2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,15 @@ appender.rolling.layout.pattern = %-d{yyyy-MM-dd HH:mm:ss,SSS} [%c]-[%p] %m%n
rootLogger.level = info
rootLogger.appenderRef.stdout.ref = STDOUT
rootLogger.appenderRef.log.ref = log

appender.index.type = File
appender.index.name = INDEX_OUT
appender.index.fileName = ${env:PIXELS_HOME}/logs/index.trace
appender.index.append = true
appender.index.layout.type = PatternLayout
appender.index.layout.pattern = %m%n

logger.index.name = index
logger.index.level = info
logger.index.additivity = false
logger.index.appenderRef.index.ref = INDEX_OUT
13 changes: 13 additions & 0 deletions pixels-index/pixels-index-rocksdb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,19 @@
<artifactId>grpc-stub</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<!-- this is only for third-party libs that use slf4j -->
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<!-- this is only for third-party libs that use log4j-1 -->
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<optional>true</optional>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import io.pixelsdb.pixels.index.IndexProto;
import org.apache.commons.io.FileUtils;
import org.rocksdb.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.IOException;
Expand All @@ -40,6 +42,8 @@
*/
public class RocksDBIndex implements SinglePointIndex
{
private static final Logger indexLogger = LoggerFactory.getLogger("index");

private final RocksDB rocksDB;
private final String rocksDBPath;
private final WriteOptions writeOptions;
Expand Down Expand Up @@ -166,6 +170,12 @@ public boolean putEntry(IndexProto.IndexKey key, long rowId) throws SinglePointI
ByteBuffer nonUniqueKeyBuffer = toNonUniqueKeyBuffer(key, rowId);
rocksDB.put(writeOptions, nonUniqueKeyBuffer, EMPTY_VALUE_BUFFER);
}
indexLogger.info("P\t{}\t{}\t{}\t{}\t{}",
tableId,
indexId,
key.getKey().asReadOnlyByteBuffer().getInt(),
key.getTimestamp(),
rowId);
return true;
}
catch (RocksDBException e)
Expand All @@ -187,6 +197,13 @@ public boolean putPrimaryEntries(List<IndexProto.PrimaryIndexEntry> entries) thr
ByteBuffer valueBuffer = RocksDBThreadResources.getValueBuffer();
valueBuffer.putLong(rowId).position(0);
writeBatch.put(keyBuffer, valueBuffer);
indexLogger.info("P\t{}\t{}\t{}\t{}\t{}",
tableId,
indexId,
entry.getIndexKey().getKey().asReadOnlyByteBuffer().getInt(),
entry.getIndexKey().getTimestamp(),
entry.getRowId()
);
}
rocksDB.write(writeOptions, writeBatch);
return true;
Expand Down Expand Up @@ -238,6 +255,13 @@ public long updatePrimaryEntry(IndexProto.IndexKey key, long rowId) throws Singl
ByteBuffer valueBuffer = RocksDBThreadResources.getValueBuffer();
valueBuffer.putLong(rowId).position(0);
rocksDB.put(writeOptions, keyBuffer, valueBuffer);
indexLogger.info("U\t{}\t{}\t{}\t{}\t{}",
tableId,
indexId,
key.getKey().asReadOnlyByteBuffer().getInt(),
key.getTimestamp(),
rowId
);
return prevRowId;
}
catch (RocksDBException e)
Expand Down Expand Up @@ -289,6 +313,13 @@ public List<Long> updatePrimaryEntries(List<IndexProto.PrimaryIndexEntry> entrie
ByteBuffer valueBuffer = RocksDBThreadResources.getValueBuffer();
valueBuffer.putLong(rowId).position(0);
writeBatch.put(keyBuffer, valueBuffer);
indexLogger.info("U\t{}\t{}\t{}\t{}\t{}",
tableId,
indexId,
key.getKey().asReadOnlyByteBuffer().getInt(),
key.getTimestamp(),
rowId
);
}
rocksDB.write(writeOptions, writeBatch);
return builder.build();
Expand Down Expand Up @@ -399,6 +430,11 @@ public List<Long> deleteEntries(List<IndexProto.IndexKey> keys) throws SinglePoi
// Delete single point index
for(IndexProto.IndexKey key : keys)
{
indexLogger.info("D\t{}\t{}\t{}\t{}",
tableId,
indexId,
key.getKey().asReadOnlyByteBuffer().getInt(),
key.getTimestamp());
if(unique)
{
long rowId = getUniqueRowId(key);
Expand Down