~vkolesnikov/pbxt/pbxt-index-selectivity-backscan

« back to all changes in this revision

Viewing changes to src/index_xt.cc

  • Committer: Paul McCullagh
  • Date: 2009-02-25 13:55:29 UTC
  • Revision ID: paul.mccullagh@primebase.org-20090225135529-ffwyswkzju8s4ut6
xt_idx_delete_currentĀ unused

Show diffs side-by-side

added added

removed removed

Lines of Context:
1847
1847
        return FAILED;
1848
1848
}
1849
1849
 
1850
 
xtPublic void xt_idx_delete_current(XTOpenTablePtr ot, XTIndexPtr ind)
1851
 
{
1852
 
        XTIdxKeyValueRec        key_value;
1853
 
        xtWord1                         key_buf[XT_INDEX_MAX_KEY_SIZE + XT_MAX_RECORD_REF_SIZE];
1854
 
        XTIdxItemRec            tmp_state;
1855
 
 
1856
 
        retry_after_oom:
1857
 
#ifdef XT_TRACK_INDEX_UPDATES
1858
 
        ot->ot_ind_changed = 0;
1859
 
#endif
1860
 
 
1861
 
        key_value.sv_flags = XT_SEARCH_WHOLE_KEY;
1862
 
        xt_get_record_ref(&ot->ot_ind_rbuf.tb_data[ot->ot_ind_state.i_item_offset + ot->ot_ind_state.i_item_size - XT_RECORD_REF_SIZE], &key_value.sv_rec_id, &key_value.sv_row_id);
1863
 
        key_value.sv_length = ot->ot_ind_state.i_item_size - XT_RECORD_REF_SIZE;
1864
 
        key_value.sv_key = key_buf;
1865
 
        memcpy(key_buf, &ot->ot_ind_rbuf.tb_data[ot->ot_ind_state.i_item_offset], key_value.sv_length);
1866
 
        tmp_state = ot->ot_ind_state;
1867
 
 
1868
 
        if (!idx_delete(ot, ind, &key_value)) {
1869
 
                if (idx_out_of_memory_failure(ot))
1870
 
                        goto retry_after_oom;
1871
 
                xt_log_and_clear_exception_ns();
1872
 
        }
1873
 
 
1874
 
        /* Setup things so that next or prev will work!
1875
 
         * This basically means that we must force a search
1876
 
         * for the next key value.
1877
 
         *
1878
 
         * I assume that what I am trying to do is restore
1879
 
         * the search value, to that which we had before the
1880
 
         * delete.
1881
 
         *
1882
 
         * The problem is, key_buf can be changed by idx_delete().
1883
 
         *
1884
 
         * However, I am assuming that ot_ind_rbuf does not
1885
 
         * change so we can just restore the state?
1886
 
        ot->ot_ind_state.i_node_ref_size = XT_NODE_REF_SIZE;
1887
 
        ot->ot_ind_state.i_item_offset = 0;
1888
 
        ot->ot_ind_state.i_item_size = key_value.sv_length + XT_RECORD_REF_SIZE;
1889
 
        xt_set_val_record_ref(&ot->ot_ind_rbuf.tb_data[key_value.sv_length], &key_value);
1890
 
        memcpy(ot->ot_ind_rbuf.tb_data, key_buf, key_value.sv_length);
1891
 
         */
1892
 
        ot->ot_ind_state = tmp_state;
1893
 
        /* This will force search, because it says that this is not a leaf
1894
 
         * node. Only leaf nodes can be stepped!
1895
 
         */
1896
 
        ot->ot_ind_state.i_node_ref_size = XT_NODE_REF_SIZE;
1897
 
}
1898
 
 
1899
1850
xtPublic xtBool xt_idx_delete(XTOpenTablePtr ot, XTIndexPtr ind, xtRecordID rec_id, xtWord1 *rec_buf)
1900
1851
{
1901
1852
        XTIdxKeyValueRec        key_value;