Repository: ClickHouse/ClickHouse
File: src/Storages/ObjectStorage/DataLakes/DeltaLake/TableSnapshot.cpp (C++)

Code before:
        }

        scan_data_iterator = KernelUtils::unwrapResult(
            ffi::scan_metadata_iter_init(kernel_snapshot_state->engine.get(), scan.get()),
            "scan_metadata_iter_init");
    }

    void scanDataFunc()
    {
        try
        {
            initScanState();

            LOG_TEST(log, "Starting iterator loop (predicate exception: {})", bool(engine_predicate_exception));

            while (!shutdown.load())
            {
                bool have_scan_data_res = KernelUtils::unwrapResult(
                    ffi::scan_metadata_next(scan_data_iterator.get(), this, visitData),
                    "scan_metadata_next");

                if (have_scan_data_res)
                {
                    std::unique_lock lock(next_mutex);
                    LOG_TEST(log, "List batch size is {}/{}, shutdown: {}",
                             data_files.size(), list_batch_size, shutdown.load());

                    if (!shutdown.load() && list_batch_size && data_files.size() >= list_batch_size)
                    {
                        schedule_next_batch_cv.wait(
                            lock,
                            [&]() { return (data_files.size() < list_batch_size) || shutdown.load(); });
                    }
                }
                else
                {
                    {
                        std::lock_guard lock(next_mutex);
                        iterator_finished = true;
                        LOG_TEST(log, "Set finished");
                    }
                    data_files_cv.notify_all();

                    LOG_TRACE(
                        log, "All data files at version {} were listed "
                        "(scan exception: {}, total data files: {}, total rows: {}, total bytes: {})",
                        kernel_snapshot_state->snapshot_version,
                        bool(scan_exception),
                        total_data_files,
                        total_rows ? DB::toString(*total_rows) : "Unknown",
                        total_bytes);

Review comment (bug):
When `list_batch_size` is `0` (disabled), this log line prints `... is N/0 ...`, which is ambiguous/misleading in logs used by tests and debugging. Consider adjusting the message to explicitly represent the disabled state (or only log the `{}/{}...` form when `list_batch_size > 0`).
```suggestion
                    if (list_batch_size > 0)
                    {
                        LOG_TEST(log, "List batch size is {}/{}, shutdown: {}",
                                 data_files.size(), list_batch_size, shutdown.load());
                    }
                    else
                    {
                        LOG_TEST(log, "List batch size is disabled (current size: {}, shutdown: {})",
                                 data_files.size(), shutdown.load());
                    }
```

Code after:
            ffi::scan_metadata_iter_init(kernel_snapshot_state->engine.get(), scan.get()),
            "scan_metadata_iter_init");
    }

    void scanDataFunc()
    {
        try
        {
            initScanState();

            LOG_TEST(log, "Starting iterator loop (predicate exception: {})", bool(engine_predicate_exception));

            while (!shutdown.load())
            {
                bool have_scan_data_res = KernelUtils::unwrapResult(
                    ffi::scan_metadata_next(scan_data_iterator.get(), this, visitData),
                    "scan_metadata_next");

                if (have_scan_data_res)
                {
                    std::unique_lock lock(next_mutex);
                    LOG_TEST(
                        log, "List batch size is {}/{}, shutdown: {}",
                        data_files.size(),
                        list_batch_size ? DB::toString(list_batch_size) : "Unlimitted",
                        shutdown.load());

                    if (!shutdown.load() && list_batch_size && data_files.size() >= list_batch_size)
                    {
                        schedule_next_batch_cv.wait(
                            lock,
                            [&]() { return (data_files.size() < list_batch_size) || shutdown.load(); });
                    }
                }
                else
                {
                    {
                        std::lock_guard lock(next_mutex);
                        iterator_finished = true;
                        LOG_TEST(log, "Set finished");
                    }
                    data_files_cv.notify_all();

                    LOG_TRACE(
                        log, "All data files at version {} were listed "
                        "(scan exception: {}, total data files: {}, total rows: {}, total bytes: {})",
                        kernel_snapshot_state->snapshot_version,
                        bool(scan_exception),
                        total_data_files,
                        total_rows ? DB::toString(*total_rows) : "Unknown",
                        total_bytes);