| 1468 | } |
| 1469 | |
| 1470 | Chunk StorageKeeperMap::getBySerializedKeys( |
| 1471 | const std::span<const std::string> keys, PaddedPODArray<UInt8> * null_map, bool with_version, const ContextPtr & local_context) const |
| 1472 | { |
| 1473 | auto metadata_snapshot = getInMemoryMetadataPtr(local_context, false); |
| 1474 | Block sample_block = metadata_snapshot->getSampleBlock(); |
| 1475 | MutableColumns columns = sample_block.cloneEmptyColumns(); |
| 1476 | MutableColumnPtr version_column = nullptr; |
| 1477 | |
| 1478 | if (with_version) |
| 1479 | version_column = ColumnVector<Int32>::create(); |
| 1480 | |
| 1481 | size_t primary_key_pos = getPrimaryKeyPos(sample_block, getPrimaryKey()); |
| 1482 | |
| 1483 | if (null_map) |
| 1484 | { |
| 1485 | null_map->clear(); |
| 1486 | null_map->resize_fill(keys.size(), 1); |
| 1487 | } |
| 1488 | |
| 1489 | Strings full_key_paths; |
| 1490 | full_key_paths.reserve(keys.size()); |
| 1491 | |
| 1492 | for (const auto & key : keys) |
| 1493 | full_key_paths.emplace_back(fullPathForKey(key)); |
| 1494 | |
| 1495 | const auto & settings = local_context->getSettingsRef(); |
| 1496 | ZooKeeperRetriesControl zk_retry{ |
| 1497 | getName(), |
| 1498 | getLogger(getName()), |
| 1499 | ZooKeeperRetriesInfo{ |
| 1500 | settings[Setting::keeper_max_retries], |
| 1501 | settings[Setting::keeper_retry_initial_backoff_ms], |
| 1502 | settings[Setting::keeper_retry_max_backoff_ms], |
| 1503 | local_context->getProcessListElement()}}; |
| 1504 | |
| 1505 | zkutil::ZooKeeper::MultiTryGetResponse values; |
| 1506 | zk_retry.retryLoop([&]{ |
| 1507 | auto client = getClient(); |
| 1508 | values = client->tryGet(full_key_paths); |
| 1509 | }); |
| 1510 | |
| 1511 | for (size_t i = 0; i < keys.size(); ++i) |
| 1512 | { |
| 1513 | auto response = values[i]; |
| 1514 | |
| 1515 | Coordination::Error code = response.error; |
| 1516 | |
| 1517 | if (code == Coordination::Error::ZOK) |
| 1518 | { |
| 1519 | fillColumns(base64Decode(keys[i], true), response.data, primary_key_pos, sample_block, columns); |
| 1520 | |
| 1521 | if (version_column) |
| 1522 | version_column->insert(response.stat.version); |
| 1523 | } |
| 1524 | else if (code == Coordination::Error::ZNONODE) |
| 1525 | { |
| 1526 | if (null_map) |
| 1527 | { |
no test coverage detected