Repository navigation
Commit 45c962b
authored
Fix the identity used by the asynchronous LOAD of the pipe receiver (#19029)
* Fix the identity used by the asynchronous LOAD of the pipe receiver
The load attributes of a TsFile received by the pipe receiver were built from the
default user instead of from the sender of the transfer. The receiver now passes
the authenticated sender to the active loader, and a seal request whose user can
not be determined is rejected. The type mismatch converter inherits the identity
of the load request. TsFiles placed directly in the active listening directory are
still loaded with the default user.
Tests: IoTDBPipeReceiverAsyncLoadAuthIT and IoTDBDataNodeReceiverTest.
* Fix the user resolution in the LOAD pipelines
Several places substituted the default user when a load carried no identity.
LoadUtil, ActiveLoadTsFileLoader and the type mismatch converter now require the
user of the load and fail otherwise, while a TsFile placed directly in the active
listening directory still falls back to the default user. The worker session of
the active loader is created after the per-file identity is known, and the thrift
pipe receiver returns NOT_LOGIN instead of dereferencing a missing session.
Tests: LoadUtilTest and IoTDBPipeReceiverAsyncLoadAuthIT.
* Fix the identity resolution of the pipe receiver
The V2 handshake took the user id from the handshake parameters, and the receiver
fell back to default credentials when the handshake carried none. The receiver now
resolves the identity from the handshake user name with the local user manager or
the permission manager, creates the audit entity only after a successful login,
and clears it when the handshake fails or the connection exits. Two null pointer
exceptions on the LOAD paths are fixed as well.
Tests: IoTDBFileReceiverTest and IoTDBDataNodeReceiverAuditEntityTest.
* Fix the identity binding of a pipe transfer connection
A connection that was already authenticated kept the identity of its first
transfer while the audit entity followed the new handshake. A handshake that does
not match the user of the connection is now rejected with NO_PERMISSION, and the
identity of a transfer is resolved from the verified user name, with the address
of the connection preferred over the hostname of the handshake.
Tests: IoTDBFileReceiverTest.
* Harden the user resolution of the pipe receiver and the load pipeline
- Use "{}" placeholders in the new LOG_ templates and keep the en and zh
constants in parity.
- Fail closed when the session of a pipe connection is not logged in: an
unauthenticated session still carries the id of the super user.
- Resolve the user id of a load from its user name instead of trusting the
default id of the session, in the tree model schema verifier and in the
TsFile data type converter.
- Allow a local TsFile that is dropped into a sub directory of the active
listening directory to be loaded with the default user, while a file that
carries attributes but no user is still rejected.
* Make the load user identity requirement configurable
The pipe receiver and the LOAD pipeline now fail when the user that
executes a load can not be resolved. Keep the legacy default-user
fallback by default and gate the strict behavior behind two internal
switches instead of changing the existing load code:
- pipe_receiver_require_user_identity (default false): an asynchronous
LOAD of the pipe receiver without an authenticated sender is executed
as the default user instead of being rejected.
- load_require_user_identity (default false): an asynchronous LOAD
without a user is queued with the default user instead of letting the
strict LoadUtil check reject it.
The switches are not added to iotdb-system.properties.template and
therefore stay internal. ActiveLoadTsFileLoader, LoadTsFileDataTypeConverter,
LoadUtil and TreeSchemaAutoCreatorAndVerifier keep the behavior of this
branch.
Tests: LoadUtilTest, ActiveLoadTsFileLoaderTest, IoTDBDataNodeReceiverTest
and LoadTsFileAnalyzerTest.
* Keep the load user identity switches minimal
Reduce the diff of the configurable load identity requirement:
- Move the LOAD switch back into LoadUtil so LoadTsFileAnalyzer keeps the
behavior of this branch.
- Read the two switches only when the properties are loaded; they are not
hot reloadable.
- Shorten the comments and javadocs of the new switches.
ActiveLoadTsFileLoader, LoadTsFileDataTypeConverter, TreeSchemaAutoCreatorAndVerifier
and the asynchronous LOAD acknowledgement semantics are unchanged.
Tests: LoadUtilTest.
* Drop the redundant user resolution in the LOAD pipeline
The load path already carries a locally resolved user and LoadUtil always
queues a user when the strict switch is enabled, so the extra resolution
layers are redundant:
- TreeSchemaAutoCreatorAndVerifier uses the user of the load session again
instead of resolving the id per measurement.
- ActiveLoadTsFileLoader uses the user attribute with the default user as
fallback, instead of walking the listening directory and failing files.
- Remove the i18n constants that are no longer used.
Tests: LoadUtilTest, ActiveLoadTsFileLoaderTest, IoTDBDataNodeReceiverTest,
LoadTsFileAnalyzerTest.
* Keep the legacy user fallback of LoadUtil
LoadUtil only needs to use the user name of the session when it is present
and fall back to the default user otherwise, which is what the original
code does. Drop the strict switch and restore the original method.
Remove the now unused i18n constant.
Tests: LoadUtilTest, ActiveLoadTsFileLoaderTest, IoTDBDataNodeReceiverTest,
LoadTsFileAnalyzerTest.
* Require a logged in user when the load identity switches are enabled
- pipe_receiver_require_user_identity: the asynchronous LOAD of the pipe
receiver requires the authenticated sender to be the logged in user of
the connection.
- load_require_user_identity: a LOAD without a user requires a logged in
session that carries a user name instead of falling back to the default
user.
Both switches keep the legacy fallback when they are disabled.
Tests: LoadUtilTest, ActiveLoadTsFileLoaderTest, IoTDBDataNodeReceiverTest,
LoadTsFileAnalyzerTest.
* Align the legacy receiver runtime test and cover local LOAD options
- A V1 handshake carries no credentials, so the receiver runtime reports an
unknown user instead of the default user. Update the legacy receiver
expectation accordingly, keeping the removal of privileged defaults.
- Add a regression test for a locally dropped TsFile under an attribute
directory without a user; such a local input must still be loaded with the
default user.
* Require an authenticated sender for asynchronous LOAD by default
Enable pipe_receiver_require_user_identity by default: the receiver only
queues an asynchronous LOAD when the sender is authenticated and the
connection is logged in as that user. Set the switch to false to restore
the legacy default user fallback. The load_require_user_identity switch
keeps its default (false).
Tests: LoadUtilTest, ActiveLoadTsFileLoaderTest, IoTDBDataNodeReceiverTest,
LoadTsFileAnalyzerTest.
* Compare the number of points of the replicas instead of their TsFile sizes
The restart case waited until every data region replica on the restarted
DataNode had the same on-disk size as the other replicas of that region. A
replica that replayed the LOAD can keep the same points in fewer physical
TsFiles than the replicas that stayed up, so the sizes never converge and
the case fails with a size mismatch that says nothing about the data.
Hard-link the TsFiles of every replica of a region into
<temp dir>/<region>/<DataNode>/, read them back point by point, and wait
until all replicas of the region hold the same number of points. Duplicate
physical copies collapse in the point set, so the check no longer depends on
how the same data is spread over files. Every waiting attempt deletes its
snapshots, and tearDownClass removes what an interrupted attempt left behind.1 parent 56aca60 commit 45c962b
21 files changed
Lines changed: 1263 additions & 143 deletions
File tree
- integration-test/src/test/java/org/apache/iotdb
- db/it
- pipe/it/single
- iotdb-core
- confignode/src/main
- i18n
- en/org/apache/iotdb/confignode/i18n
- zh/org/apache/iotdb/confignode/i18n
- java/org/apache/iotdb/confignode/manager/pipe/receiver/protocol
- datanode/src
- main
- i18n
- en/org/apache/iotdb/db/i18n
- zh/org/apache/iotdb/db/i18n
- java/org/apache/iotdb/db
- conf
- pipe/receiver/protocol/thrift
- queryengine/plan/analyze/load
- storageengine/load
- converter
- util
- test/java/org/apache/iotdb/db
- pipe/receiver/protocol/thrift
- storageengine/load/util
- node-commons/src
- main
- i18n
- en/org/apache/iotdb/commons/i18n
- zh/org/apache/iotdb/commons/i18n
- java/org/apache/iotdb/commons/pipe/receiver
- test/java/org/apache/iotdb/commons/pipe/receiver
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
452 | 452 | | |
453 | 453 | | |
454 | 454 | | |
455 | | - | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
456 | 458 | | |
457 | 459 | | |
458 | 460 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
720 | 720 | | |
721 | 721 | | |
722 | 722 | | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
723 | 726 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
699 | 699 | | |
700 | 700 | | |
701 | 701 | | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
702 | 705 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| 138 | + | |
138 | 139 | | |
139 | 140 | | |
140 | 141 | | |
| |||
1395 | 1396 | | |
1396 | 1397 | | |
1397 | 1398 | | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
1398 | 1427 | | |
1399 | 1428 | | |
1400 | 1429 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1762 | 1762 | | |
1763 | 1763 | | |
1764 | 1764 | | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
1765 | 1770 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1681 | 1681 | | |
1682 | 1682 | | |
1683 | 1683 | | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
1684 | 1689 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1240 | 1240 | | |
1241 | 1241 | | |
1242 | 1242 | | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
1243 | 1255 | | |
1244 | 1256 | | |
1245 | 1257 | | |
| |||
4365 | 4377 | | |
4366 | 4378 | | |
4367 | 4379 | | |
| 4380 | + | |
| 4381 | + | |
| 4382 | + | |
| 4383 | + | |
| 4384 | + | |
| 4385 | + | |
| 4386 | + | |
| 4387 | + | |
| 4388 | + | |
| 4389 | + | |
| 4390 | + | |
| 4391 | + | |
| 4392 | + | |
| 4393 | + | |
| 4394 | + | |
| 4395 | + | |
4368 | 4396 | | |
4369 | 4397 | | |
4370 | 4398 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2709 | 2709 | | |
2710 | 2710 | | |
2711 | 2711 | | |
| 2712 | + | |
| 2713 | + | |
| 2714 | + | |
| 2715 | + | |
| 2716 | + | |
| 2717 | + | |
| 2718 | + | |
| 2719 | + | |
| 2720 | + | |
| 2721 | + | |
| 2722 | + | |
2712 | 2723 | | |
2713 | 2724 | | |
2714 | 2725 | | |
| |||
0 commit comments