Skip to content

Commit

Permalink
[CARBONDATA-2784][CARBONDATA-2786][SDK writer] Fixed:Forever blocking…
Browse files Browse the repository at this point in the history
… wait with more than 21 batch of data

problem: [CARBONDATA-2784]
[SDK writer] Forever blocking wait with more than 21 batch of data, when consumer is dead due to data loading exception (bad record / out of memory)

root cause:
When the consumer is dead due to data loading exception, writer will be forcefully closed. but queue.clear() cleared only snapshot of entries (10 batches) and close is set to true after that. In between clear() and close = true, If more than 10 batches of data is again put into queue. For 11th batch, queue.put() goes for forever block as consumer is dead.

Solution:
set close = true, before clearing the queue. This will avoid adding more batches to queue from write().

problem [CARBONDATA-2786] NPE when SDK writer tries to write a file

solution and cause:
apache#2387 , in CarbonProperties.java
After systemLocation = getStorePath(); Null validation missing for systemLocation.
because this can be null in SDK case. As Store location is not applicable for SDK.
All a null validation.

This closes apache#2561
  • Loading branch information
ajantha-bhat authored and sgururajshetty committed Aug 2, 2018
1 parent 0f1aabb commit 9b05edb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1532,8 +1532,10 @@ public String getSystemFolderLocation() {
if (systemLocation == null) {
systemLocation = getStorePath();
}
systemLocation = CarbonUtil.checkAndAppendFileSystemURIScheme(systemLocation);
systemLocation = FileFactory.getUpdatedFilePath(systemLocation);
if (systemLocation != null) {
systemLocation = CarbonUtil.checkAndAppendFileSystemURIScheme(systemLocation);
systemLocation = FileFactory.getUpdatedFilePath(systemLocation);
}
return systemLocation + CarbonCommonConstants.FILE_SEPARATOR + "_system";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,13 @@ public void closeWriter(boolean isForceClose) {
}
try {
if (isForceClose) {
// unblock the queue.put on the other thread and clear the queue.
queue.clear();
// first make close is set to true, when force close happens because of dead consumer.
// so that, write() method will stop taking input rows.
close = true;
// once write() method stops taking input rows, clear the queue.
// If queue is cleared before close is set to true, then queue will be again filled
// by .write() and it can go to blocking put() forever as consumer is dead.
queue.clear();
return;
}
// below code will ensure that the last RowBatch is consumed properly
Expand Down

0 comments on commit 9b05edb

Please sign in to comment.