MCPcopy Create free account
hub / github.com/MariaDB/server / ResetTableOpt

Method ResetTableOpt

storage/connect/tabdos.cpp:567–636  ·  view source on GitHub ↗

/ Remake the indexes after the table was modified. */ /

Source from the content-addressed store, hash-verified

565/* Remake the indexes after the table was modified. */
566/***********************************************************************/
567int TDBDOS::ResetTableOpt(PGLOBAL g, bool dop, bool dox)
568 {
569 int prc = RC_OK, rc = RC_OK;
570
571 if (!GetFileLength(g)) {
572 // Void table, delete all opt and index files
573 PDOSDEF defp = (PDOSDEF)To_Def;
574
575 defp->RemoveOptValues(g);
576 return (defp->DeleteIndexFile(g, NULL)) ? RC_INFO : RC_OK;
577 } // endif GetFileLength
578
579 MaxSize = -1; // Size must be recalculated
580 Cardinal = -1; // as well as Cardinality
581
582 To_Filter = NULL; // Disable filtering
583//To_BlkIdx = NULL; // and index filtering
584 To_BlkFil = NULL; // and block filtering
585
586 // After the table was modified the indexes
587 // are invalid and we should mark them as such...
588 (void)((PDOSDEF)To_Def)->InvalidateIndex(g);
589
590 if (dop) {
591 Columns = NULL; // Not used anymore
592
593 if (Txfp->Blocked) {
594 // MakeBlockValues must be executed in non blocked mode
595 // except for ZLIB access method.
596 if (Txfp->GetAmType() == TYPE_AM_MAP) {
597 Txfp = new(g) MAPFAM((PDOSDEF)To_Def);
598#if defined(GZ_SUPPORT)
599 } else if (Txfp->GetAmType() == TYPE_AM_GZ) {
600 Txfp = new(g) GZFAM((PDOSDEF)To_Def);
601 } else if (Txfp->GetAmType() == TYPE_AM_ZLIB) {
602 Txfp->Reset();
603 ((PZLBFAM)Txfp)->SetOptimized(false);
604#endif // GZ_SUPPORT
605 } else if (Txfp->GetAmType() == TYPE_AM_BLK)
606 Txfp = new(g) DOSFAM((PDOSDEF)To_Def);
607
608 Txfp->SetTdbp(this);
609 } else
610 Txfp->Reset();
611
612 Use = USE_READY; // So the table can be reopened
613 Mode = MODE_ANY; // Just to be clean
614 rc = MakeBlockValues(g); // Redo optimization
615 } // endif dop
616
617 if (dox && (rc == RC_OK || rc == RC_INFO)) {
618 // Remake eventual indexes
619// if (Mode != MODE_UPDATE)
620 To_SetCols = NULL; // Positions are changed
621
622 Columns = NULL; // Not used anymore
623 Txfp->Reset(); // New start
624 Use = USE_READY; // So the table can be reopened

Callers

nothing calls this directly

Calls 9

PlgGetUserFunction · 0.85
MakeIndexFunction · 0.85
RemoveOptValuesMethod · 0.80
DeleteIndexFileMethod · 0.80
InvalidateIndexMethod · 0.80
SetTdbpMethod · 0.80
GetFileLengthFunction · 0.70
GetAmTypeMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected