skyyyy955 opened a new pull request, #10827:
URL: https://github.com/apache/paimon/pull/10827

   ### Purpose
   
   When `KRB5CCNAME` is unset, `get_ticket_cache_path()` calls `os.getuid()` to 
construct the Unix default cache path. On platforms without that function, 
including Windows, HDFS initialization can fail with `AttributeError` even when 
no Kerberos credentials are configured.
   
   Return `None` when `os.getuid` is unavailable, after checking the explicit 
cache setting. This lets callers handle an unavailable cache through their 
existing branches. Keep explicit cache precedence, `FILE:` prefix handling, the 
Unix file-existence check, and error propagation from an available `getuid`. 
Keytab login without a discoverable cache still raises `RuntimeError`.
   
   Add five regression tests and make the existing Unix-path mock work on 
platforms without `getuid`. No public API, configuration, data format or 
dependency changes are required. This is a platform availability fix; it does 
not add Kerberos cache types or certify HDFS authentication on Windows. No 
feature documentation changes are needed.
   
   The existing Kerberos implementation and tests came from ChengHui Chen's 
[#7716](https://github.com/apache/paimon/pull/7716), merged as 
[`81bc068`](https://github.com/apache/paimon/commit/81bc068aa87470f3e9175acc848f0dddf22f202b).
 The shared helper and native backend came from chaoyang's 
[#8031](https://github.com/apache/paimon/pull/8031), merged as 
[`b839753`](https://github.com/apache/paimon/commit/b839753f46d8d447ab4ba5f8770e1ca13c0a5288).
 This change adds the availability guard and portability tests on top of that 
merged code.
   
   ### Tests
   
   The same 35 cases were run before and after the production fix against 
`3f5e9fcf62548a9f5bd110d4729e091b705a19b4`:
   
   | Platform | Python / PyArrow | Without the production guard | With the fix |
   | --- | --- | --- | --- |
   | Windows | 3.10.11 / 19.0.1 | 27 passed, 8 failed | 35 passed |
   | Linux | 3.6.15 / 6.0.1 | 33 passed, 2 failed | 35 passed |
   | Linux | 3.7.17 / 12.0.1 | 33 passed, 2 failed | 35 passed |
   | Linux | 3.10.22 / 19.0.1 | 33 passed, 2 failed | 35 passed |
   
   There were no skipped tests or introduced failures. The two Linux failures 
without the guard simulate an unavailable `getuid`; the other 33 cases continue 
to pass. All environments use the same test IDs and unchanged source inputs. 
From `paimon-python`, the selection is:
   
   ```sh
   python -B -m pytest -q -p no:cacheprovider \
     pypaimon/tests/kerberos_test.py \
     pypaimon/tests/file_io_test.py::HdfsFileIOTest \
     
pypaimon/tests/file_io_test.py::FileIOTest::test_write_file_with_overwrite_flag 
\
     pypaimon/tests/file_io_test.py::FileIOTest::test_copy_file \
     pypaimon/tests/file_io_test.py::FileIOTest::test_try_to_write_atomic \
     
pypaimon/tests/file_io_test.py::FileIOTest::test_rename_returns_false_when_dst_exists
 \
     
pypaimon/tests/file_io_test.py::FileIOTest::test_get_file_status_raises_error_when_file_not_exists
 \
     
pypaimon/tests/file_io_test.py::FileIOTest::test_local_directory_listing_propagates_permission_errors
   ```
   
   Changed-file flake8, the project license-header check and Python 3.6 grammar 
checks passed. An additional probe using the real Windows `os` module covered 
cache lookup, the public `FileIO.get` entry and both backend wrappers' 
missing-cache errors after keytab login.
   
   HDFS clients and `kinit` are mocked in these tests; local file operations 
use real temporary files. Native backend coverage is limited to the Python 
wrapper. Real KDC/HDFS authentication, HDFS cluster read/write and full 
upstream CI have not been run for this candidate; the available HDFS endpoint 
was unreachable.
   


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