nspcc-dev / neofs-testcases

NeoFS integration testcases
GNU General Public License v3.0
3 stars 18 forks source link

GC object parts test #794

Closed carpawell closed 3 days ago

carpawell commented 5 months ago

Is your feature request related to a problem? Please describe.

I'm always frustrated when we do not test unfinished object removal. If an object is not finished (no LINK object can be found), its parts can be removed to be GCed (while a finished object's parts are protected).

Describe the solution you'd like

Get some unfinished object (but how? PUT a big one and stop operation? request more featured neofs-cli util?) and know somehow its parts' IDs. Delete parts and get no errors.

Additional context

Split scheme has been changed: https://github.com/nspcc-dev/neofs-node/pull/2716, https://github.com/nspcc-dev/neofs-api/pull/283, https://github.com/nspcc-dev/neofs-spec/pull/97.

roman-khimov commented 2 weeks ago

It's easy to get unfinished chain with S3, btw. Multipart does exactly that.

evgeniiz321 commented 6 days ago

@roman-khimov @carpawell i need a way to get parts' IDs of an unfinished object. I see them in s3 gw logs, e.g.:

debug   layer/multipart_upload.go:1099  part details    {"reqId": "2b9b1355-5826-4221-beef-1f2d0c3b3ed0", "bucket": "48be82f0-0101-4031-acb7-69c9b51f5185", "cid": "65Z9MvrLCTpZrSbA4pyuJ4ScNiLx3DRhAYqWreez6BRQ", "object": "temp_file_83d8dd44-8f6f-40e0-9148-615c58ca9f2b", "upload id": "52dPYFhcfHzU89gcP1tnWRt6c5c5MehMSuNQWkmctvz3", "part numbers": [0, 1], "oids": ["52dPYFhcfHzU89gcP1tnWRt6c5c5MehMSuNQWkmctvz3", "FQqNd843fNF57WGAy254YRH6LATBNDdGsMXmGiJ44eMi"]}

Are there any commands that can give me those IDs? Regular objects listings don't show them and I don't really want to grep logs.

evgeniiz321 commented 5 days ago

heading an object with multipart upload id doesn't return any info about parts:

./neofs-cli --config /Users/evgeniiz/Projects/neofs-testcases-nspcc/neofs-testcases/wallet_config.yml object head --rpc-endpoint 'localhost:51214' --wallet '/Users/evgeniiz/Projects/neofs-testcases-nspcc/neofs-testcases/TemporaryDir-67a5f001-0cb4-4264-b672-e53a8429bc66/6047847c-56f1-4868-ba0d-befb0da596b1.json' --cid 'FeqcacqgHBM7Grsx3GKRyfdmDEBfRmgJP8PDFo32yUBN' --oid 'G8ekRmLqNTV4Zr3188jsedRySFHyutgT9a3N6sGJUi38' --json --raw

{
    "objectID": {
        "value": "4NUNXLwAlNJ3ZuAtBz7vOmNvSXhyglyj+AGU88UWOec="
    },
    "signature": {
        "key": "AvmDyo6kxXysVkPPwwRq8NVfPvCH95R1eiBMsgctdKyY",
        "signature": "n/w5W8nZDvci0Wg0yywICG02+MlSu/Nzr04ayCsdrjuuj0NAk+fiFGYNt/xJDd03Zcys1vT+bwcvstwKWfi9EA==",
        "scheme": "ECDSA_RFC6979_SHA256"
    },
    "header": {
        "version": null,
        "containerID": {
            "value": "2bUTBTnaBB1AyJguwpKEiTEcUE0T5BUMIAc914akzLU="
        },
        "ownerID": {
            "value": "NcS9bsuvmMlCYarZFa6w4hVq5yUNSM7cdQ=="
        },
        "creationEpoch": "0",
        "payloadLength": "0",
        "payloadHash": {
            "type": "SHA256",
            "sum": "47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU="
        },
        "objectType": "REGULAR",
        "homomorphicHash": {
            "type": "TZ",
            "sum": "AAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ=="
        },
        "sessionToken": null,
        "attributes": [
            {
                "key": "Timestamp",
                "value": "1728401569"
            },
            {
                "key": "__NEOFS__NONCE",
                "value": "RDSh7sQvbAA="
            }
        ],
        "split": {
            "parent": null,
            "previous": null,
            "parentSignature": null,
            "parentHeader": {
                "version": {
                    "major": 2,
                    "minor": 16
                },
                "containerID": {
                    "value": "2bUTBTnaBB1AyJguwpKEiTEcUE0T5BUMIAc914akzLU="
                },
                "ownerID": {
                    "value": "NcS9bsuvmMlCYarZFa6w4hVq5yUNSM7cdQ=="
                },
                "creationEpoch": "2",
                "payloadLength": "0",
                "payloadHash": null,
                "objectType": "REGULAR",
                "homomorphicHash": null,
                "sessionToken": null,
                "attributes": [
                    {
                        "key": "Timestamp",
                        "value": "1728401569"
                    }
                ],
                "split": null
            },
            "children": [],
            "splitID": "",
            "first": null
        }
    },
    "payload": ""
}

getting this object and trying to inspect as a link file, also returns nothing useful:

[MainThread] 11:44:49 [INFO] Command: ./neofs-lens  object link --file 'TemporaryDir-07f7e442-51ce-4360-b66a-77f4f103915e/TestObjectsDir/226c9a61-30d4-4feb-925b-e93dbc38b70f'
Error:
return code: 1 
Output: empty children list
carpawell commented 5 days ago

