Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
Add more inotify and file access report log for trouble shutting
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenSammi committed Jul 16, 2017
1 parent 3faf5b9 commit 8626d0e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion conf/log4j.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ log4j.appender.RFA.MaxBackupIndex=${smart.log.maxbackupindex}
log4j.appender.RFA.layout=org.apache.log4j.PatternLayout

# Pattern format: Date LogLevel LoggerName LogMessage
log4j.appender.RFA.layout.ConversionPattern=%d{ISO8601} %p %c: %m%n
log4j.appender.RFA.layout.ConversionPattern=%d{ISO8601} %p %c.%M %L: %m%n
# Debugging Pattern format
#log4j.appender.RFA.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,29 @@ public void apply(Event[] events) throws IOException, MetaStoreException {
private List<String> getSqlStatement(Event event) throws IOException, MetaStoreException {
switch (event.getEventType()) {
case CREATE:
LOG.trace("event type:" + event.getEventType().name() +
", path:" + ((Event.CreateEvent)event).getPath());
return Arrays.asList(this.getCreateSql((Event.CreateEvent)event));
case CLOSE:
LOG.trace("event type:" + event.getEventType().name() +
", path:" + ((Event.CloseEvent)event).getPath());
return Arrays.asList(this.getCloseSql((Event.CloseEvent)event));
// case TRUNCATE:
// return this.getTruncateSql((Event.TruncateEvent)event);
case RENAME:
LOG.trace("event type:" + event.getEventType().name() +
", src path:" + ((Event.RenameEvent)event).getSrcPath() +
", dest path:" + ((Event.RenameEvent)event).getDstPath());
return this.getRenameSql((Event.RenameEvent)event);
case METADATA:
LOG.trace("event type:" + event.getEventType().name() +
", path:" + ((Event.MetadataUpdateEvent)event).getPath());
return Arrays.asList(this.getMetaDataUpdateSql((Event.MetadataUpdateEvent)event));
case APPEND:
LOG.trace("event type:" + event.getEventType().name() +
", path:" + ((Event.AppendEvent)event).getPath());
return this.getAppendSql((Event.AppendEvent)event);
case UNLINK:
LOG.trace("event type:" + event.getEventType().name() +
", path:" + ((Event.UnlinkEvent)event).getPath());
return this.getUnlinkSql((Event.UnlinkEvent)event);
}
return Arrays.asList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.smartdata.metastore.MetaStoreException;

import java.io.IOException;
import java.util.Date;
import java.util.concurrent.atomic.AtomicLong;

public class InotifyFetchAndApplyTask implements Runnable {
Expand All @@ -44,6 +45,7 @@ public InotifyFetchAndApplyTask(DFSClient client, InotifyEventApplier applier, l

@Override
public void run() {
LOG.trace("InotifyFetchAndApplyTask run at " + new Date());
try {
EventBatch eventBatch = inotifyEventInputStream.poll();
while (eventBatch != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public FileAccessEventCollector getCollector() {
public void insertEventFromSmartClient(FileAccessEvent event) {
try {
this.eventQueue.put(event);
LOG.trace("Access:" + event.getPath());
} catch (InterruptedException e) {
LOG.error("Event queue enqueue path={} error", event.getPath(), e);
}
Expand Down

0 comments on commit 8626d0e

Please sign in to comment.