@@ -37,41 +37,41 @@ class FileStreamSinkLogSuite extends SparkFunSuite with SharedSQLContext {
3737 }
3838
3939 test(" isCompactionBatch" ) {
40- assert(false === isCompactionBatch(0 , compactLength = 3 ))
41- assert(false === isCompactionBatch(1 , compactLength = 3 ))
42- assert(true === isCompactionBatch(2 , compactLength = 3 ))
43- assert(false === isCompactionBatch(3 , compactLength = 3 ))
44- assert(false === isCompactionBatch(4 , compactLength = 3 ))
45- assert(true === isCompactionBatch(5 , compactLength = 3 ))
40+ assert(false === isCompactionBatch(0 , compactInterval = 3 ))
41+ assert(false === isCompactionBatch(1 , compactInterval = 3 ))
42+ assert(true === isCompactionBatch(2 , compactInterval = 3 ))
43+ assert(false === isCompactionBatch(3 , compactInterval = 3 ))
44+ assert(false === isCompactionBatch(4 , compactInterval = 3 ))
45+ assert(true === isCompactionBatch(5 , compactInterval = 3 ))
4646 }
4747
4848 test(" getValidBatchesBeforeCompactionBatch" ) {
4949 intercept[AssertionError ] {
50- getValidBatchesBeforeCompactionBatch(0 , compactLength = 3 )
50+ getValidBatchesBeforeCompactionBatch(0 , compactInterval = 3 )
5151 }
5252 intercept[AssertionError ] {
53- getValidBatchesBeforeCompactionBatch(1 , compactLength = 3 )
53+ getValidBatchesBeforeCompactionBatch(1 , compactInterval = 3 )
5454 }
55- assert(Seq (0 , 1 ) === getValidBatchesBeforeCompactionBatch(2 , compactLength = 3 ))
55+ assert(Seq (0 , 1 ) === getValidBatchesBeforeCompactionBatch(2 , compactInterval = 3 ))
5656 intercept[AssertionError ] {
57- getValidBatchesBeforeCompactionBatch(3 , compactLength = 3 )
57+ getValidBatchesBeforeCompactionBatch(3 , compactInterval = 3 )
5858 }
5959 intercept[AssertionError ] {
60- getValidBatchesBeforeCompactionBatch(4 , compactLength = 3 )
60+ getValidBatchesBeforeCompactionBatch(4 , compactInterval = 3 )
6161 }
62- assert(Seq (2 , 3 , 4 ) === getValidBatchesBeforeCompactionBatch(5 , compactLength = 3 ))
62+ assert(Seq (2 , 3 , 4 ) === getValidBatchesBeforeCompactionBatch(5 , compactInterval = 3 ))
6363 }
6464
6565 test(" getAllValidBatches" ) {
66- assert(Seq (0 ) === getAllValidBatches(0 , compactLength = 3 ))
67- assert(Seq (0 , 1 ) === getAllValidBatches(1 , compactLength = 3 ))
68- assert(Seq (2 ) === getAllValidBatches(2 , compactLength = 3 ))
69- assert(Seq (2 , 3 ) === getAllValidBatches(3 , compactLength = 3 ))
70- assert(Seq (2 , 3 , 4 ) === getAllValidBatches(4 , compactLength = 3 ))
71- assert(Seq (5 ) === getAllValidBatches(5 , compactLength = 3 ))
72- assert(Seq (5 , 6 ) === getAllValidBatches(6 , compactLength = 3 ))
73- assert(Seq (5 , 6 , 7 ) === getAllValidBatches(7 , compactLength = 3 ))
74- assert(Seq (8 ) === getAllValidBatches(8 , compactLength = 3 ))
66+ assert(Seq (0 ) === getAllValidBatches(0 , compactInterval = 3 ))
67+ assert(Seq (0 , 1 ) === getAllValidBatches(1 , compactInterval = 3 ))
68+ assert(Seq (2 ) === getAllValidBatches(2 , compactInterval = 3 ))
69+ assert(Seq (2 , 3 ) === getAllValidBatches(3 , compactInterval = 3 ))
70+ assert(Seq (2 , 3 , 4 ) === getAllValidBatches(4 , compactInterval = 3 ))
71+ assert(Seq (5 ) === getAllValidBatches(5 , compactInterval = 3 ))
72+ assert(Seq (5 , 6 ) === getAllValidBatches(6 , compactInterval = 3 ))
73+ assert(Seq (5 , 6 , 7 ) === getAllValidBatches(7 , compactInterval = 3 ))
74+ assert(Seq (8 ) === getAllValidBatches(8 , compactInterval = 3 ))
7575 }
7676
7777 test(" compactLogs" ) {
@@ -124,7 +124,7 @@ class FileStreamSinkLogSuite extends SparkFunSuite with SharedSQLContext {
124124 }
125125
126126 test(" batchIdToPath" ) {
127- withSQLConf(SQLConf .FILE_STREAM_SINK_LOG_COMPACT_LEN .key -> " 3" ) {
127+ withSQLConf(SQLConf .FILE_SINK_LOG_COMPACT_INTERVAL .key -> " 3" ) {
128128 withFileStreamSinkLog { sinkLog =>
129129 assert(" 0" === sinkLog.batchIdToPath(0 ).getName)
130130 assert(" 1" === sinkLog.batchIdToPath(1 ).getName)
@@ -137,32 +137,31 @@ class FileStreamSinkLogSuite extends SparkFunSuite with SharedSQLContext {
137137 }
138138
139139 test(" compact" ) {
140- withSQLConf(SQLConf .FILE_STREAM_SINK_LOG_COMPACT_LEN .key -> " 3" ) {
140+ withSQLConf(SQLConf .FILE_SINK_LOG_COMPACT_INTERVAL .key -> " 3" ) {
141141 withFileStreamSinkLog { sinkLog =>
142142 for (batchId <- 0 to 10 ) {
143143 sinkLog.add(
144144 batchId,
145145 Seq (SinkFileStatus (" /a/b/" + batchId, 100L , FileStreamSinkLog .ADD_ACTION )))
146- assert(sinkLog.allFiles() == = (0 to batchId).map {
146+ val expectedFiles = (0 to batchId).map {
147147 id => SinkFileStatus (" /a/b/" + id, 100L , FileStreamSinkLog .ADD_ACTION )
148- })
148+ }
149+ assert(sinkLog.allFiles() === expectedFiles)
149150 if (isCompactionBatch(batchId, 3 )) {
150151 // Since batchId is a compaction batch, the batch log file should contain all logs
151- assert(sinkLog.get(batchId).getOrElse(Nil ) === (0 to batchId).map {
152- id => SinkFileStatus (" /a/b/" + id, 100L , FileStreamSinkLog .ADD_ACTION )
153- })
152+ assert(sinkLog.get(batchId).getOrElse(Nil ) === expectedFiles)
154153 }
155154 }
156155 }
157156 }
158157 }
159158
160159 test(" delete expired file" ) {
161- // Set FILE_STREAM_SINK_LOG_EXPIRED_TIME to 0 so that we can detect the deleting behaviour
160+ // Set FILE_SINK_LOG_CLEANUP_DELAY to 0 so that we can detect the deleting behaviour
162161 // deterministically
163162 withSQLConf(
164- SQLConf .FILE_STREAM_SINK_LOG_COMPACT_LEN .key -> " 3" ,
165- SQLConf .FILE_STREAM_SINK_LOG_EXPIRED_TIME .key -> " 0" ) {
163+ SQLConf .FILE_SINK_LOG_COMPACT_INTERVAL .key -> " 3" ,
164+ SQLConf .FILE_SINK_LOG_CLEANUP_DELAY .key -> " 0" ) {
166165 withFileStreamSinkLog { sinkLog =>
167166 val metadataPath = new File (sinkLog.metadataPath.toUri.toString)
168167
0 commit comments