Server (debug build) aborts with message and stacktrace:
```
[ilezhankin-ch.sas.yp-c.yandex.net] 2020.12.28 19:26:10.541564 [ 32781 ] {7eaaebc8-e9d8-416d-b5b0-9d0c1b2b33f3} <Fatal> : Logical error: 'Block structure mismatch in RemoteBlockOutputStream stream: different types:
key UInt64 UInt64(size = 1)
key Nullable(UInt64) Nullable(size = 0, UInt64(size = 0), UInt8(size = 0))'.
[ilezhankin-ch.sas.yp-c.yandex.net] 2020.12.28 19:26:10.544518 [ 32809 ] <Fatal> BaseDaemon: ########################################
[ilezhankin-ch.sas.yp-c.yandex.net] 2020.12.28 19:26:10.545456 [ 32809 ] <Fatal> BaseDaemon: (version 20.13.1.1, build id: AE685CCCCBE23990) (from thread 32781) (query_id: 7eaaebc8-e9d8-416d-b5b0-9d0c1b2b33f3) Received signal Aborted (6)
[ilezhankin-ch.sas.yp-c.yandex.net] 2020.12.28 19:26:10.546146 [ 32809 ] <Fatal> BaseDaemon: 
[ilezhankin-ch.sas.yp-c.yandex.net] 2020.12.28 19:26:10.546718 [ 32809 ] <Fatal> BaseDaemon: Stack trace: 0x7f7936dd3fb7 0x7f7936dd5921 0x7f793a9e961b 0x7f793a9e96c8 0x7f7925431f43 0x7f792542f26b 0x7f792542ec75 0x7f7924dfcdde 0x7f79209a3b2a 0x7f79209a2e7d 0x7f79209a2e2d 0x7f79209a2dfd 0x7f79209a1fce 0x7f793b302335 0x7f793b3022d5 0x7f793aa71ddd 0x7f793aa7d424 0x7f793aa7d3ed 0x7f793aa7d3a1 0x7f793aa7d2e2 0x7f793aa7d1c7 0x7f793aa7d0fd 0x7f793aa7d0ad 0x7f793aa7d07d 0x7f793aa7c20e 0x7f793b302335 0x7f793b3022d5 0x7f793aa703cd
[ilezhankin-ch.sas.yp-c.yandex.net] 2020.12.28 19:26:10.842682 [ 32809 ] <Fatal> BaseDaemon: 4. /build/glibc-S7xCS9/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51: __GI_raise @ 0x3efb7 in /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.27.so
[ilezhankin-ch.sas.yp-c.yandex.net] 2020.12.28 19:26:11.276023 [ 32809 ] <Fatal> BaseDaemon: 5. /build/glibc-S7xCS9/glibc-2.27/stdlib/abort.c:81: __GI_abort @ 0x40921 in /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.27.so
[ilezhankin-ch.sas.yp-c.yandex.net] 2020.12.28 19:26:11.276857 [ 32809 ] <Fatal> BaseDaemon: 6. /home/ilezhankin/gh/ch/build/../src/Common/Exception.cpp:50: DB::handle_error_code(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x2a561b in /home/ilezhankin/gh/ch/build/src/libclickhouse_common_iod.so
[ilezhankin-ch.sas.yp-c.yandex.net] 2020.12.28 19:26:11.277373 [ 32809 ] <Fatal> BaseDaemon: 7. /home/ilezhankin/gh/ch/build/../src/Common/Exception.cpp:56: DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x2a56c8 in /home/ilezhankin/gh/ch/build/src/libclickhouse_common_iod.so
[ilezhankin-ch.sas.yp-c.yandex.net] 2020.12.28 19:26:11.281075 [ 32809 ] <Fatal> BaseDaemon: 8. /home/ilezhankin/gh/ch/build/../src/Core/Block.cpp:483: void DB::checkBlockStructure<void>(DB::Block const&, DB::Block const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::'lambda'(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)::operator()(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) const @ 0x2d7f43 in /home/ilezhankin/gh/ch/build/src/libclickhouse_cored.so
[ilezhankin-ch.sas.yp-c.yandex.net] 2020.12.28 19:26:11.282268 [ 32809 ] <Fatal> BaseDaemon: 9. /home/ilezhankin/gh/ch/build/../src/Core/Block.cpp:503: void DB::checkBlockStructure<void>(DB::Block const&, DB::Block const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x2d526b in /home/ilezhankin/gh/ch/build/src/libclickhouse_cored.so
[ilezhankin-ch.sas.yp-c.yandex.net] 2020.12.28 19:26:11.282845 [ 32809 ] <Fatal> BaseDaemon: 10. /home/ilezhankin/gh/ch/build/../src/Core/Block.cpp:538: DB::assertBlocksHaveEqualStructure(DB::Block const&, DB::Block const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x2d4c75 in /home/ilezhankin/gh/ch/build/src/libclickhouse_cored.so
[ilezhankin-ch.sas.yp-c.yandex.net] 2020.12.28 19:26:11.285838 [ 32809 ] <Fatal> BaseDaemon: 11. /home/ilezhankin/gh/ch/build/../src/DataStreams/RemoteBlockOutputStream.cpp:76: DB::RemoteBlockOutputStream::write(DB::Block const&) @ 0x2fddde in /home/ilezhankin/gh/ch/build/src/libclickhouse_datastreamsd.so
[ilezhankin-ch.sas.yp-c.yandex.net] 2020.12.28 19:26:11.289550 [ 32809 ] <Fatal> BaseDaemon: 12. /home/ilezhankin/gh/ch/build/../src/Storages/Distributed/DistributedBlockOutputStream.cpp:341: DB::DistributedBlockOutputStream::runWritingJob(DB::DistributedBlockOutputStream::JobReplica&, DB::Block const&, unsigned long)::$_0::operator()() const @ 0x171b2a in /home/ilezhankin/gh/ch/build/src/libclickhouse_storages_distributedd.so
[ilezhankin-ch.sas.yp-c.yandex.net] 2020.12.28 19:26:11.290874 [ 32809 ] <Fatal> BaseDaemon: 13. /home/ilezhankin/gh/ch/build/../contrib/libcxx/include/type_traits:3519: decltype(std::__1::forward<DB::DistributedBlockOutputStream::runWritingJob(DB::DistributedBlockOutputStream::JobReplica&, DB::Block const&, unsigned long)::$_0&>(fp)()) std::__1::__invoke<DB::DistributedBlockOutputStream::runWritingJob(DB::DistributedBlockOutputStream::JobReplica&, DB::Block const&, unsigned long)::$_0&>(DB::DistributedBlockOutputStream::runWritingJob(DB::DistributedBlockOutputStream::JobReplica&, DB::Block const&, unsigned long)::$_0&) @ 0x170e7d in /home/ilezhankin/gh/ch/build/src/libclickhouse_storages_distributedd.so
[ilezhankin-ch.sas.yp-c.yandex.net] 2020.12.28 19:26:11.295059 [ 32809 ] <Fatal> BaseDaemon: 14. /home/ilezhankin/gh/ch/build/../contrib/libcxx/include/__functional_base:349: void std::__1::__invoke_void_return_wrapper<void>::__call<DB::DistributedBlockOutputStream::runWritingJob(DB::DistributedBlockOutputStream::JobReplica&, DB::Block const&, unsigned long)::$_0&>(DB::DistributedBlockOutputStream::runWritingJob(DB::DistributedBlockOutputStream::JobReplica&, DB::Block const&, unsigned long)::$_0&) @ 0x170e2d in /home/ilezhankin/gh/ch/build/src/libclickhouse_storages_distributedd.so
[ilezhankin-ch.sas.yp-c.yandex.net] 2020.12.28 19:26:11.296074 [ 32809 ] <Fatal> BaseDaemon: 15. /home/ilezhankin/gh/ch/build/../contrib/libcxx/include/functional:1540: std::__1::__function::__alloc_func<DB::DistributedBlockOutputStream::runWritingJob(DB::DistributedBlockOutputStream::JobReplica&, DB::Block const&, unsigned long)::$_0, std::__1::allocator<DB::DistributedBlockOutputStream::runWritingJob(DB::DistributedBlockOutputStream::JobReplica&, DB::Block const&, unsigned long)::$_0>, void ()>::operator()() @ 0x170dfd in /home/ilezhankin/gh/ch/build/src/libclickhouse_storages_distributedd.so
[ilezhankin-ch.sas.yp-c.yandex.net] 2020.12.28 19:26:11.306698 [ 32809 ] <Fatal> BaseDaemon: 16. /home/ilezhankin/gh/ch/build/../contrib/libcxx/include/functional:1714: std::__1::__function::__func<DB::DistributedBlockOutputStream::runWritingJob(DB::DistributedBlockOutputStream::JobReplica&, DB::Block const&, unsigned long)::$_0, std::__1::allocator<DB::DistributedBlockOutputStream::runWritingJob(DB::DistributedBlockOutputStream::JobReplica&, DB::Block const&, unsigned long)::$_0>, void ()>::operator()() @ 0x16ffce in /home/ilezhankin/gh/ch/build/src/libclickhouse_storages_distributedd.so
[ilezhankin-ch.sas.yp-c.yandex.net] 2020.12.28 19:26:11.309953 [ 32809 ] <Fatal> BaseDaemon: 17. /home/ilezhankin/gh/ch/build/../contrib/libcxx/include/functional:1867: std::__1::__function::__value_func<void ()>::operator()() const @ 0x13a335 in /home/ilezhankin/gh/ch/build/programs/server/libclickhouse-server-libd.so
[ilezhankin-ch.sas.yp-c.yandex.net] 2020.12.28 19:26:11.312982 [ 32809 ] <Fatal> BaseDaemon: 18. /home/ilezhankin/gh/ch/build/../contrib/libcxx/include/functional:2473: std::__1::function<void ()>::operator()() const @ 0x13a2d5 in /home/ilezhankin/gh/ch/build/programs/server/libclickhouse-server-libd.so
[ilezhankin-ch.sas.yp-c.yandex.net] 2020.12.28 19:26:11.314012 [ 32809 ] <Fatal> BaseDaemon: 19. /home/ilezhankin/gh/ch/build/../src/Common/ThreadPool.cpp:243: ThreadPoolImpl<ThreadFromGlobalPool>::worker(std::__1::__list_iterator<ThreadFromGlobalPool, void*>) @ 0x32dddd in /home/ilezhankin/gh/ch/build/src/libclickhouse_common_iod.so
…
```
StorageDistributed & storage_,
    const DiskPtr & disk_,
    const std::string & relative_path_,
    ConnectionPoolPtr pool_,
    ActionBlocker & monitor_blocker_,
    BackgroundSchedulePool & bg_pool)
    : storage(storage_)
    , pool(std::move(pool_))
    , disk(disk_)
    , relative_path(relative_path_)
    , path(disk->getPath() + relative_path + '/')
    , should_batch_inserts(storage.global_context.getSettingsRef().distributed_directory_monitor_batch_inserts)
    , dir_fsync(storage.getDistributedSettingsRef().fsync_directories)
    , min_batched_block_size_rows(storage.global_context.getSettingsRef().min_insert_block_size_rows)
    , min_batched_block_size_bytes(storage.global_context.getSettingsRef().min_insert_block_size_bytes)
    , current_batch_file_path(path + "current_batch.txt")
    , default_sleep_time(storage.global_context.getSettingsRef().distributed_directory_monitor_sleep_time_ms.totalMilliseconds())
    , sleep_time(default_sleep_time)
    , max_sleep_time(storage.global_context.getSettingsRef().distributed_directory_monitor_max_sleep_time_ms.totalMilliseconds())
    , log(&Poco::Logger::get(getLoggerName()))
    , monitor_blocker(monitor_blocker_)
    , metric_pending_files(CurrentMetrics::DistributedFilesToInsert, 0)
{
    task_handle = bg_pool.createTask(getLoggerName() + "/Bg", [this]{ run(); });
    task_handle->activateAndSchedule();
}
StorageDistributedDirectoryMonitor::~StorageDistributedDirectoryMonitor()