uint64_t sst_getoff(struct sst *sst, struct slice *sk) { int lsn; uint64_t off = 0UL; struct meta_node *meta_info; meta_info = meta_get(sst->meta, sk->data); if(!meta_info) return 0UL; memcpy(sst->name, meta_info->index_name, FILE_NAME_SIZE); /* If get one record from on-disk sst file, * this file must not be operated by bg-merge thread */ lsn = meta_info->lsn; if (sst->mutexer.lsn == lsn) { pthread_mutex_lock(&sst->mutexer.mutex); off = _read_offset(sst, sk); pthread_mutex_unlock(&sst->mutexer.mutex); } else { off = _read_offset(sst, sk); } return off; }
uint64_t silopit_getoff(struct silopit *silopit, struct slice *sk) { int lsn; uint64_t off = 0UL; struct meta_node *meta_info; meta_info = meta_get(silopit->meta, sk->data); if(!meta_info) return 0UL; memcpy(silopit->name, meta_info->index_name, FILE_NAME_SIZE); lsn = meta_info->lsn; if (silopit->mutexer.lsn == lsn) { pthread_mutex_lock(&silopit->mutexer.mutex); off = _read_offset(silopit, sk); pthread_mutex_unlock(&silopit->mutexer.mutex); } else { off = _read_offset(silopit, sk); } return off; }