assertEquals(v, hcd.getMaxVersions()); hcd.setMinVersions(v); assertEquals(v, hcd.getMinVersions()); hcd.setKeepDeletedCells(KeepDeletedCells.TRUE); hcd.setInMemory(!HColumnDescriptor.DEFAULT_IN_MEMORY); assertEquals(hcd.getValue("a"), deserializedHcd.getValue("a")); assertEquals(hcd.getMaxVersions(), deserializedHcd.getMaxVersions()); assertEquals(hcd.getMinVersions(), deserializedHcd.getMinVersions()); assertEquals(hcd.getKeepDeletedCells(), deserializedHcd.getKeepDeletedCells()); assertEquals(inmemory, deserializedHcd.isInMemory());
Assert.assertEquals(Algorithm.valueOf("GZ"), columnDescriptor.getCompressionType()); Assert.assertEquals(Integer.parseInt("6"), columnDescriptor.getMaxVersions()); Assert.assertEquals(Integer.parseInt("3"), columnDescriptor.getMinVersions()); count++;
Assert.assertEquals(Algorithm.valueOf("GZ"), columnDescriptor.getCompressionType()); Assert.assertEquals(Integer.parseInt("6"), columnDescriptor.getMaxVersions()); Assert.assertEquals(Integer.parseInt("3"), columnDescriptor.getMinVersions()); count++;
/** * @param maxVersions maximum number of versions * @return this (for chained invocation) */ public HColumnDescriptor setMaxVersions(int maxVersions) { if (maxVersions <= 0) { // TODO: Allow maxVersion of 0 to be the way you say "Keep all versions". // Until there is support, consider 0 or < 0 -- a configuration error. throw new IllegalArgumentException("Maximum versions must be positive"); } if (maxVersions < this.getMinVersions()) { throw new IllegalArgumentException("Set MaxVersion to " + maxVersions + " while minVersion is " + this.getMinVersions() + ". Maximum versions must be >= minimum versions "); } setValue(HConstants.VERSIONS, Integer.toString(maxVersions)); cachedMaxVersions = maxVersions; return this; }
/** * @param family {@link HColumnDescriptor} describing the column family * @param ttl Store's TTL (in ms) * @param timeToPurgeDeletes duration in ms after which a delete marker can * be purged during a major compaction. * @param comparator The store's comparator */ public ScanInfo(HColumnDescriptor family, long ttl, long timeToPurgeDeletes, KVComparator comparator) { this(family.getName(), family.getMinVersions(), family.getMaxVersions(), ttl, family .getKeepDeletedCells(), timeToPurgeDeletes, comparator); } /**
/** * @param conf * @param family {@link HColumnDescriptor} describing the column family * @param ttl Store's TTL (in ms) * @param timeToPurgeDeletes duration in ms after which a delete marker can * be purged during a major compaction. * @param comparator The store's comparator */ public ScanInfo(final Configuration conf, final HColumnDescriptor family, final long ttl, final long timeToPurgeDeletes, final KVComparator comparator) { this(conf, family.getName(), family.getMinVersions(), family.getMaxVersions(), ttl, family .getKeepDeletedCells(), timeToPurgeDeletes, comparator); }
if (hcd.getMinVersions() > 0) { message = "MIN_VERSION > 0 is not supported for FIFO compaction"; throw new IOException(message);
assertEquals(v, hcd.getMaxVersions()); hcd.setMinVersions(v); assertEquals(v, hcd.getMinVersions()); hcd.setKeepDeletedCells(KeepDeletedCells.TRUE); hcd.setInMemory(!HColumnDescriptor.DEFAULT_IN_MEMORY); assertEquals(hcd.getValue("a"), deserializedHcd.getValue("a")); assertEquals(hcd.getMaxVersions(), deserializedHcd.getMaxVersions()); assertEquals(hcd.getMinVersions(), deserializedHcd.getMinVersions()); assertEquals(hcd.getKeepDeletedCells(), deserializedHcd.getKeepDeletedCells()); assertEquals(inmemory, deserializedHcd.isInMemory());
private void removeUnneededFiles() throws IOException { if (!conf.getBoolean("hbase.store.delete.expired.storefile", true)) return; if (getFamily().getMinVersions() > 0) { LOG.debug("Skipping expired store file removal due to min version being " + getFamily().getMinVersions()); return; } this.lock.readLock().lock(); Collection<StoreFile> delSfs = null; try { synchronized (filesCompacting) { long cfTtl = getStoreFileTtl(); if (cfTtl != Long.MAX_VALUE) { delSfs = storeEngine.getStoreFileManager().getUnneededFiles( EnvironmentEdgeManager.currentTime() - cfTtl, filesCompacting); addToCompactingFiles(delSfs); } } } finally { this.lock.readLock().unlock(); } if (delSfs == null || delSfs.isEmpty()) return; Collection<StoreFile> newFiles = new ArrayList<StoreFile>(); // No new files. writeCompactionWalRecord(delSfs, newFiles); replaceStoreFiles(delSfs, newFiles); completeCompaction(delSfs); LOG.info("Completed removal of " + delSfs.size() + " unnecessary (expired) file(s) in " + this + " of " + this.getRegionInfo().getRegionNameAsString() + "; total size for store is " + TraditionalBinaryPrefix.long2String(storeSize, "", 1)); }
if (hcd.getMinVersions() < 0) { String message = "Min versions for column family " + hcd.getNameAsString() + " must be positive."; if (hcd.getMinVersions() > hcd.getMaxVersions()) { String message = "Min versions for column family " + hcd.getNameAsString() + " must be less than the Max versions.";
int minVersions = columnDescriptor.getMinVersions(); int ttlSeconds = columnDescriptor.getTimeToLive();
int minVersions = columnDescriptor.getMinVersions(); int ttlSeconds = columnDescriptor.getTimeToLive();
columnFamily.setAttribute(ATTR_CF_KEEP_DELETE_CELLS, ( hColumnDescriptor.getKeepDeletedCells() != null ? hColumnDescriptor.getKeepDeletedCells().name():null)); columnFamily.setAttribute(ATTR_CF_MAX_VERSIONS, hColumnDescriptor.getMaxVersions()); columnFamily.setAttribute(ATTR_CF_MIN_VERSIONS, hColumnDescriptor.getMinVersions()); columnFamily.setAttribute(ATTR_CF_PREFETCH_BLOCK_ONOPEN, hColumnDescriptor.isPrefetchBlocksOnOpen()); columnFamily.setAttribute(ATTR_CF_TTL, hColumnDescriptor.getTimeToLive());
columnFamily.setAttribute(ATTR_CF_KEEP_DELETE_CELLS, ( hColumnDescriptor.getKeepDeletedCells() != null ? hColumnDescriptor.getKeepDeletedCells().name():null)); columnFamily.setAttribute(ATTR_CF_MAX_VERSIONS, hColumnDescriptor.getMaxVersions()); columnFamily.setAttribute(ATTR_CF_MIN_VERSIONS, hColumnDescriptor.getMinVersions()); columnFamily.setAttribute(ATTR_CF_PREFETCH_BLOCK_ONOPEN, hColumnDescriptor.isPrefetchBlocksOnOpen()); columnFamily.setAttribute(ATTR_CF_TTL, hColumnDescriptor.getTimeToLive());
ret.setAttribute(ATTR_CF_KEEP_DELETE_CELLS, ( hcdt.getKeepDeletedCells() != null ? hcdt.getKeepDeletedCells().name():null)); ret.setAttribute(ATTR_CF_MAX_VERSIONS, hcdt.getMaxVersions()); ret.setAttribute(ATTR_CF_MIN_VERSIONS, hcdt.getMinVersions()); ret.setAttribute(ATTR_CF_PREFETCH_BLOCK_ONOPEN, hcdt.isPrefetchBlocksOnOpen()); ret.setAttribute(ATTR_CF_TTL, hcdt.getTimeToLive());
ret.setAttribute(ATTR_CF_KEEP_DELETE_CELLS, ( hcdt.getKeepDeletedCells() != null ? hcdt.getKeepDeletedCells().name():null)); ret.setAttribute(ATTR_CF_MAX_VERSIONS, hcdt.getMaxVersions()); ret.setAttribute(ATTR_CF_MIN_VERSIONS, hcdt.getMinVersions()); ret.setAttribute(ATTR_CF_PREFETCH_BLOCK_ONOPEN, hcdt.isPrefetchBlocksOnOpen()); ret.setAttribute(ATTR_CF_TTL, hcdt.getTimeToLive());