mirror of
				https://github.com/isar/libmdbx.git
				synced 2025-10-31 15:38:57 +08:00 
			
		
		
		
	mdbx: backport - ITS#8355 fix subcursors.
make sure C_DEL gets reset in subcursor after it moves. Change-Id: I334cadcd981e7578d98e326e6bd785bed709a83a
This commit is contained in:
		
							
								
								
									
										1
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								CHANGES
									
									
									
									
									
								
							| @@ -4,6 +4,7 @@ LMDB 0.9.18 Release Engineering | |||||||
| 	Add MDB_PREV_MULTIPLE | 	Add MDB_PREV_MULTIPLE | ||||||
| 	already done for mdbx - Fix robust mutex detection on glibc 2.10-11 (ITS#8330) | 	already done for mdbx - Fix robust mutex detection on glibc 2.10-11 (ITS#8330) | ||||||
| 	Fix page_search_root assert on FreeDB (ITS#8336) | 	Fix page_search_root assert on FreeDB (ITS#8336) | ||||||
|  | 	Fix subcursor move after delete (ITS#8355) | ||||||
| 	n/a for mdbx - Check for utf8_to_utf16 failures (ITS#7992) | 	n/a for mdbx - Check for utf8_to_utf16 failures (ITS#7992) | ||||||
| 	Catch strdup failure in mdb_dbi_open | 	Catch strdup failure in mdb_dbi_open | ||||||
| 	Build | 	Build | ||||||
|   | |||||||
							
								
								
									
										8
									
								
								mdb.c
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								mdb.c
									
									
									
									
									
								
							| @@ -5814,8 +5814,10 @@ mdb_cursor_next(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) | |||||||
|  |  | ||||||
| 	mdb_debug("cursor_next: top page is %zu in cursor %p", | 	mdb_debug("cursor_next: top page is %zu in cursor %p", | ||||||
| 		mdb_dbg_pgno(mp), (void *) mc); | 		mdb_dbg_pgno(mp), (void *) mc); | ||||||
| 	if (mc->mc_flags & C_DEL) | 	if (mc->mc_flags & C_DEL) { | ||||||
|  | 		mc->mc_flags ^= C_DEL; | ||||||
| 		goto skip; | 		goto skip; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	if (mc->mc_ki[mc->mc_top] + 1u >= NUMKEYS(mp)) { | 	if (mc->mc_ki[mc->mc_top] + 1u >= NUMKEYS(mp)) { | ||||||
| 		mdb_debug("=====> move to next sibling page"); | 		mdb_debug("=====> move to next sibling page"); | ||||||
| @@ -5894,6 +5896,8 @@ mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) | |||||||
| 	mdb_debug("cursor_prev: top page is %zu in cursor %p", | 	mdb_debug("cursor_prev: top page is %zu in cursor %p", | ||||||
| 		mdb_dbg_pgno(mp), (void *) mc); | 		mdb_dbg_pgno(mp), (void *) mc); | ||||||
|  |  | ||||||
|  | 	mc->mc_flags &= ~(C_EOF|C_DEL); | ||||||
|  |  | ||||||
| 	if (mc->mc_ki[mc->mc_top] == 0)  { | 	if (mc->mc_ki[mc->mc_top] == 0)  { | ||||||
| 		mdb_debug("=====> move to prev sibling page"); | 		mdb_debug("=====> move to prev sibling page"); | ||||||
| 		if ((rc = mdb_cursor_sibling(mc, 0)) != MDB_SUCCESS) { | 		if ((rc = mdb_cursor_sibling(mc, 0)) != MDB_SUCCESS) { | ||||||
| @@ -5905,8 +5909,6 @@ mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) | |||||||
| 	} else | 	} else | ||||||
| 		mc->mc_ki[mc->mc_top]--; | 		mc->mc_ki[mc->mc_top]--; | ||||||
|  |  | ||||||
| 	mc->mc_flags &= ~C_EOF; |  | ||||||
|  |  | ||||||
| 	mdb_debug("==> cursor points to page %zu with %u keys, key index %u", | 	mdb_debug("==> cursor points to page %zu with %u keys, key index %u", | ||||||
| 		mdb_dbg_pgno(mp), NUMKEYS(mp), mc->mc_ki[mc->mc_top]); | 		mdb_dbg_pgno(mp), NUMKEYS(mp), mc->mc_ki[mc->mc_top]); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user