Beispiel #1
0
 void PerconaFTEngine::Stats(Context& ctx, std::string& str)
 {
     str.append("perconaft_version:").append(stringfromll(DB_VERSION_MAJOR)).append(".").append(stringfromll(DB_VERSION_MINOR)).append(".").append(
             stringfromll(DB_VERSION_PATCH)).append("\r\n");
     DataArray nss;
     ListNameSpaces(ctx, nss);
     PerconaFTLocalContext& local_ctx = g_local_ctx.GetValue();
     for (size_t i = 0; i < nss.size(); i++)
     {
         DB* db = GetFTDB(ctx, nss[i], false);
         if (NULL == db)
             continue;
         str.append("\r\nDB[").append(nss[i].AsString()).append("] Stats:\r\n");
         DB_BTREE_STAT64 st;
         memset(&st, 0, sizeof(st));
         db->stat64(db, local_ctx.transc.Peek(), &st);
         str.append("bt_nkeys:").append(stringfromll(st.bt_nkeys)).append("\r\n");
         str.append("bt_ndata:").append(stringfromll(st.bt_ndata)).append("\r\n");
         str.append("bt_fsize:").append(stringfromll(st.bt_fsize)).append("\r\n");
         str.append("bt_dsize:").append(stringfromll(st.bt_dsize)).append("\r\n");
         str.append("bt_create_time_sec:").append(stringfromll(st.bt_create_time_sec)).append("\r\n");
         str.append("bt_modify_time_sec:").append(stringfromll(st.bt_modify_time_sec)).append("\r\n");
         str.append("bt_verify_time_sec:").append(stringfromll(st.bt_verify_time_sec)).append("\r\n");
     }
 }
Beispiel #2
0
 int Engine::FlushAll(Context& ctx)
 {
     DataArray nss;
     ListNameSpaces(ctx, nss);
     for (size_t i = 0; i < nss.size(); i++)
     {
         Flush(ctx, nss[i]);
     }
     return 0;
 }
Beispiel #3
0
 int Engine::CompactAll(Context& ctx)
 {
     DataArray nss;
     ListNameSpaces(ctx, nss);
     for (size_t i = 0; i < nss.size(); i++)
     {
         KeyObject start, end;
         start.SetNameSpace(nss[i]);
         Compact(ctx, start, end);
     }
     return 0;
 }
Beispiel #4
0
DEBUG_LOCAL int ProcessArgs( int argc, char* argv[] )
{	
	OSStatus			err;
	int					i;
	const char *		name;
	const char *		guid;
	const char *		path;
			
	if( argc <= 1 )
	{
		Usage();
		err = 0;
		goto exit;
	}
	for( i = 1; i < argc; ++i )
	{
		if( strcmp( argv[ i ], "-install" ) == 0 )
		{
			// Install
			
			if( argc <= ( i + 3 ) )
			{
				fprintf( stderr, "\n### ERROR: missing arguments for %s\n\n", argv[ i ] );
				Usage();
				err = kParamErr;
				goto exit;
			}
			name = argv[ ++i ];
			guid = argv[ ++i ];
			path = argv[ ++i ];
			
			if( *name == '\0' )
			{
				name = "DotLocalNSP";
			}
			if( *guid == '\0' )
			{
				guid = "B600E6E9-553B-4a19-8696-335E5C896153";
			}
			
			err = InstallNSP( name, guid, path );
			require_noerr( err, exit );
		}
		else if( strcmp( argv[ i ], "-remove" ) == 0 )
		{
			// Remove
			
			if( argc <= ( i + 1 ) )
			{
				fprintf( stderr, "\n### ERROR: missing arguments for %s\n\n", argv[ i ] );
				Usage();
				err = kParamErr;
				goto exit;
			}
			guid = argv[ ++i ];
			if( *guid == '\0' )
			{
				guid = "B600E6E9-553B-4a19-8696-335E5C896153";
			}
			
			err = RemoveNSP( guid );
			require_noerr( err, exit );
		}
		else if( ( strcmp( argv[ i ], "-enable" )  == 0 ) || 
				 ( strcmp( argv[ i ], "-disable" ) == 0 ) )
		{
			BOOL		enable;
			
			// Enable/Disable
			
			enable = ( strcmp( argv[ i ], "-enable" ) == 0 );
			if( argc <= ( i + 1 ) )
			{
				fprintf( stderr, "\n### ERROR: missing arguments for %s\n\n", argv[ i ] );
				Usage();
				err = kParamErr;
				goto exit;
			}
			guid = argv[ ++i ];
			
			err = EnableNSP( guid, enable );
			require_noerr( err, exit );
		}
		else if( strcmp( argv[ i ], "-list" ) == 0 )
		{
			// List
						
			err = ListNameSpaces();
			require_noerr( err, exit );
		}
		else if( strcmp( argv[ i ], "-reorder" ) == 0 )
		{
			// Reorder
			
			err = ReorderNameSpaces();
			require_noerr( err, exit );
		}
		else if( strcmp( argv[ i ], "-q" ) == 0 )
		{
			gToolQuietMode = TRUE;
		}
		else if( ( strcmp( argv[ i ], "-help" ) == 0 ) || 
				 ( strcmp( argv[ i ], "-h" ) == 0 ) )
		{
			// Help
			
			Usage();
			err = 0;
			goto exit;
		}
		else
		{
			fprintf( stderr, "\n### ERROR: unknown argment: \"%s\"\n\n", argv[ i ] );
			Usage();
			err = kParamErr;
			goto exit;
		}
	}
	err = kNoErr;
	
exit:
	return( err );
}