MCPcopy Create free account
hub / github.com/ByConity/ByConity / addCreateQuery

Method addCreateQuery

src/CloudServices/CnchServerResource.cpp:199–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197}
198
199void CnchServerResource::addCreateQuery(
200 const ContextPtr & context,
201 const StoragePtr & storage,
202 const String & create_query,
203 const String & worker_table_name,
204 bool create_local_table)
205{
206 /// table should exists in SelectStreamFactory::createForShard
207 /// so we create table in worker in advance
208 if (context->getServerType() == ServerType::cnch_worker && create_local_table)
209 {
210 auto temp_context = Context::createCopy(context);
211 auto worker_resource = context->getCnchWorkerResource();
212 worker_resource->executeCreateQuery(temp_context, create_query, /* skip_if_exists */ true);
213 }
214
215 auto lock = getLock();
216
217 auto it = assigned_table_resource.find(storage->getStorageUUID());
218 if(storage->getStorageUUID() == UUIDHelpers::Nil)
219 {
220 // throw DB::Exception(ErrorCodes::LOGICAL_ERROR, "UUID for resources should not be nil");
221 LOG_DEBUG(log, "UUID for resources should not be nil, query: {}, table: {}", create_query, worker_table_name);
222 }
223 if (it == assigned_table_resource.end())
224 it = assigned_table_resource.emplace(storage->getStorageUUID(), AssignedResource{storage}).first;
225
226 it->second.table_definition.definition = create_query;
227 it->second.table_definition.local_table_name = worker_table_name;
228 it->second.table_definition.cacheable = false;
229}
230
231void CnchServerResource::addCacheableCreateQuery(
232 const StoragePtr & storage,

Callers 5

collectResourceMethod · 0.80
sendPreloadTasksMethod · 0.80
collectResourceMethod · 0.80
collectResourceMethod · 0.80

Calls 8

getLockFunction · 0.85
getServerTypeMethod · 0.80
getCnchWorkerResourceMethod · 0.80
executeCreateQueryMethod · 0.80
getStorageUUIDMethod · 0.80
findMethod · 0.45
endMethod · 0.45
emplaceMethod · 0.45

Tested by

no test coverage detected