smengcl commented on code in PR #11883:
URL: https://github.com/apache/ozone/pull/11883#discussion_r4438453166


##########
hadoop-ozone/dist/src/main/smoketest/compatibility/write.robot:
##########
@@ -80,119 +96,37 @@ HSync Can Be Used To Create Keys
     ${pfspath} =    Format FS URL         ofs      $vol1    bucket1
     Freon DFSG      sync=HSYNC    n=1    path=${pfspath}
 
-Snapshot Diff RPC Is Compatible
-    # Snapshot diff requires snapshot support in these tests.
-    Pass Execution If    '${CLIENT_VERSION}' < '${SNAPSHOT_VERSION}'    
Snapshot CLI not supported by this client
-    Pass Execution If    '${CLUSTER_VERSION}' < '${SNAPSHOT_VERSION}'   
Snapshot CLI not supported by this client
-
-    ${bucket} =      Set Variable    snapdiff-${CLIENT_VERSION}
-    ${fromSnap} =    Set Variable    snapdiff-from-${CLIENT_VERSION}
-    ${toSnap} =      Set Variable    snapdiff-to-${CLIENT_VERSION}
-    ${key1} =        Set Variable    snapdiff-key1-${CLIENT_VERSION}
-    ${key2} =        Set Variable    snapdiff-key2-${CLIENT_VERSION}
-
-    Execute          ozone sh bucket create --layout FILE_SYSTEM_OPTIMIZED 
/vol1/${bucket}
-    Execute          ozone sh key put /vol1/${bucket}/base ${TESTFILE}
-    Execute          ozone sh snapshot create /vol1/${bucket} ${fromSnap}
-    Execute          ozone sh key put /vol1/${bucket}/${key1} ${TESTFILE}
-    Execute          ozone sh key put /vol1/${bucket}/${key2} ${TESTFILE}
-    Execute          ozone sh snapshot create /vol1/${bucket} ${toSnap}
-
-    Snapshot Diff Report Should Contain Created Keys
-    ...    /vol1/${bucket}    ${fromSnap}    ${toSnap}    ${key1}    ${key2}
-
-Snapshot Diff Ordered Submit Is Compatible
-    Pass Execution If    '${CLIENT_VERSION}' < 
'${SNAPSHOT_DIFF_ORDERED_VERSION}'    Client does not support --ordered
-    Pass Execution If    '${CLIENT_VERSION}' < '${SNAPSHOT_VERSION}'    
Snapshot CLI not supported by this client
-    Pass Execution If    '${CLUSTER_VERSION}' < '${SNAPSHOT_VERSION}'   
Snapshot CLI not supported by this cluster
-    Pass Execution If    '${CLUSTER_VERSION}' < 
'${SNAPSHOT_DIFF_SUBMIT_VERSION}'    Cluster does not support snapshot diff 
submit
-
-    ${bucket} =      Set Variable    snapdiff-ordered-${CLIENT_VERSION}
-    ${fromSnap} =    Set Variable    snapdiff-ordered-from-${CLIENT_VERSION}
-    ${toSnap} =      Set Variable    snapdiff-ordered-to-${CLIENT_VERSION}
-    ${key1} =        Set Variable    snapdiff-ordered-key1-${CLIENT_VERSION}
-
-    Execute          ozone sh bucket create --layout FILE_SYSTEM_OPTIMIZED 
/vol1/${bucket}
-    Execute          ozone sh key put /vol1/${bucket}/base ${TESTFILE}
-    Execute          ozone sh snapshot create /vol1/${bucket} ${fromSnap}
-    Execute          ozone sh key put /vol1/${bucket}/${key1} ${TESTFILE}
-    Execute          ozone sh snapshot create /vol1/${bucket} ${toSnap}
-
-    ${submitOutput} =    Execute    ozone sh snapshot diff --ordered 
/vol1/${bucket} ${fromSnap} ${toSnap}
-    Should Contain    ${submitOutput}    Submitting a new job
-    Wait Until Keyword Succeeds    2min    5sec
-    ...    Snapshot Diff Command Should Contain Created Keys
-    ...    ozone sh snapshot diff --get-report /vol1/${bucket} ${fromSnap} 
${toSnap}
-    ...    ${fromSnap}    ${toSnap}    ${key1}    ${key1}
-
-Snapshot Diff Legacy Client Ignores Ordered Report Metadata
-    Pass Execution If    '${CLIENT_VERSION}' >= 
'${SNAPSHOT_DIFF_SUBMIT_VERSION}'    Client uses submit path
-    Pass Execution If    '${CLIENT_VERSION}' < '${SNAPSHOT_VERSION}'    
Snapshot CLI not supported by this client
-    Pass Execution If    '${CLUSTER_VERSION}' < '${SNAPSHOT_VERSION}'   
Snapshot CLI not supported by this client
-
-    ${bucket} =      Set Variable    snapdiff-legacy-${CLIENT_VERSION}
-    ${fromSnap} =    Set Variable    snapdiff-legacy-from-${CLIENT_VERSION}
-    ${toSnap} =      Set Variable    snapdiff-legacy-to-${CLIENT_VERSION}
-    ${key1} =        Set Variable    snapdiff-legacy-key1-${CLIENT_VERSION}
-
-    Execute          ozone sh bucket create --layout FILE_SYSTEM_OPTIMIZED 
/vol1/${bucket}
-    Execute          ozone sh key put /vol1/${bucket}/base ${TESTFILE}
-    Execute          ozone sh snapshot create /vol1/${bucket} ${fromSnap}
-    Execute          ozone sh key put /vol1/${bucket}/${key1} ${TESTFILE}
-    Execute          ozone sh snapshot create /vol1/${bucket} ${toSnap}
-
-    Wait Until Keyword Succeeds    2min    5sec
-    ...    Legacy Snapshot Diff Report Omits Dependency Metadata
-    ...    ozone sh snapshot diff /vol1/${bucket} ${fromSnap} ${toSnap}
-    ...    ${fromSnap}    ${toSnap}    ${key1}
+Snapshot Can Be Created
+    Pass Execution If    '${CLIENT_VERSION}' < '${SNAPSHOT_VERSION}'    Client 
does not support snapshots
+    Pass Execution If    '${CLUSTER_VERSION}' < '${SNAPSHOT_VERSION}'   
Cluster does not support snapshots
 
