Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the index shard calculation of RGW

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to realize the index shard calculation of RGW". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to realize the index shard calculation of RGW".

Each Object stored in rados in RGW needs to first calculate the shard number of the corresponding metadata storage, and then update the metadata information to the corresponding Object of shard number. The code is as follows

Int RGWRados::get_bucket_index_object (const string& bucket_oid_base, const string& obj_key, uint32_t num_shards, RGWBucketInfo::BIShardsHashType hash_type, string * bucket_obj, int * shard_id) {int r = 0; switch (hash_type) {case RGWBucketInfo::MOD: if (! num_shards) {/ / By default with no sharding, we use the bucket oid as itself (* bucket_obj) = bucket_oid_base If (shard_id) {* shard_id =-1;}} else {

Uint32_t sid = ceph_str_hash_linux (obj_key.c_str (), obj_key.size ()); uint32_t sid2 = sid ^ ((sid & 0xFF))

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 269

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report