-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-6076][Block Manager] Fix a potential OOM issue when StorageLevel is MEMORY_AND_DISK_SER #4827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-6076][Block Manager] Fix a potential OOM issue when StorageLevel is MEMORY_AND_DISK_SER #4827
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -170,8 +170,8 @@ class BlockManagerSuite extends FunSuite with Matchers with BeforeAndAfterEach | |
| assert(master.getLocations("a3").size === 0, "master was told about a3") | ||
|
|
||
| // Drop a1 and a2 from memory; this should be reported back to the master | ||
| store.dropFromMemory("a1", null) | ||
| store.dropFromMemory("a2", null) | ||
| store.dropFromMemory("a1", null: Either[Array[Any], ByteBuffer]) | ||
| store.dropFromMemory("a2", null: Either[Array[Any], ByteBuffer]) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah, looks like the alias caused compilation issues if we just pass in a null value. This is unfortunate.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. But I think we only use
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe so. |
||
| assert(store.getSingle("a1") === None, "a1 not removed from store") | ||
| assert(store.getSingle("a2") === None, "a2 not removed from store") | ||
| assert(master.getLocations("a1").size === 0, "master did not remove a1") | ||
|
|
@@ -413,8 +413,8 @@ class BlockManagerSuite extends FunSuite with Matchers with BeforeAndAfterEach | |
| t2.join() | ||
| t3.join() | ||
|
|
||
| store.dropFromMemory("a1", null) | ||
| store.dropFromMemory("a2", null) | ||
| store.dropFromMemory("a1", null: Either[Array[Any], ByteBuffer]) | ||
| store.dropFromMemory("a2", null: Either[Array[Any], ByteBuffer]) | ||
| store.waitForAsyncReregister() | ||
| } | ||
| } | ||
|
|
@@ -1221,4 +1221,30 @@ class BlockManagerSuite extends FunSuite with Matchers with BeforeAndAfterEach | |
| assert(unrollMemoryAfterB6 === unrollMemoryAfterB4) | ||
| assert(unrollMemoryAfterB7 === unrollMemoryAfterB4) | ||
| } | ||
|
|
||
| test("lazily create a big ByteBuffer to avoid OOM if it cannot be put into MemoryStore") { | ||
| store = makeBlockManager(12000) | ||
| val memoryStore = store.memoryStore | ||
| val blockId = BlockId("rdd_3_10") | ||
| val result = memoryStore.putBytes(blockId, 13000, () => { | ||
| fail("A big ByteBuffer that cannot be put into MemoryStore should not be created") | ||
| }) | ||
| assert(result.size === 13000) | ||
| assert(result.data === null) | ||
| assert(result.droppedBlocks === Nil) | ||
| } | ||
|
|
||
| test("put a small ByteBuffer to MemoryStore") { | ||
| store = makeBlockManager(12000) | ||
| val memoryStore = store.memoryStore | ||
| val blockId = BlockId("rdd_3_10") | ||
| var bytes: ByteBuffer = null | ||
| val result = memoryStore.putBytes(blockId, 10000, () => { | ||
| bytes = ByteBuffer.allocate(10000) | ||
| bytes | ||
| }) | ||
| assert(result.size === 10000) | ||
| assert(result.data === Right(bytes)) | ||
| assert(result.droppedBlocks === Nil) | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of duplicating the javadocs here I would just refer to the other method. I can fix this when I merge don't worry.