Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: delete slot #2251

Merged

Conversation

Mixficsol
Copy link
Collaborator

@Mixficsol Mixficsol commented Dec 28, 2023

背景

在 v3.5.2 版本的 Pika 下,移除了 Sharding 模式,只有经典模式(Classics) 和集群模式(Codis + Pika),对于 Sharding 模式下残留的 Slot,我们需要进行删除,目前 Pika 下只有 DB 这个概念,一个 Pika 下有多个 DB(可配置),DB 目录下有五种数据结构类型的文件

代码改动

删除了 pika_slot.h, pika_slot.cc, pika_migrate_thread.h, pika_migrate_thread.cc这四个文件,对于主从复制模块,我们保留了 protobuf 中的 sloid_id 字段,兼容新旧 Pika 中做主从复制时需要用到的 slot_id 值,如下:

src/pika_repl_client.cc

  InnerMessage::Slot* db = db_sync->mutable_slot();
  db->set_db_name(db_name);
  /*
   * Since the slot field is written in protobuffer,
   * slot_id is set to the default value 0 for compatibility
   * with older versions, but slot_id is not used
   */
  db->set_slot_id(0); // 保留字段

我们把 pika_slot.hpika_slot.cc 中的代码迁移至 pika_db.hpika_db.cc 中,并且把 Pika 中的 Sharding 模式代码以及 Rsync 代码进行了删除,让 Pika 的代码更加简洁易懂,同时我们进行了新旧版本 Pika 之间的主从测试(新主旧从,新从旧主),测试发现没有问题.

fix:#2247

@github-actions github-actions bot added the ☢️ Bug Something isn't working label Dec 28, 2023
@Mixficsol Mixficsol force-pushed the Mixficsol-delete_slot branch 2 times, most recently from d95f9a3 to f68d68e Compare December 28, 2023 09:12
@Mixficsol Mixficsol added 3.5.3 🧹 Updates This will not be worked on labels Dec 28, 2023
@Mixficsol Mixficsol force-pushed the Mixficsol-delete_slot branch 7 times, most recently from 1d0815a to 9762021 Compare January 3, 2024 07:55
include/pika_bit.h Outdated Show resolved Hide resolved
@Mixficsol Mixficsol force-pushed the Mixficsol-delete_slot branch 2 times, most recently from b2af3e3 to e8c14c7 Compare January 10, 2024 09:47
include/pika_cache.h Outdated Show resolved Hide resolved
@Mixficsol Mixficsol force-pushed the Mixficsol-delete_slot branch 10 times, most recently from cc41729 to c00e32f Compare January 19, 2024 02:48
const HintKeys& hint_keys) {
pstd::lock::MultiRecordLock record_lock(slot->LockMgr());
void Cmd::InternalProcessCommand(const HintKeys& hint_keys) {
LOG(INFO) << "xaz";
Copy link
Collaborator

Choose a reason for hiding this comment

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

1

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

if (is_write()) {
record_lock.Lock(current_key());
}

LOG(INFO) << "wxr";
Copy link
Collaborator

Choose a reason for hiding this comment

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

2

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@@ -621,8 +621,6 @@ class PikaConf : public pstd::BaseConf {

private:
pstd::Status InternalGetTargetDB(const std::string& db_name, uint32_t* target);

private:
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个不要去掉。方法和数据的修饰符各自独立使用。

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@AlexStocks AlexStocks merged commit 39fc96e into OpenAtomFoundation:unstable Jan 19, 2024
12 of 13 checks passed
@Mixficsol Mixficsol deleted the Mixficsol-delete_slot branch January 29, 2024 01:50
bigdaronlee163 pushed a commit to bigdaronlee163/pika that referenced this pull request Jun 8, 2024
* delets kv slot

* delete cmd slot

* delete cache slot

* delete slot command

* delete pika_slot.cc/h

* delete sharding code

* delete slot

* Add DB Shared_ptr in Cmd

---------

Co-authored-by: wuxianrong <wuxianrong@360.cn>
cheniujh pushed a commit to cheniujh/pika that referenced this pull request Sep 24, 2024
* delets kv slot

* delete cmd slot

* delete cache slot

* delete slot command

* delete pika_slot.cc/h

* delete sharding code

* delete slot

* Add DB Shared_ptr in Cmd

---------

Co-authored-by: wuxianrong <wuxianrong@360.cn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.5.3 ☢️ Bug Something isn't working core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants