[CP] [GIS] fix srs_guard reuse
This commit is contained in:
@ -138,7 +138,10 @@ int ObSrsCacheGuard::get_srs_item(uint64_t srs_id, const ObSrsItem *&srs_item)
|
||||
int ObTenantSrs::get_tenant_srs_guard(ObSrsCacheGuard &srs_guard)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_FAIL(try_get_last_snapshot(srs_guard))) {
|
||||
if (!srs_guard.empty()) {
|
||||
// do nothing
|
||||
LOG_TRACE("guard isn't empty");
|
||||
} else if (OB_FAIL(try_get_last_snapshot(srs_guard))) {
|
||||
if (ret == OB_ERR_EMPTY_QUERY) {
|
||||
ret = OB_ERR_SRS_EMPTY;
|
||||
LOG_WARN("srs table might be empty", K(ret), K(MTL_ID()));
|
||||
@ -304,12 +307,16 @@ void ObTenantSrs::recycle_last_snapshots()
|
||||
last_sys_snapshot_->~ObSrsCacheSnapShot();
|
||||
allocator_.free(last_sys_snapshot_);
|
||||
last_sys_snapshot_ = NULL;
|
||||
} else if (OB_NOT_NULL(last_sys_snapshot_)) {
|
||||
LOG_INFO("unexpected srs snapshot ref count", K(last_sys_snapshot_->get_ref_count()));
|
||||
}
|
||||
if (OB_NOT_NULL(last_user_snapshot_) &&
|
||||
last_user_snapshot_->get_ref_count() <= 0) {
|
||||
last_user_snapshot_->~ObSrsCacheSnapShot();
|
||||
allocator_.free(last_user_snapshot_);
|
||||
last_user_snapshot_ = NULL;
|
||||
} else if (OB_NOT_NULL(last_user_snapshot_)) {
|
||||
LOG_INFO("unexpected srs snapshot ref count", K(last_user_snapshot_->get_ref_count()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -84,6 +84,7 @@ public:
|
||||
virtual ~ObSrsCacheGuard();
|
||||
int get_srs_item(uint64_t srs_id, const common::ObSrsItem *&srs_item);
|
||||
void set_srs_snapshot(ObSrsCacheSnapShot *srs_cache) { srs_cache_ = srs_cache; }
|
||||
inline bool empty() { return srs_cache_ == nullptr; }
|
||||
private:
|
||||
ObSrsCacheSnapShot *srs_cache_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user