[ https://issues.apache.org/jira/browse/GOBBLIN-1034?focusedWorklogId=379065&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-379065 ]
ASF GitHub Bot logged work on GOBBLIN-1034: ------------------------------------------- Author: ASF GitHub Bot Created on: 29/Jan/20 22:45 Start Date: 29/Jan/20 22:45 Worklog Time Spent: 10m Work Description: aplex commented on pull request #2876: GOBBLIN-1034: Ensure underlying writers are expired from the Partitio… URL: https://github.com/apache/incubator-gobblin/pull/2876#discussion_r372672919 ########## File path: gobblin-core/src/test/java/org/apache/gobblin/writer/PartitionedWriterTest.java ########## @@ -176,4 +165,31 @@ public void testControlMessageHandler() throws IOException { writer.close(); } + + @Test + public void testPartitionWriterCacheRemovalListener() + throws IOException, InterruptedException { + State state = new State(); + state.setProp(ConfigurationKeys.WRITER_PARTITIONER_CLASS, TestPartitioner.class.getCanonicalName()); + state.setProp(PartitionedDataWriter.PARTITIONED_WRITER_CACHE_TTL_SECONDS, 1); + TestPartitionAwareWriterBuilder builder = new TestPartitionAwareWriterBuilder(); + + PartitionedDataWriter writer = new PartitionedDataWriter<String, String>(builder, state); + + String record1 = "abc"; + writer.writeEnvelope(new RecordEnvelope(record1)); + + String record2 = "123"; + writer.writeEnvelope(new RecordEnvelope(record2)); + + //Sleep for more than cache expiration interval + Thread.sleep(1500); Review comment: Is there a way to test this without Thread.sleep, e.g. with some virtual time or by explicitly triggering expiration? Using sleeps can slow down the test suite, and also make it flakey. For example, if the tests are running on overloaded Tracis CI machine, the cache timer that normally runs every second, can run every 3rd second, and the test will randomly fail. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 379065) Time Spent: 1h (was: 50m) > Ensure underlying writers are expired from the PartitionedDataWriter cache to > avoid accumulation of writers for long running Gobblin jobs > ----------------------------------------------------------------------------------------------------------------------------------------- > > Key: GOBBLIN-1034 > URL: https://issues.apache.org/jira/browse/GOBBLIN-1034 > Project: Apache Gobblin > Issue Type: Improvement > Components: gobblin-core > Affects Versions: 0.15.0 > Reporter: Sudarshan Vasudevan > Assignee: Abhishek Tiwari > Priority: Major > Fix For: 0.15.0 > > Time Spent: 1h > Remaining Estimate: 0h > > Currently, the underlying writers are never evicted from the > PartitionedDataWriter cache. For long running Gobblin jobs (e.g. streaming), > this will cause a memory leak particularly if the underlying writers maintain > state. -- This message was sent by Atlassian Jira (v8.3.4#803005)