~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/unique.h

  • Committer: Brian Aker
  • Date: 2010-09-09 21:45:53 UTC
  • mto: (1756.1.2 build) (1768.2.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 1757.
  • Revision ID: brian@tangent.org-20100909214553-e687rmf5zk9478on
Force unique to just use memory and let the OS handle paging.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
 
41
41
class Unique : public memory::SqlAlloc
42
42
{
43
 
  DYNAMIC_ARRAY file_ptrs;
44
 
  ulong max_elements;
45
43
  size_t max_in_memory_size;
46
 
  internal::IO_CACHE *file;
47
44
  TREE tree;
48
45
  unsigned char *record_pointers;
49
 
  bool flush();
50
46
  uint32_t size;
51
47
 
52
48
public:
57
53
  ulong elements_in_tree() { return tree.elements_in_tree; }
58
54
  inline bool unique_add(void *ptr)
59
55
  {
60
 
    if (tree.elements_in_tree > max_elements && flush())
61
 
      return(1);
62
 
    return(!tree_insert(&tree, ptr, 0, tree.custom_arg));
 
56
    return (not tree_insert(&tree, ptr, 0, tree.custom_arg));
63
57
  }
64
58
 
65
59
  bool get(Table *table);