TheR1sing3un opened a new pull request, #13342:
URL: https://github.com/apache/hudi/pull/13342
Please consider following case:
```
/**
* case: query with pending instant
*
* 1. insert-txn1 start, will create a log file
* 2. insert-txn2 start, will create a log file
* 3. insert-txn2 commit
* 4. query-txn3 execute
* 5. insert-txn1 commit
*
* |-------------------------------- txn1: insert
--------------------------------------|
* |------ txn2: insert ------|
* |---txn3: query---|
*
* we expected txn3's query should see the data of txn2
*/
```
However, I found that the reading result here was empty and the data written
by txn2 was not read as I expected.
The reason lies in that when we were constructing the file slice at the
current moment, we selected the smallest instant as the base instant of this
file slice. In the above case, that is, txn1 was used as the base instant.
<img width="1218" alt="image"
src="https://github.com/user-attachments/assets/748130f3-0193-4328-a71d-193de76492b8"
/>
<img width="1133" alt="image"
src="https://github.com/user-attachments/assets/af027620-0f5f-4848-b8d3-66aa9736c048"
/>
When we try to query, we will perform
`AbstractTableFileSystemView#getLatestMergedFileSlicesBeforeOrOn` to fetch the
file slice to read.
<img width="879" alt="image"
src="https://github.com/user-attachments/assets/d138e962-925f-4967-a7ff-213f761d83ff"
/>
<img width="1383" alt="image"
src="https://github.com/user-attachments/assets/de91b62a-0e6f-4b1f-9b22-a7cd6d5143d6"
/>
<img width="693" alt="image"
src="https://github.com/user-attachments/assets/24f7678b-061a-483f-8df2-041fcdf01d4c"
/>
<img width="985" alt="image"
src="https://github.com/user-attachments/assets/f01a0496-6bc5-4dea-a4aa-68ad269a4b09"
/>
Eventually, we will go to the above-mentioned judgment logic to determine
whether a slice is `committed`. The logic here is to determine whether there is
the base instant of this slice on the `timeline`. However, according to the
above logic, the base instant of this slice is `txn1`. This instant does not
exist on the `timeline` because the `timeline` here is composed of the
completed writes and the pending compaction. Naturally, it does not include the
txn1 that is still pending. This led to the entire slice being filtered out.
However, we hope that the log files written by txn1 can be filtered and the log
files written by txn2 can be read.
### Change Logs
1. Fix the issue where the file slice was wrongly filtered out when there
were committed and pending logs
_Describe context and summary for this change. Highlight if any code was
copied._
### Impact
bug fix
_Describe any public API or user-facing feature change or any performance
impact._
### Risk level (write none, low medium or high below)
mid
_If medium or high, explain what verification was done to mitigate the
risks._
### Documentation Update
none
_Describe any necessary documentation update if there is any new feature,
config, or user-facing change. If not, put "none"._
- _The config description must be updated if new configs are added or the
default value of the configs are changed_
- _Any new feature or user-facing change requires updating the Hudi website.
Please create a Jira ticket, attach the
ticket number here and follow the
[instruction](https://hudi.apache.org/contribute/developer-setup#website) to
make
changes to the website._
### Contributor's checklist
- [x] Read through [contributor's
guide](https://hudi.apache.org/contribute/how-to-contribute)
- [x] Change Logs and Impact were stated clearly
- [x] Adequate tests were added if applicable
- [x] CI passed
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]