Skip to content

Commit

Permalink
All throwable errors are logged in write cache
Browse files Browse the repository at this point in the history
  • Loading branch information
laa committed Aug 8, 2016
1 parent 8cea03e commit 88501ed
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 71 deletions.
Expand Up @@ -5,5 +5,5 @@
* write cache.
*/
public interface OBackgroundExceptionListener {
void onException(Exception e);
void onException(Throwable e);
}
Expand Up @@ -226,7 +226,7 @@ public void removeBackgroundExceptionListener(OBackgroundExceptionListener liste
/**
* Fires event about exception is thrown in data flush thread
*/
private void fireBackgroundDataFlushExceptionEvent(Exception e) {
private void fireBackgroundDataFlushExceptionEvent(Throwable e) {
for (WeakReference<OBackgroundExceptionListener> ref : backgroundExceptionListeners) {
final OBackgroundExceptionListener listener = ref.get();
if (listener != null) {
Expand Down Expand Up @@ -1476,7 +1476,7 @@ public void run() {
}
}

} catch (IOException | RuntimeException e) {
} catch (Throwable e) {
OLogManager.instance().error(this, "Exception during data flush", e);
OWOWCache.this.fireBackgroundDataFlushExceptionEvent(e);
} finally {
Expand Down Expand Up @@ -1746,33 +1746,31 @@ public void run() {
try {
OLogSequenceNumber minLsn = findMinLsn(flushedLsn, writeCachePages);
OLogManager.instance().debug(this, "Start fuzzy checkpoint flushed LSN is %s", minLsn);
try {
writeAheadLog.logFuzzyCheckPointStart(minLsn);
writeAheadLog.logFuzzyCheckPointStart(minLsn);

for (int intId : nameIdMap.values()) {
if (intId < 0)
continue;
for (int intId : nameIdMap.values()) {
if (intId < 0)
continue;

final long extFileId = composeFileId(id, intId);
final OClosableEntry<Long, OFileClassic> entry = files.acquire(extFileId);
try {
entry.get().synch();
} finally {
files.release(entry);
}
final long extFileId = composeFileId(id, intId);
final OClosableEntry<Long, OFileClassic> entry = files.acquire(extFileId);
try {
entry.get().synch();
} finally {
files.release(entry);
}
}

writeAheadLog.logFuzzyCheckPointEnd();
writeAheadLog.flush();
writeAheadLog.logFuzzyCheckPointEnd();
writeAheadLog.flush();

if (minLsn.compareTo(new OLogSequenceNumber(-1, -1)) > 0)
writeAheadLog.cutTill(minLsn);
} catch (IOException | RuntimeException e) {
OLogManager.instance().error(this, "Error during fuzzy checkpoint", e);
fireBackgroundDataFlushExceptionEvent(e);
}
if (minLsn.compareTo(new OLogSequenceNumber(-1, -1)) > 0)
writeAheadLog.cutTill(minLsn);

OLogManager.instance().debug(this, "End fuzzy checkpoint");
} catch (Throwable e) {
OLogManager.instance().error(this, "Error during fuzzy checkpoint", e);
fireBackgroundDataFlushExceptionEvent(e);
} finally {
if (statistic != null)
statistic.stopFuzzyCheckpointTimer();
Expand Down

0 comments on commit 88501ed

Please sign in to comment.