Skip to content

Conversation

@devmadhuu
Copy link
Contributor

This JIRA is a bug in code while updating OM DB snapshots in Recon where framework for applying DB updates assumes storing OM DB updates in a event map with table keyType as "String" and while doing codec deserializing and type casting for DTOKENTABLE, it throws ClassCastException because for DTOKENTABLE, table key type is of "OzoneTokenIdentifier" class instead of String.

Patch Fix:
This patch is fixed by skipping any updates or syncing of table DTOKENTABLE in Recon because Recon don't use this table for any use case as of now. If in future , DTOKENTABLE table data is needed, all events for this table updates will be saved using Object as key and new task will also retrieve using Object as key.

https://issues.apache.org/jira/browse/HDDS-7455

This patch was tested manually by creating secure cluster and tested with creating entry for DelegationToken type in dTokenTable.

…rity.OzoneTokenIdentifier cannot be cast to java.lang.String.
@devmadhuu
Copy link
Contributor Author

@sumitagrawl @dombizita @ChenSammi pls review

@adoroszlai adoroszlai changed the title HDDS-7455. java.lang.ClassCastException: org.apache.hadoop.ozone.security.OzoneTokenIdentifier cannot be cast to java.lang.String HDDS-7455. ClassCastException: OzoneTokenIdentifier cannot be cast to String Jan 9, 2023
Copy link
Contributor

@dombizita dombizita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the patch and the detailed comment and description regarding this decision, it looks good to me @devmadhuu

@devmadhuu
Copy link
Contributor Author

@sadanand48 - pls review

// as key.
if (OMDBDefinition.DTOKEN_TABLE.getName().equalsIgnoreCase(tableName)) {
return;
}
Copy link
Contributor

@ChenSammi ChenSammi Jan 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @devmadhuu , can we do something like this?

Object key = codecRegistry.asObject(keyBytes, keyType.get());
builder.setKey(key instanceof String? key : key.toString());

I'm afraid that we filter DTOKEN_TABLE this time. Next time, if there is a new table added in OM which doesn't use String as key, then this filter logic need to be updated again.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChenSammi - I have done changes as suggested. Pls re-review.

@ChenSammi
Copy link
Contributor

The patch LGTM +1.

Thanks @devmadhuu .

@ChenSammi ChenSammi merged commit 59938f9 into apache:master Jan 16, 2023
errose28 added a commit to errose28/ozone that referenced this pull request Apr 20, 2023
* master: (209 commits)
  HDDS-7097. Container scanner log output lacks useful information (apache#4169)
  HDDS-7813. Handle Mismatched Replicas (OPEN or CLOSING) of QUASI-CLOSED containers in RM (apache#4195)
  HDDS-7625. Do not compress OM/SCM checkpoints (apache#4130)
  HDDS-7801. Bucket not found when calling getKeyInfo with tenant context (apache#4189)
  HDDS-7807. TarContainerPacker closes streams multiple times (apache#4193)
  HDDS-7755. Ensure that acquired locks are always released. (apache#4191)
  HDDS-7804. UNHEALTHY replicas will not contribute to sufficient replication in RatisContainerReplicaCount (apache#4192)
  HDDS-7748. Rename OMFileRequest.addToOpenFileTable() to avoid misuse. (apache#4176)
  HDDS-7723. Refresh Keys and Certificate used in OzoneSecretManager after certificate renewed (apache#4179)
  HDDS-7788. Ratis OverReplicationHandler should exclude stale replicas (apache#4183)
  HDDS-7718. Bump Netty to 4.1.86 and gRPC to 1.51.1 (apache#4139)
  HDDS-7542. Refactor DefaultReplicationConfig (apache#4005)
  HDDS-7787. GetChecksum for EC files can fail intermittently with IndexOutOfBounds exception (apache#4180)
  HDDS-7754. Download of container is failing with SSL/TLS error during re-replication (apache#4174)
  HDDS-7455. ClassCastException: OzoneTokenIdentifier cannot be cast to String (apache#4159)
  HDDS-7441. Rename function names of retrieving metadata keys (apache#3918)
  HDDS-7722. FSO buckets fail to invalidate open file table cache when committing a key (apache#4156)
  HDDS-7774. Update outdated Trash documentation (apache#4172)
  HDDS-7761. EC: ReplicationManager - Use placementPolicy.replicasToRemoveToFixOverreplication in EC Over replication handler (apache#4166)
  HDDS-7775. EC: Exception encountered while deleting UNHEALTHY replica in Datanode (apache#4173)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants