You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "amitmittal5 (via GitHub)" <gi...@apache.org> on 2023/11/28 18:55:27 UTC
[I] Parquet file overwritten by spark streaming job in subsequent execution with same spark streaming checkpoint location [iceberg]
amitmittal5 opened a new issue, #9172:
URL: https://github.com/apache/iceberg/issues/9172
### Apache Iceberg version
1.4.2 (latest release)
### Query engine
Spark
### Please describe the bug 🐞
I have a spark streaming job which reads the data from ADLS gen 2 and write to iceberg table as per following steps:
**Step 1: Create the table**
```
CREATE TABLE IF NOT EXISTS default.blob_iceberg
(id string, state string, name string)
USING ICEBERG
LOCATION 'abfss://<container>@<storage-account>.dfs.core.windows.net/test/blob_iceberg'
```
Run a spark streaming scala job with AvailableNow trigger (same behavior with ProcessingTime("10 seconds") trigger):
```
val sourceFilePath = "abfss://<container>@<storage-account>.dfs.core.windows.net/test/source"
val schema = spark.read.format("csv").option("header", "true").load(s"${sourceFilePath}/Sample.txt").schema
val checkpointPath = "abfss://<container>@<storage-account>.dfs.core.windows.net/test/blob_iceberg_checkpoint"
val sourceDF = spark
.readStream
.schema(schema)
.format("csv")
.option("header", "true")
.option("sep",",")
.load(sourceFilePath)
sourceDF
.writeStream
.format("iceberg")
.outputMode("append")
.trigger(Trigger.AvailableNow)
.option("checkpointLocation", checkpointPath)
.toTable("default.blob_iceberg")
```
The behavior observed that for the 1st execution, parquet files are created under data directory in which the parquet files are named like `00000-2-852c47ed-881c-4cac-8d9f-230da7873d05-00001.parquet` in which "852c47ed-881c-4cac-8d9f-230da7873d05" is the spark streaming id from checkpoint metadata file.
When the same job is executed multiple times, with new data in source directory, the streaming job sometimes overwrites one or more existing parquet file(s). In this test, the file /data/00000-2-852c47ed-881c-4cac-8d9f-230da7873d05-00001.parquet got overwritten with new data, so original 4 records are lost and only 2 new records are part of that file.
Here is the screenshot of query
`select substring(file_path, 88), record_count from default.blobiceberg16.files`
This also makes iceberg metadata and actual data files out-of-sync.
**Environment**:
Runtime: iceberg-spark-runtime-3.4_2.12-1.4.2
--
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.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Parquet file overwritten by spark streaming job in subsequent execution with same spark streaming checkpoint location [iceberg]
Posted by "amogh-jahagirdar (via GitHub)" <gi...@apache.org>.
amogh-jahagirdar commented on issue #9172:
URL: https://github.com/apache/iceberg/issues/9172#issuecomment-1848220358
Thanks for the details, one key thing stands out to me:
```
I also tested with latest version, iceberg-spark-runtime-3.4_2.12-1.4.2.jar as well, I could see that the second number, part of the file name, is continuously increasing 00001-3200-11773075-523f-4667-936b-88702fe9860c-00001.parquet, however after around 200 execution of stream, the file name got reset 00001-3166-11773075-523f-4667-936b-88702fe9860c-00001.parquet and files were started getting overwritten.
```
This does align with the suspicion in the other issue that task IDs can be reused across epochs ("after around 200 executions of stream" I'm reading that as 200 intervals of miccrobatches)
Which I think makes sense (and anyways that's probably intentional in the DSV2 API to surface the writer). I'll put up a draft for adding the epochID to the output path.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Parquet file overwritten by spark streaming job in subsequent execution with same spark streaming checkpoint location [iceberg]
Posted by "amitmittal5 (via GitHub)" <gi...@apache.org>.
amitmittal5 commented on issue #9172:
URL: https://github.com/apache/iceberg/issues/9172#issuecomment-1836474036
I corrected the typo in original post to correct the data source as Kafka. It now states "reads the data from Kafka and write to ADLS gen 2 in iceberg table"
--
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.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Parquet file overwritten by spark streaming job in subsequent execution with same spark streaming checkpoint location [iceberg]
Posted by "amitmittal5 (via GitHub)" <gi...@apache.org>.
amitmittal5 commented on issue #9172:
URL: https://github.com/apache/iceberg/issues/9172#issuecomment-1832293641
Just adding more details on the table to which the job is writting, I tried with both external and managed table, but see similar results. The behavior I see, that it took around 10 execution of streaming job (with AvailableNow trigger) to reproduce the error for managed table.
```
CREATE EXTERNAL TABLE IF NOT EXISTS default.blob_iceberg
(id string, state string, name string)
USING ICEBERG
LOCATION 'abfss://<container>@<storage-account>.dfs.core.windows.net/test/blob_iceberg'
```
And managed table
```
CREATE TABLE IF NOT EXISTS default.blob_iceberg1
(id string, state string, name string)
USING ICEBERG
```
--
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.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Parquet file overwritten by spark streaming job in subsequent execution with same spark streaming checkpoint location [iceberg]
Posted by "amogh-jahagirdar (via GitHub)" <gi...@apache.org>.
amogh-jahagirdar commented on issue #9172:
URL: https://github.com/apache/iceberg/issues/9172#issuecomment-1841116845
I think https://github.com/apache/iceberg/issues/8953 is related.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Parquet file overwritten by spark streaming job in subsequent execution with same spark streaming checkpoint location [iceberg]
Posted by "Abhishek-Dutta (via GitHub)" <gi...@apache.org>.
Abhishek-Dutta commented on issue #9172:
URL: https://github.com/apache/iceberg/issues/9172#issuecomment-1842071333
@amogh-jahagirdar Yes, these two are related. I am a colleague @amitmittal5, and after raising this issue later we found similar issue was opened end of October. The difference is, this we found in Azure while working in ADLS Gen2, but the behavior is same.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Parquet file overwritten by spark streaming job in subsequent execution with same spark streaming checkpoint location [iceberg]
Posted by "amitmittal5 (via GitHub)" <gi...@apache.org>.
amitmittal5 commented on issue #9172:
URL: https://github.com/apache/iceberg/issues/9172#issuecomment-1832775989
I also tested with latest version, **iceberg-spark-runtime-3.4_2.12-1.4.2.jar** as well, I could see that the second number, part of the file name, is continuously increasing 00001-**3200**-11773075-523f-4667-936b-88702fe9860c-00001.parquet, however after around 200 execution of stream, the file name got reset 00001-3166-11773075-523f-4667-936b-88702fe9860c-00001.parquet and files were started getting overwritten.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Parquet file overwritten by spark streaming job in subsequent execution with same spark streaming checkpoint location [iceberg]
Posted by "rdblue (via GitHub)" <gi...@apache.org>.
rdblue closed issue #9172: Parquet file overwritten by spark streaming job in subsequent execution with same spark streaming checkpoint location
URL: https://github.com/apache/iceberg/issues/9172
--
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.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org