Git Product home page Git Product logo

cmu15-445's People

Contributors

apavlo avatar at15 avatar darkforte avatar jigaoluo avatar lmwnshn avatar louchenyao avatar mbutrovich avatar songzhaozhe avatar thepulkitagarwal avatar tupaschoal avatar utkarsh39 avatar wenxuanqiu avatar xinzhu-cai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

jjjjjjerry

cmu15-445's Issues

Hash Index 实验的 `LinearProbeHashTable::Resize` 的写法貌似有点问题

代码里面直接把所有键值对缓存到内存中再重新插入,但是实验要求里面假设了哈希表非常大,无法直接放入内存中:

// 1. In-memory cache all key-value pair
  std::vector<std::pair<KeyType, ValueType>> pair_cache;
//  pair_cache.reserve()
  assert(page_number == page_ids_cache.size());
  for (size_t page_index = 0; page_index < page_number; page_index++) {
    auto bpm_page = buffer_pool_manager_->FetchPage(page_ids_cache[page_index]);
    bpm_page->RLatch();
    auto block_page = reinterpret_cast<HashTableBlockPage<KeyType, ValueType, KeyComparator>*>(bpm_page->GetData());
    for (slot_offset_t slot_offset = 0;
         slot_offset < ((page_index == page_number - 1) ? BLOCK_ARRAY_SIZE_LAST_PAGE : BLOCK_ARRAY_SIZE_PRO_PAGE);
         slot_offset++) {
      if (block_page->IsReadable(slot_offset)) {
        pair_cache.emplace_back(block_page->KeyAt(slot_offset), block_page->ValueAt(slot_offset));
        block_page->Remove(slot_offset);
      }
    }
    bpm_page->RUnlatch();
    buffer_pool_manager_->UnpinPage(page_ids_cache[page_index], false);
  }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.