[CP] add tenant config lock when cluster config do dump2file
This commit is contained in:
		@ -90,7 +90,7 @@ int64_t TenantConfigInfo::to_string(char *buf, const int64_t buf_len) const
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ObTenantConfigMgr::ObTenantConfigMgr()
 | 
					ObTenantConfigMgr::ObTenantConfigMgr()
 | 
				
			||||||
    : inited_(false), self_(), sql_proxy_(nullptr), rwlock_(ObLatchIds::CONFIG_LOCK),
 | 
					    : rwlock_(ObLatchIds::CONFIG_LOCK), inited_(false), self_(), sql_proxy_(nullptr),
 | 
				
			||||||
      config_map_(), config_version_map_(), sys_config_mgr_(nullptr),
 | 
					      config_map_(), config_version_map_(), sys_config_mgr_(nullptr),
 | 
				
			||||||
      version_has_refreshed_(false), update_tenant_config_cb_()
 | 
					      version_has_refreshed_(false), update_tenant_config_cb_()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -162,7 +162,8 @@ public:
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    return id;
 | 
					    return id;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  // protect config_map_
 | 
				
			||||||
 | 
					  mutable common::DRWLock rwlock_;
 | 
				
			||||||
  OB_UNIS_VERSION(1);
 | 
					  OB_UNIS_VERSION(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
@ -171,8 +172,6 @@ private:
 | 
				
			|||||||
  bool inited_;
 | 
					  bool inited_;
 | 
				
			||||||
  common::ObAddr self_;
 | 
					  common::ObAddr self_;
 | 
				
			||||||
  common::ObMySQLProxy *sql_proxy_;
 | 
					  common::ObMySQLProxy *sql_proxy_;
 | 
				
			||||||
  // protect config_map_
 | 
					 | 
				
			||||||
  mutable common::DRWLock rwlock_;
 | 
					 | 
				
			||||||
  // 租户配置项的映射
 | 
					  // 租户配置项的映射
 | 
				
			||||||
  TenantConfigMap config_map_;
 | 
					  TenantConfigMap config_map_;
 | 
				
			||||||
  TenantConfigVersionMap config_version_map_;
 | 
					  TenantConfigVersionMap config_version_map_;
 | 
				
			||||||
 | 
				
			|||||||
@ -345,13 +345,16 @@ int ObConfigManager::update_local(int64_t expected_version)
 | 
				
			|||||||
      LOG_ERROR("Read server config failed", K(ret));
 | 
					      LOG_ERROR("Read server config failed", K(ret));
 | 
				
			||||||
    } else if (OB_FAIL(reload_config())) {
 | 
					    } else if (OB_FAIL(reload_config())) {
 | 
				
			||||||
      LOG_WARN("Reload configuration failed", K(ret));
 | 
					      LOG_WARN("Reload configuration failed", K(ret));
 | 
				
			||||||
    } else if (OB_FAIL(dump2file())) {
 | 
					 | 
				
			||||||
      LOG_WARN("Dump to file failed", K_(dump_path), K(ret));
 | 
					 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      GCONF.cluster.set_dumped_version(GCONF.cluster.version());
 | 
					      DRWLock::RDLockGuard guard(OTC_MGR.rwlock_); // need protect tenant config because it will also serialize tenant config
 | 
				
			||||||
      LOG_INFO("Reload server config successfully!");
 | 
					      if (OB_FAIL(dump2file())) {
 | 
				
			||||||
      ret = config_backup();
 | 
					        LOG_WARN("Dump to file failed", K_(dump_path), K(ret));
 | 
				
			||||||
   }
 | 
					      } else {
 | 
				
			||||||
 | 
					        GCONF.cluster.set_dumped_version(GCONF.cluster.version());
 | 
				
			||||||
 | 
					        LOG_INFO("Reload server config successfully!");
 | 
				
			||||||
 | 
					        ret = config_backup();
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    server_config_.print();
 | 
					    server_config_.print();
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    LOG_WARN("Read system config from inner table error", K(ret));
 | 
					    LOG_WARN("Read system config from inner table error", K(ret));
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user