summaryrefslogtreecommitdiff
path: root/src/btree/bt_upgrade.c
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2015-02-17 17:25:57 +0000
committer <>2015-03-17 16:26:24 +0000
commit780b92ada9afcf1d58085a83a0b9e6bc982203d1 (patch)
tree598f8b9fa431b228d29897e798de4ac0c1d3d970 /src/btree/bt_upgrade.c
parent7a2660ba9cc2dc03a69ddfcfd95369395cc87444 (diff)
downloadberkeleydb-master.tar.gz
Imported from /home/lorry/working-area/delta_berkeleydb/db-6.1.23.tar.gz.HEADdb-6.1.23master
Diffstat (limited to 'src/btree/bt_upgrade.c')
-rw-r--r--src/btree/bt_upgrade.c94
1 files changed, 93 insertions, 1 deletions
diff --git a/src/btree/bt_upgrade.c b/src/btree/bt_upgrade.c
index c9123351..66e27d56 100644
--- a/src/btree/bt_upgrade.c
+++ b/src/btree/bt_upgrade.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
@@ -9,6 +9,7 @@
#include "db_config.h"
#include "db_int.h"
+#include "dbinc/blob.h"
#include "dbinc/db_page.h"
#include "dbinc/db_upgrade.h"
#include "dbinc/btree.h"
@@ -151,3 +152,94 @@ __bam_31_lbtree(dbp, real_name, flags, fhp, h, dirtyp)
return (ret);
}
+
+/*
+ * __bam_60_btreemeta--
+ * Upgrade the version number.
+ *
+ * PUBLIC: int __bam_60_btreemeta
+ * PUBLIC: __P((DB *, char *, u_int32_t, DB_FH *, PAGE *, int *));
+ */
+int
+__bam_60_btreemeta(dbp, real_name, flags, fhp, h, dirtyp)
+ DB *dbp;
+ char *real_name;
+ u_int32_t flags;
+ DB_FH *fhp;
+ PAGE *h;
+ int *dirtyp;
+{
+ BTMETA33 *bmeta;
+
+ COMPQUIET(flags, 0);
+ COMPQUIET(real_name, NULL);
+ COMPQUIET(fhp, NULL);
+ COMPQUIET(dbp, NULL);
+ bmeta = (BTMETA33 *)h;
+
+ bmeta->dbmeta.version = 10;
+ *dirtyp = 1;
+
+ return (0);
+}
+
+/*
+ * __bam_60_lbtree --
+ * Upgrade the blob records on the database btree leaf pages.
+ *
+ * PUBLIC: int __bam_60_lbtree
+ * PUBLIC: __P((DB *, char *, u_int32_t, DB_FH *, PAGE *, int *));
+ */
+int
+__bam_60_lbtree(dbp, real_name, flags, fhp, h, dirtyp)
+ DB *dbp;
+ char *real_name;
+ u_int32_t flags;
+ DB_FH *fhp;
+ PAGE *h;
+ int *dirtyp;
+{
+ BBLOB60 bl60;
+ BBLOB60P1 bl60p1;
+ BKEYDATA *bk;
+ db_seq_t blob_id, blob_size, file_id, sdb_id;
+ db_indx_t indx;
+ int ret;
+
+ COMPQUIET(flags, 0);
+ COMPQUIET(real_name, NULL);
+ COMPQUIET(fhp, NULL);
+ ret = 0;
+
+ DB_ASSERT(dbp->env, BBLOB60_SIZE == BBLOB_SIZE);
+ for (indx = O_INDX; indx < NUM_ENT(h); indx += P_INDX) {
+ bk = GET_BKEYDATA(dbp, h, indx);
+ if (B_TYPE(bk->type) == B_BLOB ) {
+ memcpy(&bl60, bk, BBLOB60_SIZE);
+ memset(&bl60p1, 0, BBLOB_SIZE);
+ bl60p1.type = bl60.type;
+ bl60p1.len = BBLOB_DSIZE;
+ bl60p1.encoding = bl60.encoding;
+ GET_BLOB60_ID(dbp->env, bl60, blob_id, ret);
+ if (ret != 0)
+ return (ret);
+ GET_BLOB60_SIZE(dbp->env, bl60, blob_size, ret);
+ if (ret != 0)
+ return (ret);
+ GET_BLOB60_FILE_ID(dbp->env, &bl60, file_id, ret);
+ if (ret != 0)
+ return (ret);
+ GET_BLOB60_SDB_ID(dbp->env, &bl60, sdb_id, ret);
+ if (ret != 0)
+ return (ret);
+ SET_BLOB_ID(&bl60p1, blob_id, BBLOB60P1);
+ SET_BLOB_SIZE(&bl60p1, blob_size, BBLOB60P1);
+ SET_BLOB_FILE_ID(&bl60p1, file_id, BBLOB60P1);
+ SET_BLOB_SDB_ID(&bl60p1, sdb_id, BBLOB60P1);
+ memcpy(bk, &bl60p1, BBLOB_SIZE);
+ *dirtyp = 1;
+ }
+ }
+
+ return (ret);
+}