sodonnel commented on PR #9305:
URL: https://github.com/apache/ozone/pull/9305#issuecomment-3562644492
> By making `OmBucketInfo` immutable this copy operation can be removed.
That is very unfortunate. BucketInfo contains these fields:
```
private final String volumeName;
private final String bucketName;
private final CopyOnWriteArrayList<OzoneAcl> acls;
private final boolean isVersionEnabled;
private final StorageType storageType;
private final long creationTime;
private final long modificationTime; // Probably mutable
private final BucketEncryptionKeyInfo bekInfo;
private final DefaultReplicationConfig defaultReplicationConfig;
private final String sourceVolume;
private final String sourceBucket;
private final BucketLayout bucketLayout;
private final String owner;
private long usedBytes;
private long usedNamespace;
private final long quotaInBytes;
private final long quotaInNamespace;
private long snapshotUsedBytes;
private long snapshotUsedNamespace;
```
Almost all of these are immutable by definition, but yet a simple increment
of usedBytes requires all the fields to be copied again to update the rocksDB.
Because omBucketInfo is mutated by every create and delete key, it is heavily
mutated.
By making it immutable, for every create key, rather than 1 new copy of the
original object, we will end up with a builder and then a new copy most likely.
It would be nice to split this object in 2, having the immutable fields in
one object and the others in a smaller object, but then to write a single
increment of usedBytes back to rocksDB, we need to convert the entire object
back to proto and write it all back out. I'm not sure how often that happens
though, as there is a cache in the picture too. However there is talk of
removing the cache, at least for keys.
--
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]