@evgeniiz321, "upload id": "52dPYFhcfHzU89gcP1tnWRt6c5c5MehMSuNQWkmctvz3" in S3 things should play first object's ID role. Also, you need to search for other parts using their common ID (first object's ID in neofs after latest updates). In the example above it should be like neofs-cli object search --filters '$Object:split.first EQ 52dPYFhcfHzU89gcP1tnWRt6c5c5MehMSuNQWkmctvz3' ... can you try it?

evgeniiz321 commented 5 days ago

@carpawell It returns all objects except the one used in the filter itself:

(.venv) ➜  neofs-testcases git:(ezayats/unfinished) ✗ ./neofs-cli --config /Users/evgeniiz/Projects/neofs-testcases-nspcc/neofs-testcases/wallet_config.yml object search --rpc-endpoint 'localhost:55986' --wallet '/Users/evgeniiz/Projects/neofs-testcases-nspcc/neofs-testcases/TemporaryDir-7108c574-77e4-4d1f-8ebf-8707d6d6b275/21eb7b40-fea9-4614-8a21-745376fb1d65.json' --cid 'FiHUzB4s6kJ1h65xPpHsKuxRCMFRuHawwnQr2xDCiBfU' --filters '$Object:split.first EQ 6mWzpjrbM4qCXesLjmRHXss6oqbUPFET3LdQTaVhvW17' 
Found 11 objects.
4canm5DLtMWvzjSveB99wyzjhhQPUGhGu5wffuTQYfkf
3TMAdyhrqC9PZops965cvMTSs2jJYmmVhhYDULgLSMdJ
G1sBUpFU5QifEviR29KV2rakpuYMjnww1uGaumCFAGVH
8V7WfqvZo6cjMaU22job5nCxa9XmUr1JsxNiWHiXdTMm
72dFcpS51Nz7q7yxtTw3u2VmFBJQY1VbGMPvYVSy1sfn
EfAv4J8LVkFCR4Xppe342cVsWuRm7Lziw6T432SDaqLg
6WFUwCMFgFZLSWZYskg1mnFGoKnXUkt2bqEMj3TpvGE4
3X5qQVTsX1sGCYC7HVR6dvuky6UzyG2NVoWqP8fHWHVi
DCpfwC9Cr1hv3bMQKCgd8uAadtNvtUAPAPnkj3wRjhMG
2EDfHg6TNudEe2Lvp4ca198YCpwWjDAa25FUFXS7Fs4i
3DuV1i4pqoRk2x9oR25AxisL5w6ieL7oo4pKakWPVVs3

I expect to see only one id, because I uploaded only one part. And in the above output there is the one id that related to my multipart upload (I took the value to compare from s3 gw logs), but others I guess are system objects, that need to be filtered away.

Maybe the filter string can be somehow enhanced?

Without any filters:

 ./neofs-cli --config /Users/evgeniiz/Projects/neofs-testcases-nspcc/neofs-testcases/wallet_config.yml object search --rpc-endpoint 'localhost:55986' --wallet '/Users/evgeniiz/Projects/neofs-testcases-nspcc/neofs-testcases/TemporaryDir-7108c574-77e4-4d1f-8ebf-8707d6d6b275/21eb7b40-fea9-4614-8a21-745376fb1d65.json' --cid 'FiHUzB4s6kJ1h65xPpHsKuxRCMFRuHawwnQr2xDCiBfU'                                                                               
Found 12 objects.
3TMAdyhrqC9PZops965cvMTSs2jJYmmVhhYDULgLSMdJ
4canm5DLtMWvzjSveB99wyzjhhQPUGhGu5wffuTQYfkf
6mWzpjrbM4qCXesLjmRHXss6oqbUPFET3LdQTaVhvW17
72dFcpS51Nz7q7yxtTw3u2VmFBJQY1VbGMPvYVSy1sfn
8V7WfqvZo6cjMaU22job5nCxa9XmUr1JsxNiWHiXdTMm
EfAv4J8LVkFCR4Xppe342cVsWuRm7Lziw6T432SDaqLg
2EDfHg6TNudEe2Lvp4ca198YCpwWjDAa25FUFXS7Fs4i
3DuV1i4pqoRk2x9oR25AxisL5w6ieL7oo4pKakWPVVs3
3X5qQVTsX1sGCYC7HVR6dvuky6UzyG2NVoWqP8fHWHVi
6WFUwCMFgFZLSWZYskg1mnFGoKnXUkt2bqEMj3TpvGE4
DCpfwC9Cr1hv3bMQKCgd8uAadtNvtUAPAPnkj3wRjhMG
G1sBUpFU5QifEviR29KV2rakpuYMjnww1uGaumCFAGVH
roman-khimov commented 5 days ago

I expect to see only one id, because I uploaded only one part

It depends on how size of the part relates to MaxObjectSize network setting. We have very low MaxObjectSize for tests, so likely your single part overflows that and this behavior is OK. Either you upload a smaller part (but there are S3 limits on that IIRC) or you can take them all, they're all part of the same chain.

carpawell commented 4 days ago

I expect to see only one id, because I uploaded only one part.

You can HEAD objects and see if they have first object ID in their headers or not. If yes, node does correct things here (SEARCH works OK). If no, node is the problem. All the other cases do not relate SNs (S3 may slice strange; your container may contain only parts for now; test may have too small MaxObjectSize, etc)