File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
main/java/com/marklogic/spark/writer
test/java/com/marklogic/spark/writer Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -228,7 +228,9 @@ private ZipFileWriter createArchiveWriter(SerializableConfiguration hadoopConfig
228
228
229
229
private void closeArchiveWriter () {
230
230
if (archiveWriter != null ) {
231
- Util .MAIN_LOGGER .info ("Wrote failed documents to archive file at {}." , archiveWriter .getZipPath ());
231
+ if (failedItemCount .get () > 0 ) {
232
+ Util .MAIN_LOGGER .info ("Wrote failed documents to archive file at {}." , archiveWriter .getZipPath ());
233
+ }
232
234
archiveWriter .close ();
233
235
}
234
236
}
Original file line number Diff line number Diff line change 21
21
import java .util .Map ;
22
22
import java .util .concurrent .atomic .AtomicInteger ;
23
23
24
- import static org .junit .jupiter .api .Assertions .*;
24
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
25
+ import static org .junit .jupiter .api .Assertions .assertTrue ;
25
26
26
27
class WriteArchiveOfFailedDocumentsTest extends AbstractWriteTest {
27
28
@@ -64,6 +65,18 @@ void happyPath(@TempDir Path tempDir) {
64
65
verifyArchiveRows (rows );
65
66
}
66
67
68
+ @ Test
69
+ void noFailures (@ TempDir Path tempDir ) {
70
+ newWriter (1 )
71
+ .option (Options .WRITE_ABORT_ON_FAILURE , false )
72
+ .option (Options .WRITE_ARCHIVE_PATH_FOR_FAILED_DOCUMENTS , tempDir .toFile ().getAbsolutePath ())
73
+ .save ();
74
+
75
+ assertCollectionSize ("This test is for manual inspection of the logs to ensure that no message is " +
76
+ "logged indicating that an archive file of failed documents was written when there are no errors." ,
77
+ COLLECTION , 200 );
78
+ }
79
+
67
80
@ Test
68
81
void multiplePartitions (@ TempDir Path tempDir ) {
69
82
defaultWrite (newSparkSession ().read ().format (CONNECTOR_IDENTIFIER )
You can’t perform that action at this time.
0 commit comments