-*** Keywords ***
-Snapshot Diff Report Should Contain Created Keys
-    [Arguments]    ${bucketPath}    ${fromSnap}    ${toSnap}    ${key1}    
${key2}
-
-    # New clients support --get-report. Old clients don't; fall back to the 
legacy call.
-    ${status}    ${output} =    Run Keyword And Ignore Error
-    ...    Execute    ozone sh snapshot diff --get-report ${bucketPath} 
${fromSnap} ${toSnap}
-
-    IF    '${status}' == 'PASS'
-        # On newer servers, --get-report does not submit jobs. If the job is 
not
-        # found, submit it first (this keeps new-client/new-server behavior).
-        ${notFound} =    Run Keyword And Return Status
-        ...    Should Contain    ${output}    No snapshot diff job found
-        IF    ${notFound}
-            ${output} =    Execute    ozone sh snapshot diff ${bucketPath} 
${fromSnap} ${toSnap}
-                           Should Contain    ${output}    Submitting a new job
-        ELSE
-        # On older servers, --get-report falls back to the legacy snapshot 
diff command.
-        # Ensure the submit path succeeds without failing the test.
-            ${submitStatus}    ${submitOutput} =    Run Keyword And Ignore 
Error
-            ...    Execute    ozone sh snapshot diff ${bucketPath} ${fromSnap} 
${toSnap}
-            Run Keyword If    '${submitStatus}' == 'FAIL'
-            ...    Fail    Snapshot diff submit failed: ${submitOutput}
-        END
-        Wait Until Keyword Succeeds    2min    5sec
-        ...    Snapshot Diff Command Should Contain Created Keys
-        ...    ozone sh snapshot diff --get-report ${bucketPath} ${fromSnap} 
${toSnap}
-        ...    ${fromSnap}    ${toSnap}    ${key1}    ${key2}
-    ELSE
-        # old client, which does not support --get-report.
-        # The snapshot diff command should return the report, submitting a job 
if necessary.
-        Wait Until Keyword Succeeds    2min    5sec
-        ...    Snapshot Diff Command Should Contain Created Keys
-        ...    ozone sh snapshot diff ${bucketPath} ${fromSnap} ${toSnap}
-        ...    ${fromSnap}    ${toSnap}    ${key1}    ${key2}
-    END
+    Execute          ozone sh snapshot create ${FSO_BUCKET} ${SNAPSHOT1}
+    Execute          ozone sh key put ${FSO_BUCKET}/${SNAPSHOT_KEY1} 
${TESTFILE}
+    Execute          ozone sh snapshot create ${FSO_BUCKET} ${SNAPSHOT2}
+    Execute          ozone sh key put ${FSO_BUCKET}/${SNAPSHOT_KEY2} 
${TESTFILE}
+    Execute          ozone sh snapshot create ${FSO_BUCKET} ${SNAPSHOT3}
+
+Snapshot Diff Can Be Requested
+    Pass Execution If    '${CLIENT_VERSION}' < '${SNAPSHOT_VERSION}'    Client 
does not support snapshots
+    Pass Execution If    '${CLUSTER_VERSION}' < '${SNAPSHOT_VERSION}'   
Cluster does not support snapshots
+
+    ${output} =    Execute    ozone sh snapshot diff ${FSO_BUCKET} 
${SNAPSHOT1} ${SNAPSHOT2}
+    ${expected} =    Expected Snapshot Diff Output
+    Should Contain    ${output}    ${expected}
+
+Snapshot Diff --get-report fallback
+    Pass Execution If    '${CLIENT_VERSION}' < 
'${SNAPSHOT_DIFF_SUBMIT_VERSION}'    Client does not support snapshot diff 
submit
+    Pass Execution If    '${CLUSTER_VERSION}' < '${SNAPSHOT_VERSION}'   
Cluster does not support snapshots
+    Pass Execution If    '${CLUSTER_VERSION}' >= 
'${SNAPSHOT_DIFF_SUBMIT_VERSION}'    Client supports snapshot diff submit, no 
fallback

Review Comment:
   nit: this condition is on `CLUSTER_VERSION`, so the message could say 
"Cluster supports ...":
   
   ```suggestion
       Pass Execution If    '${CLUSTER_VERSION}' >= 
'${SNAPSHOT_DIFF_SUBMIT_VERSION}'    Cluster supports snapshot diff submit, no 
fallback
   ```
   
   Also, on these clusters `--get-report` simply calls the legacy 
`snapshotDiff` RPC, which the old server treats as a submit. The client side 
fallback (on `NOT_SUPPORTED_OPERATION`) is in the plain submit path, already 
covered by `Snapshot Diff Can Be Requested`. Maybe a name like this would 
describe it better?
   
   ```diff
   -Snapshot Diff --get-report fallback
   +Snapshot Diff --get-report Submits Job On Old Cluster
   ```
   



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to