fatmanverse opened a new issue, #13728:
URL: https://github.com/apache/seatunnel/issues/13728

   ### Search before asking
   
   - [x] I searched existing issues and PRs and found no duplicate of this 
reproducer.
   
   ### What happened
   
   `pageing.page_field` is optional and declares the default `page`, but 
omitting it leaves the reader page field unset. The reader advances its 
internal page index while requests either omit the page number or keep the 
original value, so an API can return the same page repeatedly. Explicitly 
setting `page_field = "page"` works around the issue.
   
   Two requests should have queries `existing=ok&page=1` and 
`existing=ok&page=2`. Actual queries are `existing=ok` twice. Existing page 
values in params, headers and body are also not advanced when `page_field` is 
omitted.
   
   ### SeaTunnel Version
   
   `dev`, `3.1.1-SNAPSHOT`, commit `0bef81d003a9dcc3266a10140dc639534ad81bfd`. 
This report establishes the behavior on this revision; released-version 
coverage was not tested.
   
   ### SeaTunnel Config
   
   ```hocon
   env {
     job.mode = "BATCH"
     parallelism = 1
   }
   source {
     Http {
       url = "http://127.0.0.1:18080/pages?existing=ok";
       format = "text"
       keep_page_param_as_http_param = true
       pageing = {
         total_page_size = 2
         batch_size = 1
       }
     }
   }
   sink { Console {} }
   ```
   
   ### Running Command
   
   Reproduced through `HttpSource.createReader()` and `pollNext()` using a real 
loopback HTTP server in a JUnit test. The loopback endpoint returns 
`[{"id":1}]` for each request and records the request queries. `page_field` and 
`page_type` are intentionally omitted.
   
   The [regression 
test](https://github.com/fatmanverse/seatunnel/blob/7c7f2f72dcd57251355017c7572b6999129bd2e9/seatunnel-connectors-v2/connector-http/connector-http-base/src/test/java/org/apache/seatunnel/connectors/seatunnel/http/HttpSourcePageFieldTest.java)
 starts its own server on a dynamically allocated port; no external service is 
needed. To reproduce against the original production code at the revision 
above, copy only that test into a disposable checkout and run:
   
   ```sh
   # In a disposable checkout of the affected dev revision:
   git fetch https://github.com/fatmanverse/seatunnel.git 
fix-http-default-page-field
   git checkout 7c7f2f72dcd57251355017c7572b6999129bd2e9 -- 
seatunnel-connectors-v2/connector-http/connector-http-base/src/test/java/org/apache/seatunnel/connectors/seatunnel/http/HttpSourcePageFieldTest.java
   ./mvnw -B -ntp -pl 
seatunnel-connectors-v2/connector-http/connector-http-base -am \
     -DskipITs -Dskip.spotless=true -Dsurefire.timeout=60 \
     -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false \
     -Dtest=HttpSourcePageFieldTest clean verify
   ```
   
   ### Error Exception
   
   ```text
   expected: <[existing=ok&page=1, existing=ok&page=2]> but was: <[existing=ok, 
existing=ok]>
   ```
   
   6 of 8 test cases fail on the original code; the remaining cases check 
preserved behavior. 
   
   ### Zeta or Flink or Spark Version
   
   Connector-level regression; no engine was started.
   
   ### Java or Scala Version
   
   Original-code reproduction: Temurin 11.0.32.1 on Linux. The corresponding 
fix was checked on JDK 11 and JDK 17.
   
   ### Are you willing to submit PR?
   
   - [x] Yes, I am willing to submit a PR.
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct).
   


-- 
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]

Reply via email to